From 4f5f566c04f9ae11fe871e20eaeb4adf43504bb7 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 20 May 2020 11:52:10 +0300 Subject: fix current alarms (PP only). RFID stubs, --- .../Embedded/Common/Utilities/RFIDTagHandling.c | 7 +- .../Embedded/Common/Utilities/RFIDTagHandling.h | 128 +++++++++++++++++++ .../Embedded/Common/Utilities/RfidTagContent.h | 57 --------- .../PMR/Stubs/StubCartridgeReadResponse.pb-c.c | 92 ++------------ .../PMR/Stubs/StubCartridgeReadResponse.pb-c.h | 17 +-- .../PMR/Stubs/StubCartridgeWriteRequest.pb-c.c | 68 ++-------- .../PMR/Stubs/StubCartridgeWriteRequest.pb-c.h | 14 +-- .../PMR/Stubs/StubCartridgeWriteResponse.pb-c.c | 32 +---- .../PMR/Stubs/StubCartridgeWriteResponse.pb-c.h | 5 +- .../I2C_Communication/Head_Card/ADC/Head_ADC.c | 20 ++- .../I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c | 137 +++++++++++++++------ .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 50 +++++--- .../Embedded/Modules/Diagnostics/Diagnostics.c | 18 +-- .../Embedded_SW/Embedded/Modules/General/process.c | 2 +- .../Embedded/Modules/Heaters/Heaters_print.c | 12 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 2 +- .../Modules/Stubs_Handler/Stub_Cartridge.c | 43 +++---- .../Embedded/Modules/Waste/Waste_init.c | 5 +- .../Embedded/Modules/Waste/newWHS_init.c | 1 + .../StateMachines/Initialization/InitSequence.c | 1 + .../PMR/Messages/Stubs/StubWhsEEpromData.proto | 103 +++++++++++++--- .../stubs/embeddedparametersbuild.cs | 10 +- 22 files changed, 437 insertions(+), 387 deletions(-) create mode 100644 Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.h delete mode 100644 Software/Embedded_SW/Embedded/Common/Utilities/RfidTagContent.h (limited to 'Software') diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c b/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c index 1e6550da4..39c2592ee 100644 --- a/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c +++ b/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c @@ -13,7 +13,7 @@ #include "PMR/Diagnostics/CartridgeValidationResponse.pb-c.h" #include "PMR/Diagnostics/CartridgeTagContent.pb-c.h" #include -#include +#include #include #include "drivers/Valves/Valve.h" #include "Modules/Waste/Waste.h" @@ -244,7 +244,7 @@ CartridgeTagContent * NFCTag_Tag2PPC(NFCTag_t *Tag) return Tag; } -CartridgeTagContent * RFID_Tag2PPC(RfidTagContent *Tag) +/*CartridgeTagContent * RFID_Tag2PPC(RfidTagContent *Tag) { CartridgeTagContent *PpcTag = my_malloc(sizeof(CartridgeTagContent)); @@ -350,4 +350,5 @@ RfidTagContent * RFID_PPC2Tag( CartridgeTagContent *PpcTag) return Tag; -} +}*/ + diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.h b/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.h new file mode 100644 index 000000000..192f1e075 --- /dev/null +++ b/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.h @@ -0,0 +1,128 @@ +/* + * RFIDTagHandling.h + * + * Created on: May 8, 2020 + * Author: shlomo + */ +#include "include.h" + +#include "PMR/Diagnostics/CartridgeTagContent.pb-c.h" +#include + +/* + typedef struct +{ + uint8_t TagUniqueID[8]; //RFID Tag unique ID + char SerialNumber[16]; + char FactoryId[3]; + int32_t FillingSystemId; + char ColorName[12]; + int32_t ColorCategory; + int32_t ColorTypeRevision; + int32_t CartridgeSize; + int32_t FilledInkVolume; + char InkBatchNum[10]; + char InkMFGDate[6]; + char InkEOLDate[6]; + char CartridgeFillingDate[6]; + char WasteFilledDate[6]; + int32_t PlugInCounter; + bool Inkfill; + bool InkUsed; + bool InkEmpty; + bool WasteEmpty; + bool WasteFilling; + bool WasteFull; + bool Blocked; + bool Fail; + int32_t WasteCounter; + char MachineIdInkUsed[16]; + char MachineIdWasteUsed[16]; +}RfidTagContent; +typedef struct +{ + uint8_t TagUniqueID[8]; //RFID Tag unique ID + uint8_t CartSN[16]; //Cartridge serial number + uint32_t InkFactoryID:24; //Ink factory ID + uint32_t FillSysID:16; //Filling system ID number + uint8_t WorkOrder[10]; //Color description / ID + uint8_t ColorName[12]; //Color description / ID + uint32_t InkCategory:16; //Ink category (TBD) + uint32_t Type_Rev; //TBD – can be formulation # + uint32_t CartridgeSize; //Size in cc + uint32_t FiledInkVol; //Size in cc + uint8_t InkBatchNo[10]; //MFG batch No’ + uint8_t InkMFGDate[6]; //Date Ink was manufactured (20L container bar-code) + uint8_t InkEOLDate[6]; //Ink end of life date + uint8_t CartFillDate[6]; //Date cartridge was filled with ink (CFS) + uint8_t WasteFillDate[6]; //Date cartridge was filled with waste (Machine) + uint32_t Misc; + uint32_t PluginCounter:16; //Number of times cartridge was plugged in INK Slot + uint8_t InkFillStatus; //State indicator - successful state change when starting to fill mid. tank + uint8_t InkUsedStatus; + uint8_t InkEmptyStatus; + uint8_t WasteEmptyStatus; + uint8_t WasteFillingStatus; + uint8_t WasteFullStatus; + uint8_t Blocked; + uint8_t Fail; + uint32_t WasteCounter:16; + uint8_t MachineIdINL[16]; + uint8_t MachineIdWST[16]; + uint8_t Spare[13]; + uint32_t Counter; + uint8_t TagValid; + uint8_t HashValue[32]; + uint32_t Checksum_CRC16:16; +}NFCTag_t; + + struct _CartridgeTagContent +{ + ProtobufCMessage base; + protobuf_c_boolean has_uniqueid; + uint32_t uniqueid; + char *serialnumber; + char *factoryid; + protobuf_c_boolean has_fillingsystemid; + int32_t fillingsystemid; + char *colorname; + protobuf_c_boolean has_colorcategory; + int32_t colorcategory; + protobuf_c_boolean has_colortyperevision; + int32_t colortyperevision; + protobuf_c_boolean has_cartridgesize; + int32_t cartridgesize; + protobuf_c_boolean has_filledinkvolume; + int32_t filledinkvolume; + char *inkbatchnum; + char *inkmfgdate; + char *inkeoldate; + char *cartridgefillingdate; + char *wastefilleddate; + protobuf_c_boolean has_plugincounter; + int32_t plugincounter; + protobuf_c_boolean has_inkfill; + protobuf_c_boolean inkfill; + protobuf_c_boolean has_inkused; + protobuf_c_boolean inkused; + protobuf_c_boolean has_inkempty; + protobuf_c_boolean inkempty; + protobuf_c_boolean has_wasteempty; + protobuf_c_boolean wasteempty; + protobuf_c_boolean has_wastefilling; + protobuf_c_boolean wastefilling; + protobuf_c_boolean has_wastefull; + protobuf_c_boolean wastefull; + protobuf_c_boolean has_blocked; + protobuf_c_boolean blocked; + protobuf_c_boolean has_fail; + protobuf_c_boolean fail; + protobuf_c_boolean has_wastecounter; + int32_t wastecounter; + char *machineidinkused; + char *machineidwasteused; +}; + */ +CartridgeTagContent * NFCTag_Tag2PPC(NFCTag_t *Tag); + NFCTag_t * NFCTag_PPC2Tag( CartridgeTagContent *PpcTag); + diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/RfidTagContent.h b/Software/Embedded_SW/Embedded/Common/Utilities/RfidTagContent.h deleted file mode 100644 index daebf8e68..000000000 --- a/Software/Embedded_SW/Embedded/Common/Utilities/RfidTagContent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * RfidTagContent.h - * - * Created on: Jul 8, 2019 - * Author: shlomo - */ - -#ifndef MODULES_IFS_RFIDTAGCONTENT_H_ -#define MODULES_IFS_RFIDTAGCONTENT_H_ - -#include "PMR/Diagnostics/CartridgeSlot.pb-c.h" -#include "PMR/Diagnostics/CartridgeTagContent.pb-c.h" -#include - -#include -#include "include.h" - - -#define MAX_CARTRIDGES (CARTRIDGE_SLOT__WasteLower+1) -typedef struct -{ - char uniqueid[8]; - char serialnumber[16]; - int32_t factoryid; - int32_t fillingsystemid; - char colorname[12]; - int32_t colorcategory; - int32_t colortyperevision; - int32_t cartridgesize; - int32_t filledinkvolume; - char inkbatchnum[10]; - char inkmfgdate[6]; - char inkeoldate[6]; - char cartridgefillingdate[6]; - char wastefilleddate[6]; - int32_t plugincounter; - bool inkfill; - bool inkused; - bool inkempty; - bool wasteempty; - bool wastefilling; - bool wastefull; - bool blocked; - bool fail; - int32_t wastecounter; - char machineidinkused[16]; - char machineidwasteused[16]; -}RfidTagContent; - -CartridgeTagContent * RFID_Tag2PPC(RfidTagContent *Tag); -RfidTagContent * RFID_PPC2Tag( CartridgeTagContent *PpcTag); - -NFCTag_t * NFCTag_PPC2Tag( CartridgeTagContent *PpcTag); -CartridgeTagContent * NFCTag_Tag2PPC(NFCTag_t *Tag); - - -#endif /* MODULES_IFS_RFIDTAGCONTENT_H_ */ diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeReadResponse.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeReadResponse.pb-c.c index f36d10ab1..320752d89 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeReadResponse.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeReadResponse.pb-c.c @@ -52,106 +52,28 @@ void stub_cartridge_read_response__free_unpacked assert(message->base.descriptor == &stub_cartridge_read_response__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } -static const ProtobufCFieldDescriptor stub_cartridge_read_response__field_descriptors[7] = +static const ProtobufCFieldDescriptor stub_cartridge_read_response__field_descriptors[1] = { { "", 1, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(StubCartridgeReadResponse, has_cartridgeid), - offsetof(StubCartridgeReadResponse, cartridgeid), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(StubCartridgeReadResponse, has_cartridgecolor), - offsetof(StubCartridgeReadResponse, cartridgecolor), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "", - 3, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(StubCartridgeReadResponse, has_cartridgeversion), - offsetof(StubCartridgeReadResponse, cartridgeversion), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "", - 4, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_INT32, - offsetof(StubCartridgeReadResponse, has_cartridgedata), - offsetof(StubCartridgeReadResponse, cartridgedata), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "", - 5, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_BOOL, - offsetof(StubCartridgeReadResponse, has_cartridgeused), - offsetof(StubCartridgeReadResponse, cartridgeused), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "", - 6, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_STRING, + PROTOBUF_C_TYPE_MESSAGE, 0, /* quantifier_offset */ - offsetof(StubCartridgeReadResponse, status), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "", - 7, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(StubCartridgeReadResponse, has_statusword), - offsetof(StubCartridgeReadResponse, statusword), - NULL, + offsetof(StubCartridgeReadResponse, cartridge), + &cartridge__descriptor, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, }; static const unsigned stub_cartridge_read_response__field_indices_by_name[] = { - 1, /* field[1] = CartridgeColor */ - 3, /* field[3] = CartridgeData */ - 0, /* field[0] = CartridgeId */ - 4, /* field[4] = CartridgeUsed */ - 2, /* field[2] = CartridgeVersion */ - 5, /* field[5] = Status */ - 6, /* field[6] = StatusWord */ + 0, /* field[0] = Cartridge */ }; static const ProtobufCIntRange stub_cartridge_read_response__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 7 } + { 0, 1 } }; const ProtobufCMessageDescriptor stub_cartridge_read_response__descriptor = { @@ -161,7 +83,7 @@ const ProtobufCMessageDescriptor stub_cartridge_read_response__descriptor = "", "", sizeof(StubCartridgeReadResponse), - 7, + 1, stub_cartridge_read_response__field_descriptors, stub_cartridge_read_response__field_indices_by_name, 1, stub_cartridge_read_response__number_ranges, diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeReadResponse.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeReadResponse.pb-c.h index 3b6c246f5..ae35d64eb 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeReadResponse.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeReadResponse.pb-c.h @@ -14,6 +14,7 @@ PROTOBUF_C__BEGIN_DECLS # error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. #endif +#include "Cartridge.pb-c.h" typedef struct _StubCartridgeReadResponse StubCartridgeReadResponse; @@ -26,23 +27,11 @@ typedef struct _StubCartridgeReadResponse StubCartridgeReadResponse; struct _StubCartridgeReadResponse { ProtobufCMessage base; - protobuf_c_boolean has_cartridgeid; - uint32_t cartridgeid; - protobuf_c_boolean has_cartridgecolor; - uint32_t cartridgecolor; - protobuf_c_boolean has_cartridgeversion; - uint32_t cartridgeversion; - protobuf_c_boolean has_cartridgedata; - int32_t cartridgedata; - protobuf_c_boolean has_cartridgeused; - protobuf_c_boolean cartridgeused; - char *status; - protobuf_c_boolean has_statusword; - uint32_t statusword; + Cartridge *cartridge; }; #define STUB_CARTRIDGE_READ_RESPONSE__INIT \ { PROTOBUF_C_MESSAGE_INIT (&stub_cartridge_read_response__descriptor) \ - , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0 } + , NULL } /* StubCartridgeReadResponse methods */ diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteRequest.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteRequest.pb-c.c index 5831b0b42..6cc23203e 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteRequest.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteRequest.pb-c.c @@ -52,80 +52,28 @@ void stub_cartridge_write_request__free_unpacked assert(message->base.descriptor == &stub_cartridge_write_request__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } -static const ProtobufCFieldDescriptor stub_cartridge_write_request__field_descriptors[5] = +static const ProtobufCFieldDescriptor stub_cartridge_write_request__field_descriptors[1] = { { "", 1, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(StubCartridgeWriteRequest, has_cartridgeid), - offsetof(StubCartridgeWriteRequest, cartridgeid), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(StubCartridgeWriteRequest, has_cartridgecolor), - offsetof(StubCartridgeWriteRequest, cartridgecolor), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "", - 3, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(StubCartridgeWriteRequest, has_cartridgeversion), - offsetof(StubCartridgeWriteRequest, cartridgeversion), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "", - 4, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(StubCartridgeWriteRequest, has_cartridgedata), - offsetof(StubCartridgeWriteRequest, cartridgedata), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "", - 5, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_BOOL, - offsetof(StubCartridgeWriteRequest, has_cartridgeused), - offsetof(StubCartridgeWriteRequest, cartridgeused), - NULL, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(StubCartridgeWriteRequest, cartridge), + &cartridge__descriptor, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, }; static const unsigned stub_cartridge_write_request__field_indices_by_name[] = { - 1, /* field[1] = CartridgeColor */ - 3, /* field[3] = CartridgeData */ - 0, /* field[0] = CartridgeId */ - 4, /* field[4] = CartridgeUsed */ - 2, /* field[2] = CartridgeVersion */ + 0, /* field[0] = Cartridge */ }; static const ProtobufCIntRange stub_cartridge_write_request__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 5 } + { 0, 1 } }; const ProtobufCMessageDescriptor stub_cartridge_write_request__descriptor = { @@ -135,7 +83,7 @@ const ProtobufCMessageDescriptor stub_cartridge_write_request__descriptor = "", "", sizeof(StubCartridgeWriteRequest), - 5, + 1, stub_cartridge_write_request__field_descriptors, stub_cartridge_write_request__field_indices_by_name, 1, stub_cartridge_write_request__number_ranges, diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteRequest.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteRequest.pb-c.h index 89352c4d3..c98f6e073 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteRequest.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteRequest.pb-c.h @@ -14,6 +14,7 @@ PROTOBUF_C__BEGIN_DECLS # error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. #endif +#include "Cartridge.pb-c.h" typedef struct _StubCartridgeWriteRequest StubCartridgeWriteRequest; @@ -26,20 +27,11 @@ typedef struct _StubCartridgeWriteRequest StubCartridgeWriteRequest; struct _StubCartridgeWriteRequest { ProtobufCMessage base; - protobuf_c_boolean has_cartridgeid; - uint32_t cartridgeid; - protobuf_c_boolean has_cartridgecolor; - uint32_t cartridgecolor; - protobuf_c_boolean has_cartridgeversion; - uint32_t cartridgeversion; - protobuf_c_boolean has_cartridgedata; - uint32_t cartridgedata; - protobuf_c_boolean has_cartridgeused; - protobuf_c_boolean cartridgeused; + Cartridge *cartridge; }; #define STUB_CARTRIDGE_WRITE_REQUEST__INIT \ { PROTOBUF_C_MESSAGE_INIT (&stub_cartridge_write_request__descriptor) \ - , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + , NULL } /* StubCartridgeWriteRequest methods */ diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteResponse.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteResponse.pb-c.c index d992cfbf6..e71d7c3be 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteResponse.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteResponse.pb-c.c @@ -52,7 +52,7 @@ void stub_cartridge_write_response__free_unpacked assert(message->base.descriptor == &stub_cartridge_write_response__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } -static const ProtobufCFieldDescriptor stub_cartridge_write_response__field_descriptors[3] = +static const ProtobufCFieldDescriptor stub_cartridge_write_response__field_descriptors[1] = { { "", @@ -66,40 +66,14 @@ static const ProtobufCFieldDescriptor stub_cartridge_write_response__field_descr 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, - { - "", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_STRING, - 0, /* quantifier_offset */ - offsetof(StubCartridgeWriteResponse, status), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "", - 3, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(StubCartridgeWriteResponse, has_statusword), - offsetof(StubCartridgeWriteResponse, statusword), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, }; static const unsigned stub_cartridge_write_response__field_indices_by_name[] = { 0, /* field[0] = CartridgeId */ - 1, /* field[1] = Status */ - 2, /* field[2] = StatusWord */ }; static const ProtobufCIntRange stub_cartridge_write_response__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 3 } + { 0, 1 } }; const ProtobufCMessageDescriptor stub_cartridge_write_response__descriptor = { @@ -109,7 +83,7 @@ const ProtobufCMessageDescriptor stub_cartridge_write_response__descriptor = "", "", sizeof(StubCartridgeWriteResponse), - 3, + 1, stub_cartridge_write_response__field_descriptors, stub_cartridge_write_response__field_indices_by_name, 1, stub_cartridge_write_response__number_ranges, diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteResponse.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteResponse.pb-c.h index d10ce3072..0cfdabea3 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteResponse.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubCartridgeWriteResponse.pb-c.h @@ -28,13 +28,10 @@ struct _StubCartridgeWriteResponse ProtobufCMessage base; protobuf_c_boolean has_cartridgeid; uint32_t cartridgeid; - char *status; - protobuf_c_boolean has_statusword; - uint32_t statusword; }; #define STUB_CARTRIDGE_WRITE_RESPONSE__INIT \ { PROTOBUF_C_MESSAGE_INIT (&stub_cartridge_write_response__descriptor) \ - , 0, 0, NULL, 0, 0 } + , 0, 0 } /* StubCartridgeWriteResponse methods */ diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/ADC/Head_ADC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/ADC/Head_ADC.c index 478de0cfd..304b746e1 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/ADC/Head_ADC.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/ADC/Head_ADC.c @@ -210,10 +210,28 @@ uint32_t Head_I2C_ADC() bool Get_Head_Current(HEAD_ADC_t Head_ADC_ID, double* value) { + double AggregatedValue = 0; + int i; if (Head_Current_Read_Enable[Head_ADC_ID] == false) return ERROR; // Heaters_Current[Heater_ID] - else *value = (Head_ADC[Head_ADC_ID]); + else *value = (Head_ADC[Head_ADC_ID]*100); //Report("Get_Heaters_Current_Integer ",__FILE__,Heater_ID,*value,RpWarning,(int)(Heaters_Current[Heater_ID]*100),0); + if (Head_ADC_ID == HEAD_CURRENT_HTIN_1) + { + for (i = HEAD_CURRENT_HTIN_1;i<=HEAD_CURRENT_HTIN_4;i++) + { + AggregatedValue+=(Head_ADC[i]); + } + *value = AggregatedValue*100; + } + if (Head_ADC_ID == HEAD_CURRENT_HTOT_1) + { + for (i = HEAD_CURRENT_HTOT_1;i<=HEAD_CURRENT_HTOT_4;i++) + { + AggregatedValue+=(Head_ADC[i]); + } + *value = AggregatedValue*100; + } return OK; } double Read_Head_ADC(HEAD_ADC_t Head_ADC_ID) diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c index fbf118024..550c1b5ce 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c @@ -10,6 +10,7 @@ #include #include "../I2C_WHS_Mux.h" #include "Drivers/I2C_Communication/WHS_Card/WHS_data.h" +#include #include "driverlib/i2c.h" #include "PMR/stubs/StubWhsEEpromData.pb-c.h" @@ -193,41 +194,97 @@ uint32_t Test_WHS_EEPROM() } */ /** - * /* ProtobufCMessage base; uint8_t PCB_SN[20]; - uint32_t header; uint8_t Module_SN[20]; - uint32_t tablelength; double Orifice_Pressure_V0[3]; // (meas - uint32_t tableversion; double Orifice_Waste_Level_V0; // (meas - char *whsp_n; double flow_calc_coefficient_C; // C (f - char *pcbs_n; uint32_t Header; - char *pcbpartnumber; uint32_t Table_Length; - char *whss_n; uint32_t Table_version; - double orifice1flow; uint8_t WHS_Part_Number[20];//String - double orifice1slope; // uint8_t PCB_SN[20];//String - double orifice2flow; uint8_t PCB_Part_Number[20];//String - double orifice2slope; uint8_t WHS_SN[20];//String - double orifice3flow; double Orifice1Flow; - double orifice3slope; double Orifice1Slope; - double orificevalveflow; double Orifice2Flow; - double orificevalveslope; double Orifice2Slope; - char *vocinstallationdate; double Orifice3Flow; - char *filterinstallationdate; double Orifice3Slope; - char *productiondate; double OrificeValveFlow; - uint32_t checksum; double OrificeValveSlope; - * uint8_t VOCInstallationDate[8]; - * uint8_t FilterInstallationDate[8]; - uint8_t ProductionDate[8]; - uint32_t CheckSum; -ured orifice sensor voltage with out flow) value for each orifice sensor -ured orifice sensor voltage without flow) value for each orifice sensor -low calculation coefficient) value (=0.239) - * - - * */ +struct _StubWhsEEpromData + uint32_t Header; { + uint32_t Table_Length; ProtobufCMessage base; + uint32_t Table_version; protobuf_c_boolean has_header; + uint8_t WHS_SN[20];//String uint32_t header; + uint8_t PCB_SN[20];//String protobuf_c_boolean has_tablelength; + uint8_t WHS_Part_Number[20];//String uint32_t tablelength; + uint8_t PCB_Part_Number[20];//String protobuf_c_boolean has_tableversion; + uint32_t RunningHours; uint32_t tableversion; + uint32_t SW_Reserve; char *whsp_n; + uint8_t Production_Test_Date[8];//string char *pcbs_n; + uint8_t TestPassFail;//string char *pcbpartnumber; + uint32_t ATS_Location; char *whss_n; + double flow_calc_coefficient_C; // C (flo double orifice1flow; + double Orifice1Flow; protobuf_c_boolean has_orifice1slope; + double Orifice1Slope; double orifice1slope; + double Orifice1MaxPressure; protobuf_c_boolean has_orifice2flow; + double Orifice1CalibrationFactor; double orifice2flow; + double Orifice2Flow; protobuf_c_boolean has_orifice2slope; + double Orifice2Slope; double orifice2slope; + double Orifice2MaxPressure; protobuf_c_boolean has_orifice3flow; + double Orifice2CalibrationFactor; double orifice3flow; + double Orifice3Flow; protobuf_c_boolean has_orifice3slope; + double Orifice3Slope; double orifice3slope; + double Orifice3MaxPressure; protobuf_c_boolean has_orificevalveflow; + double Orifice3CalibrationFactor; double orificevalveflow; + double OrificeValveFlow; protobuf_c_boolean has_orificevalveslope; + double OrificeValveSlope; double orificevalveslope; + double OrificeValveMaxPressure; char *vocinstallationdate; + double OrificeValveCalibrationFactor; char *filterinstallationdate; + double Fans_1_4_PWM_min_Pct; char *productiondate; + double Fans_1_4_RPM_PWM_min; protobuf_c_boolean has_checksum; + double Fans_1_4_PWM_max_Pct; uint32_t checksum; + double Fans_1_4_RPM_PWM_max; + double Fans_1_4_Nom_PWM_Pct; + double Fans_1_4_Nom_RPM; + double Fans_1_4_RPM_Limit_Pct_below_Nom; + double Fans_1_4_Pulse_Per_Revolution; + double Fans_1_4_Spare1; + double Fans_1_4_Spare2; + double Fans_5_6_Nom_RPM; + double Fans_5_6_RPM_Limit_Pct_below_Nom; + double Fans_5_6_Pulse_Per_Revolution; + double Fans_5_6_Spare1; + double Fans_5_6_Spare2; + double Blower_P_Gain; + double Blower_CFMRPM_min; + double Blower_RPM_CFM_max; + double Blower_Calibration_factor; + double Blower_Spare1; + double Blower_Spare2; + double VOC_limit; + double VOC_Spare1; + double VOC_Spare2; + double Controller_Comm_Type; + double Controller_Type; + double Sensor_type; + double Cooler_C_F; + double Cooler_SV; + double Cooler_P; + double Cooler_I; + double Cooler_D; + double Warning_configuration_Par1; + double Warning_configuration_Par2; + double Warning_configuration_Par3; + double Warning_configuration_Par4; + double Warning_configuration_Par5; + double Warning_configuration_Par6; + double Warning_threshold; + double Controller_Spare1; + double Controller_Spare2; + double Controller_Spare3; + double Controller_Spare4; + double Controller_Spare5; + double Test_Date; + uint8_t Test[9]; + double Waste_Pump_Flow_volume_per_sec; + double Waste_Pump_Flow_V_per_sec_Limit; + double Filter_max_life_span; + double Filter_usage_hours; + uint8_t VOCInstallationDate[8]; + uint8_t FilterInstallationDate[8]; + uint8_t ProductionDate[8]; + uint32_t CheckSum; +}WHS_EEPROM_BYTES; * */ uint32_t Get_EEPROM_DATA_From_WHS(StubWhsEEpromData *Whseeprom) { uint32_t status = OK; -/* status |= I2C_EEprom_Set_for_Read_Ch(Whs_ID, 0xA0); - status |= I2C_EEprom_Read_Ch(Whs_ID, 0xA0); + + Trigger_WHS_I2C_EEprom_Read ( 0, sizeof(WHS_Eeprom.bytes), WHS_Eeprom.Buf); + Task_sleep(100); if (status == OK) { @@ -237,7 +294,9 @@ uint32_t Get_EEPROM_DATA_From_WHS(StubWhsEEpromData *Whseeprom) Whseeprom->tablelength = WHS_Eeprom.bytes.Table_Length; Whseeprom->has_tableversion = true; Whseeprom->tableversion = WHS_Eeprom.bytes.Table_version; - Whseeprom->Whsp_n = my_malloc(sizeof(WHS_Eeprom.bytes.Whs_Part_Number)); + Whseeprom->orifice1flow = WHS_Eeprom.bytes.Orifice_Waste_Level_V0_ml; + Whseeprom->has_orifice1flow = true; + /*Whseeprom->Whsp_n = my_malloc(sizeof(WHS_Eeprom.bytes.Whs_Part_Number)); if (Whseeprom->Whsp_n) memcpy(Whseeprom->Whsp_n,WHS_Eeprom.bytes.Whs_Part_Number,sizeof(WHS_Eeprom.bytes.Whs_Part_Number)); Whseeprom->pcbs_n = my_malloc(sizeof(WHS_Eeprom.bytes.PCB_SN)); @@ -300,19 +359,20 @@ uint32_t Get_EEPROM_DATA_From_WHS(StubWhsEEpromData *Whseeprom) Whseeprom->flowpass_fail = WHS_Eeprom.bytes.Flow_Status; Whseeprom->has_checksum = true; Whseeprom->checksum = WHS_Eeprom.bytes.CheckSum; - +*/ } - */ + return status; } uint32_t Prepare_WHS_DATA_For_Burning(StubWhsEEpromData *Whseeprom) { uint32_t status = OK; -/* WHS_Eeprom.bytes.Header = Whseeprom->header; + + WHS_Eeprom.bytes.Header = Whseeprom->header; WHS_Eeprom.bytes.Table_Length = Whseeprom->tablelength; WHS_Eeprom.bytes.Table_version = Whseeprom->tableversion; - WHS_Eeprom.bytes.Maximal_Pressure = Whseeprom->minimalpressure; - WHS_Eeprom.bytes.Maximal_Pressure = Whseeprom->maximalpressure; + WHS_Eeprom.bytes.Orifice_Waste_Level_V0_ml = Whseeprom->orifice1flow; +/* WHS_Eeprom.bytes.Maximal_Pressure = Whseeprom->maximalpressure; WHS_Eeprom.bytes.Minimal_MV = Whseeprom->minimalmv; WHS_Eeprom.bytes.Maximal_MV = Whseeprom->maximalmv; WHS_Eeprom.bytes.Total_Cycles = Whseeprom->totalcycles; @@ -348,6 +408,7 @@ uint32_t Prepare_WHS_DATA_For_Burning(StubWhsEEpromData *Whseeprom) status = I2C_EEprom_Write_Ch(Whs_ID, 0xA0); SysCtlDelay(5000000);//Must delay for at least 5 milli. !!! (See data sheet ) */ + Trigger_WHS_I2C_EEprom_Write ( 0, sizeof(WHS_Eeprom.bytes), WHS_Eeprom.Buf); return status; } uint32_t WhsEEpromRequestFunc(MessageContainer* requestContainer) diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 392be6177..9c924eaec 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -26,6 +26,7 @@ #include "drivers/FPGA/FPGA.h" #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" #include "drivers/I2C_Communication/Dispenser_Card/IO_Ports/Dispenser_IO.h" +#include #include "drivers/I2C_Communication/Head_Card/ADC/Head_ADC.h" #include "Common/SWUpdate/FileSystem.h" #include "drivers/Flash_ram/MCU_E2Prom.h" @@ -1213,7 +1214,7 @@ uint32_t AlarmHandlingLoop(uint32_t tick) if (AlarmState[Alarm_i].Status == false) ReportWithPackageFilter(AlarmFilter,"OverCurrent Alarm ON ", __FILE__,AlarmItem[Alarm_i].DeviceId,(int)(AlarmItem[Alarm_i].AlarmValue*100), RpMessage, (int)(doubleValue*100), 0); } - if ((doubleValue <= (float)(AlarmItem[Alarm_i].AlarmValue*CurrentAlarmLowLimit))&&(isHeaterReady(AlarmItem[Alarm_i].DeviceId)==false)) + if ((doubleValue <= (float)(AlarmItem[Alarm_i].AlarmValue*CurrentAlarmLowLimit))&&(isHeaterReady(AlarmItem[Alarm_i].DeviceId)==false)&&(doubleValue>100)) { Status = true; if (AlarmState[Alarm_i].Status == false) @@ -1234,28 +1235,43 @@ uint32_t AlarmHandlingLoop(uint32_t tick) } else { - if (Get_Head_Current(AlarmItem[Alarm_i].DeviceId, &doubleValue) == OK) - { - if (AlarmItem[Alarm_i].AlarmDirection == true) + if (Head_Type < HEAD_TYPE_UNKNOWN_WITH_CARD) //no current alarms for old head + { + Status = false; + } + else + { + if (Get_Head_Current(AlarmItem[Alarm_i].DeviceId, &doubleValue) == OK) { - if ((doubleValue >= (float)(AlarmItem[Alarm_i].AlarmValue*CurrentAlarmHighLimit)) || (doubleValue <= (float)(AlarmItem[Alarm_i].AlarmValue*CurrentAlarmLowLimit))) + if (AlarmItem[Alarm_i].AlarmDirection == true) { - Status = true; - if (AlarmState[Alarm_i].Status == false) - ReportWithPackageFilter(AlarmFilter,"OverCurrent Alarm ON ", __FILE__,AlarmItem[Alarm_i].DeviceId,(int)(AlarmItem[Alarm_i].AlarmValue*100), RpMessage, (int)(doubleValue*100), 0); + if ((doubleValue >= (float)(AlarmItem[Alarm_i].AlarmValue*CurrentAlarmHighLimit)) || (doubleValue <= (float)(AlarmItem[Alarm_i].AlarmValue*CurrentAlarmLowLimit))&&(doubleValue>100)) + { + Status = true; + if (AlarmState[Alarm_i].Status == false) + { + //usnprintf(AlarmReasonStr, 100, "OverCurrent Alarm %d ON dev %d debounce %d/%d value %d",AlarmItem[Alarm_i].EventType,AlarmItem[Alarm_i].DeviceId,AlarmState[Alarm_i].DebounceCounter,AlarmItem[Alarm_i].DebounceValue,(int)(doubleValue*100)); + //ReportWithPackageFilter(AlarmFilter,AlarmReasonStr, __FILE__,AlarmItem[Alarm_i].DeviceId,(int)(AlarmItem[Alarm_i].AlarmValue*100), RpMessage, (int)(doubleValue*100), 0); + ReportWithPackageFilter(AlarmFilter,"OverCurrent Alarm ON ", __FILE__,AlarmItem[Alarm_i].DeviceId,(int)(AlarmItem[Alarm_i].AlarmValue*100), RpMessage, (int)(doubleValue*100), 0); + } + } } - } - else - { - if (doubleValue <= 0.1) + else { - Status = true; - if (AlarmState[Alarm_i].Status == false) - ReportWithPackageFilter(AlarmFilter,"loop break Alarm ON ", __FILE__,AlarmItem[Alarm_i].DeviceId,(int)(AlarmItem[Alarm_i].AlarmValue*100), RpMessage, (int)(doubleValue*100), 0); + if (doubleValue <= 0.1) + { + Status = true; + if (AlarmState[Alarm_i].Status == false) + { + //usnprintf(AlarmReasonStr, 100, "LOOP BREAK Alarm %d ON dev %d debounce %d/%d value %d",AlarmItem[Alarm_i].EventType,AlarmItem[Alarm_i].DeviceId,AlarmState[Alarm_i].DebounceCounter,AlarmItem[Alarm_i].DebounceValue,(int)(doubleValue*100)); + //ReportWithPackageFilter(AlarmFilter,AlarmReasonStr, __FILE__,AlarmItem[Alarm_i].DeviceId,(int)(AlarmItem[Alarm_i].AlarmValue*100), RpMessage, (int)(doubleValue*100), 0); + ReportWithPackageFilter(AlarmFilter,"loop break Alarm ON ", __FILE__,AlarmItem[Alarm_i].DeviceId,(int)(AlarmItem[Alarm_i].AlarmValue*100), RpMessage, (int)(doubleValue*100), 0); + } + } } - } - } + } + } } } else diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 7758ebd8b..71475ca41 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -559,21 +559,21 @@ void DiagnosticOneMinuteCollection(void) DiagnosticsMonitor.headzone3heatercurrent = HeadCurrent[i]; i++; } - if (Get_Head_Heater_Current_Reading_State(HEAD_CURRENT_HTIN_1) == true) + if (Get_Head_Heater_Current_Reading_State(HEAD_CURRENT_ZONE_4) == true) { Get_Head_Current(HEAD_CURRENT_HTIN_1,&HeadCurrent[i][0]); - DiagnosticsMonitor.n_headzone4heatercurrent = 1; - DiagnosticsMonitor.headzone4heatercurrent = HeadCurrent[i]; + DiagnosticsMonitor.n_headcoverheater1current= 1; + DiagnosticsMonitor.headcoverheater1current = HeadCurrent[i]; i++; } - if (Get_Head_Heater_Current_Reading_State(HEAD_CURRENT_HTOT_1) == true) + if (Get_Head_Heater_Current_Reading_State(HEAD_CURRENT_ZONE_5) == true) { Get_Head_Current(HEAD_CURRENT_HTOT_1,&HeadCurrent[i][0]); - DiagnosticsMonitor.n_headzone5_6heatercurrent = 1; - DiagnosticsMonitor.headzone5_6heatercurrent = HeadCurrent[i]; + DiagnosticsMonitor.n_headcoverheater2current = 1; + DiagnosticsMonitor.headcoverheater2current = HeadCurrent[i]; i++; } - if (Get_Head_Heater_Current_Reading_State(HEAD_CURRENT_HTIN_1) == true) + /*if (Get_Head_Heater_Current_Reading_State(HEAD_CURRENT_HTIN_1) == true) { Get_Head_Current(HEAD_CURRENT_HTIN_2,&HeadCurrent[i][0]); DiagnosticsMonitor.n_headzone7heatercurrent = 1; @@ -614,7 +614,7 @@ void DiagnosticOneMinuteCollection(void) DiagnosticsMonitor.n_headzone12heatercurrent = 1; DiagnosticsMonitor.headzone12heatercurrent = HeadCurrent[i]; i++; - } + }*/ } } @@ -1347,6 +1347,8 @@ void DiagnosticsTask(UArg arg0, UArg arg1) break; case DiagnosticsOneSecTrigger: DiagnosticOneSecCollection(); + if (DiagnosticMode >= Diagnostic_Extreme_Mode) + DiagnosticOneMinuteCollection(); break; case DiagnosticsOneMinuteTrigger: DiagnosticOneMinuteCollection(); diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index 8c0bc3e73..885fc4472 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -327,7 +327,7 @@ void ProcessRequestFunc(MessageContainer* requestContainer) if (status == 0) status = HandleProcessParameters(ProcessParams,true); - if ((status)&&(status !=ERROR_CODE__GENERAL_ERROR)) + if ((status)&&(status != ERROR_CODE__GENERAL_ERROR)) //ignore init not ready result { responseContainer.has_error = true; responseContainer.error = (ErrorCode)status; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 45a0e374b..44230a4f9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -1002,17 +1002,17 @@ uint32_t DcHeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue) ReportWithPackageFilter(HeatersFilter, "Temperature Error",__FILE__,__LINE__,index,RpError, 0,0); return OK; } + if (getIdleState() == false) + { + ReportWithPackageFilter(HeatersFilter,"DC Heater Over the max temperature, turned off",__FILE__,index,HeaterPreviousRead[index],RpWarning, HeaterReady[index],0); + ReportWithPackageFilter(HeatersFilter,"Heater over the max temperature",__FILE__,index,OverHeatCounter[index],RpWarning,HeaterControl[index].sensormaxvalue, 0); + AlarmHandlingSetAlarm(HeaterEventType[index], true); + } } DeActivateHeater(index); HeaterRecalculateHeaterParams(index, 0); HeaterMaxTempFlag[index] = true; //ReportWithPackageFilter(HeatersFilter,(MinreadValue/100), "Heater Over the max temperature, turned off"); - if (getIdleState() == false) - { - ReportWithPackageFilter(HeatersFilter,"DC Heater Over the max temperature, turned off",__FILE__,index,HeaterPreviousRead[index],RpWarning, HeaterReady[index],0); - ReportWithPackageFilter(HeatersFilter,"Heater over the max temperature",__FILE__,index,OverHeatCounter[index],RpWarning,HeaterControl[index].sensormaxvalue, 0); - AlarmHandlingSetAlarm(HeaterEventType[index], true); - } return OK; } else if ((HeaterPreviousRead[index]) < (HeaterControl[index].sensorminvalue)) diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 32895f307..d504ceebd 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -282,7 +282,7 @@ JobDescriptionFileBrushStop *FirstBrushStop = NULL; SendJobProgress(0.0,0,false, "Processing file"); Control_WD(ENABLE,55); //activate heaters/dispenser watchdog, 0.5 seconds } - if ((brushCounter % 1000)==0) + if ((brushCounter % 1000)==900) { Task_sleep(200); Report("Sleep in file parsing",__FILE__, BrushStop->index, brushCounter, RpWarning, Segment->brushstopscount, 0); diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Cartridge.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Cartridge.c index 132d46fb7..7e75f31f9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Cartridge.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Cartridge.c @@ -10,9 +10,10 @@ #include "inc/hw_uart.h" #include "driverlib/gpio.h" -#include "Drivers/USB_Communication/USBCDCD.h" #include "Drivers/I2C_Communication/RFID_NFC/logi-tag/LT_RFID.h" #include "Drivers/I2C_Communication/RFID_NFC/NFC.h" +#include +#include #include "Stub_Status.h" @@ -23,36 +24,26 @@ void Stub_CartridgeReadRequest(MessageContainer* requestContainer) StubCartridgeReadRequest* request = stub_cartridge_read_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + Cartridge CartridgeRead = CARTRIDGE__INIT; + CartridgeTagContent TagRead = CARTRIDGE_TAG_CONTENT__INIT; + NFC_Tag NFC_TagRead; Init_RFID_Reader(); uint8_t readerID = request->cartridgeid; Connect_to_RFID_Reder(readerID);//2 StubCartridgeReadResponse response = STUB_CARTRIDGE_READ_RESPONSE__INIT; - response.cartridgeid = request->cartridgeid; - response.has_cartridgeid = true; + response.cartridge = &CartridgeRead; + CartridgeRead.has_index = false; + CartridgeRead.has_slot = true; + CartridgeRead.slot = request->cartridgeid; + CartridgeRead.tag = &TagRead; - response.cartridgecolor = (uid[6] << 24) | (uid[5] << 16) | (uid[4] << 8) | uid[3]; - //response.cartridgecolor - response.has_cartridgecolor = true; - - response.cartridgeversion = (uid[2] << 16) | (uid[1] << 8) | uid[0]; - //response.cartridgeversion - response.has_cartridgeversion = true; - - response.cartridgedata = RFID_Status; - //response.cartridgedata - response.has_cartridgedata = false; - - //response.cartridgeused - response.has_cartridgeused = false; - - status_response(status,&response.status, &response.statusword ,&response.has_statusword); - - - Write_status_response(status); responseContainer = createContainer(MESSAGE_TYPE__StubCartridgeReadResponse, requestContainer->token, true, &response, &stub_cartridge_read_response__pack, &stub_cartridge_read_response__get_packed_size); + responseContainer.has_error = false; + responseContainer.error = ERROR_CODE__NONE; + responseContainer.errormessage = "PASSED"; //------------------------------------------------------------------------------------------- uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); @@ -80,19 +71,19 @@ void Stub_CartridgeWriteRequest(MessageContainer* requestContainer) StubCartridgeWriteResponse response = STUB_CARTRIDGE_WRITE_RESPONSE__INIT; - response.cartridgeid = request->cartridgeid; + response.cartridgeid = request->cartridge->slot; response.has_cartridgeid = true; // char temp[7] = "PASSED"; // response.status = temp; // response.statusword = OK; // response.has_statusword = true; - status_response(status,&response.status, &response.statusword ,&response.has_statusword); - Write_status_response(status); responseContainer = createContainer(MESSAGE_TYPE__StubCartridgeWriteResponse, requestContainer->token, true, &response, &stub_cartridge_write_response__pack, &stub_cartridge_write_response__get_packed_size); - + responseContainer.has_error = false; + responseContainer.error = ERROR_CODE__NONE; + responseContainer.errormessage = "PASSED"; //------------------------------------------------------------------------------------------- uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c index 76aacb23e..f011e8a1f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c @@ -7,7 +7,7 @@ #include "drivers/Valves/Valve.h" #include "Common/report/report.h" #include "Modules/Waste/Waste.h" -#include "common/utilities/RfidTagContent.h" +#include #include #include "Modules/AlarmHandling/AlarmHandling.h" @@ -19,6 +19,7 @@ #include "Modules/IFS/ifs.h" #include #include +#include // //#define CARTRIDGE_INK_TIMEOUT 60 //#define CARTRIDGE_INK_TIMEOUTx2 120 @@ -73,7 +74,7 @@ void SetWasteLevelEmptyingLimit(double value); -RfidTagContent cartridge_info; +NFCTag_t cartridge_info; // function for RFID: bool WrRFIDStatus(cartridge_name active_cartridge, cartridge_status status); diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c b/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c index 485b28ccc..c8169ebef 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c @@ -64,6 +64,7 @@ bool newWHS_init(void) Trigger_WHS_Rheostat_init(); status |= WHS_I2C_EEprom_Read_Buf(); + Trigger_WHS_I2C_EEprom_Read ( 0, sizeof(WHS_Eeprom.bytes), WHS_Eeprom.Buf); //status |= WHS_IO_Init(); //status |= init_WHS_fan(); // diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index bece67636..2f0a5d64e 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -22,6 +22,7 @@ #include "modules/thread/thread.h" #include "modules/ids/ids.h" #include "modules/control/control.h" +#include "Modules/Control/MillisecTask.h" #include "modules/AlarmHandling/AlarmHandling.h" #include "modules/heaters/heaters_ex.h" #include "modules/Diagnostics/Diagnostics.h" diff --git a/Software/PMR/Messages/Stubs/StubWhsEEpromData.proto b/Software/PMR/Messages/Stubs/StubWhsEEpromData.proto index baaf2c8f1..661fd267d 100644 --- a/Software/PMR/Messages/Stubs/StubWhsEEpromData.proto +++ b/Software/PMR/Messages/Stubs/StubWhsEEpromData.proto @@ -5,23 +5,88 @@ option java_package = "com.twine.tango.pmr.stubs"; message StubWhsEEpromData { - uint32 Header = 1; - uint32 TableLength = 2; - uint32 Tableversion = 3; - string WhsP_N = 4; - string PCBS_N = 5; - string PCBPartNumber = 6; - string WhsS_N = 7; - double Orifice1Flow = 8; - double Orifice1Slope = 9; - double Orifice2Flow = 10; - double Orifice2Slope = 11; - double Orifice3Flow = 12; - double Orifice3Slope = 13; - double OrificeValveFlow = 14; - double OrificeValveSlope = 15; - string VOCInstallationDate = 16; - string FilterInstallationDate = 17; - string ProductionDate = 18; - uint32 CheckSum = 19; + uint32 Header = 1; + uint32 Table_Length = 2; + uint32 Table_version = 3; + string WHS_SN = 4; + string PCB_SN = 5; + string WHS_Part_Number = 6; + string PCB_Part_Number = 7; + uint32 RunningHours = 8; + uint32 SW_Reserve = 9; + string Production_Test_Date = 10; + string TestPassFail = 11; + uint32 ATS_Location = 12; + double Orifice_Waste_Level_V0_ml = 13; + double flow_calc_coefficient_C = 14; + double Orifice1Flow = 15; + double Orifice1Slope = 16; + double Orifice1MaxPressure = 17; + double Orifice1CalibrationFactor = 18; + double Orifice2Flow = 19; + double Orifice2Slope = 20; + double Orifice2MaxPressure = 21; + double Orifice2CalibrationFactor = 22; + double Orifice3Flow = 23; + double Orifice3Slope = 24; + double Orifice3MaxPressure = 25; + double Orifice3CalibrationFactor = 26; + double OrificeValveFlow = 27; + double OrificeValveSlope = 28; + double OrificeValveMaxPressure = 29; + double OrificeValveCalibrationFactor = 30; + double Fans_1_4_PWM_min_Pct = 31; + double Fans_1_4_RPM_PWM_min = 32; + double Fans_1_4_PWM_max_Pct = 33; + double Fans_1_4_RPM_PWM_max = 34; + double Fans_1_4_Nom_PWM_Pct = 35; + double Fans_1_4_Nom_RPM = 36; + double Fans_1_4_RPM_Limit_Pct_below_Nom = 37; + double Fans_1_4_Pulse_Per_Revolution = 38; + double Fans_1_4_Spare1 = 39; + double Fans_1_4_Spare2 = 40; + double Fans_5_6_Nom_RPM = 41; + double Fans_5_6_RPM_Limit_Pct_below_Nom = 42; + double Fans_5_6_Pulse_Per_Revolution = 43; + double Fans_5_6_Spare1 = 44; + double Fans_5_6_Spare2 = 45; + double Blower_P_Gain = 46; + double Blower_CFMRPM_min = 47; + double Blower_RPM_CFM_max = 48; + double Blower_Calibration_factor = 49; + double Blower_Spare1 = 50; + double Blower_Spare2 = 51; + double VOC_limit = 52; + double VOC_Spare1 = 53; + double VOC_Spare2 = 54; + double Controller_Comm_Type = 55; + double Controller_Type = 56; + double Sensor_type = 57; + double Cooler_C_F = 58; + double Cooler_SV = 59; + double Cooler_P = 60; + double Cooler_I = 61; + double Cooler_D = 62; + double Warning_configuration_Par1 = 63; + double Warning_configuration_Par2 = 64; + double Warning_configuration_Par3 = 65; + double Warning_configuration_Par4 = 66; + double Warning_configuration_Par5 = 67; + double Warning_configuration_Par6 = 68; + double Warning_threshold = 69; + double Controller_Spare1 = 70; + double Controller_Spare2 = 71; + double Controller_Spare3 = 72; + double Controller_Spare4 = 73; + double Controller_Spare5 = 74; + double Test_Date = 75; + string Test = 76; + double Waste_Pump_Flow_volume_per_sec = 77; + double Waste_Pump_Flow_V_per_sec_Limit = 78; + double Filter_max_life_span = 79; + double Filter_usage_hours = 80; + string VOCInstallationDate = 81; + string FilterInstallationDate = 82; + string ProductionDate = 83; + uint32 CheckSum = 84; } \ No newline at end of file diff --git a/Software/Stubs Collection/stubs/embeddedparametersbuild.cs b/Software/Stubs Collection/stubs/embeddedparametersbuild.cs index 2b665eeed..80509b697 100644 --- a/Software/Stubs Collection/stubs/embeddedparametersbuild.cs +++ b/Software/Stubs Collection/stubs/embeddedparametersbuild.cs @@ -31,8 +31,8 @@ configurationParameters.OverHeatCountLimit = 3; configurationParameters.UnderHeatCountLimit = 3; // time of motor activity before opening the valve or after closing the valve, in milliseconds -configurationParameters.CloseValveTimeout = 20; -configurationParameters.OpenValveTimeout = 20; +configurationParameters.CloseValveTimeout = 22; +configurationParameters.OpenValveTimeout = 22; //backlash after filling - target pressure, timoeout, time staps (speed will be added in general parameters) configurationParameters.InitialDispenserPressure = 0.25; @@ -40,7 +40,7 @@ configurationParameters.InitialDispenserTimeout = 60000; //20 seconds configurationParameters.InitialDispenserTimeLag = 100; //job prepare - build pressure in dispensers - target pressure, timoeout, time staps, speed -configurationParameters.DispenserBuildPressureSpeed = 950; //no more than 1000 +configurationParameters.DispenserBuildPressureSpeed = 960; //no more than 1000 configurationParameters.DispenserBuildPressureLimit = 1.0; configurationParameters.DispenserBuildPressureTimeout = 180000; configurationParameters.DispenserBuildPressureLag = 100; @@ -66,7 +66,7 @@ configurationParameters.StartHeatingOnInitSequence = true; // current test for the heaters - alarm thresholds configurationParameters.CurrentAlarmLowLimit = 0.78; -configurationParameters.CurrentAlarmHighLimit = 1.07; +configurationParameters.CurrentAlarmHighLimit = 1.09; //currently not in use configurationParameters.IDSSegmentRefillTimeout = 5000; @@ -95,7 +95,7 @@ configurationParameters.GeneralParameters.Add(checkHardLimitAlarms); /*2*/ Double checkCurrentAlarms = new Double(); -checkCurrentAlarms = 0.0; +checkCurrentAlarms = 1.0; configurationParameters.GeneralParameters.Add(checkCurrentAlarms); //check the tamper alarms -- cgit v1.3.1