aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2020-06-07 17:02:29 +0300
committerAvi Levkovich <avi@twine-s.com>2020-06-07 17:02:29 +0300
commitaa2a2f4b7e157525bbb8ffb2dd180ef1dc8e6f62 (patch)
tree94ae906e218abfbf5e27b43b97465ee231bce7d8 /Software/Embedded_SW
parent98771e68fb9218baff79b8eb7f238bab89b31267 (diff)
parentc9e928b3fc2407b4b3008bfe2df1c15624373e5f (diff)
downloadTango-aa2a2f4b7e157525bbb8ffb2dd180ef1dc8e6f62.tar.gz
Tango-aa2a2f4b7e157525bbb8ffb2dd180ef1dc8e6f62.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW')
-rw-r--r--Software/Embedded_SW/Embedded/Communication/Container.c3
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.c14
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.h4
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubDispenserEEpromData.pb-c.c26
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubDispenserEEpromData.pb-c.h26
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubMainCardEEpromWriteResponse.pb-c.c43
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubMainCardEEpromWriteResponse.pb-c.h6
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingRequest.pb-c.c72
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingRequest.pb-c.h70
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingResponse.pb-c.c72
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingResponse.pb-c.h70
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.c8
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.h2
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h31
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c4
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c62
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h2
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c70
18 files changed, 524 insertions, 61 deletions
diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c
index 1bdc0b535..b5264cda0 100644
--- a/Software/Embedded_SW/Embedded/Communication/Container.c
+++ b/Software/Embedded_SW/Embedded/Communication/Container.c
@@ -506,6 +506,9 @@ void receive_callback(char* buffer, size_t length)
case MESSAGE_TYPE__StubMainCardEEpromWriteRequest:
MainCardEEpromWriteRequestFunc(requestContainer);
break;
+ case MESSAGE_TYPE__TryThreadLoadingRequest:
+ TryThreadLoadingFunc(requestContainer);
+ break;
default:
//unsupported message type !!
LOG_ERROR (requestContainer->type,"unsupported message type");
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.c
index 2c7d12003..75c0591b1 100644
--- a/Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.c
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.c
@@ -7,7 +7,7 @@
#endif
#include "MessageType.pb-c.h"
-static const ProtobufCEnumValue message_type__enum_values_by_number[257] =
+static const ProtobufCEnumValue message_type__enum_values_by_number[259] =
{
{ "", "", 0 },
{ "", "", 1 },
@@ -266,11 +266,13 @@ static const ProtobufCEnumValue message_type__enum_values_by_number[257] =
{ "", "", 11003 },
{ "", "", 11004 },
{ "", "", 11005 },
+ { "", "", 11006 },
+ { "", "", 11007 },
};
static const ProtobufCIntRange message_type__value_ranges[] = {
-{0, 0},{3, 2},{1000, 112},{2000, 131},{3000, 177},{4000, 191},{5000, 199},{6000, 203},{7000, 209},{8000, 233},{9000, 239},{10000, 243},{11000, 251},{0, 257}
+{0, 0},{3, 2},{1000, 112},{2000, 131},{3000, 177},{4000, 191},{5000, 199},{6000, 203},{7000, 209},{8000, 233},{9000, 239},{10000, 243},{11000, 251},{0, 259}
};
-static const ProtobufCEnumValueIndex message_type__enum_values_by_name[257] =
+static const ProtobufCEnumValueIndex message_type__enum_values_by_name[259] =
{
{ "", 189 },
{ "", 190 },
@@ -521,6 +523,8 @@ static const ProtobufCEnumValueIndex message_type__enum_values_by_name[257] =
{ "", 154 },
{ "", 151 },
{ "", 152 },
+ { "", 257 },
+ { "", 258 },
{ "", 127 },
{ "", 128 },
{ "", 199 },
@@ -537,9 +541,9 @@ const ProtobufCEnumDescriptor message_type__descriptor =
"",
"",
"",
- 257,
+ 259,
message_type__enum_values_by_number,
- 257,
+ 259,
message_type__enum_values_by_name,
13,
message_type__value_ranges,
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.h
index 3cfe8f4fb..231bc8411 100644
--- a/Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.h
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.h
@@ -276,7 +276,9 @@ typedef enum _MessageType {
MESSAGE_TYPE__ContinueThreadLoadingRequest = 11002,
MESSAGE_TYPE__ContinueThreadLoadingResponse = 11003,
MESSAGE_TYPE__StopThreadLoadingRequest = 11004,
- MESSAGE_TYPE__StopThreadLoadingResponse = 11005
+ MESSAGE_TYPE__StopThreadLoadingResponse = 11005,
+ MESSAGE_TYPE__TryThreadLoadingRequest = 11006,
+ MESSAGE_TYPE__TryThreadLoadingResponse = 11007
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(MESSAGE_TYPE)
} MessageType;
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubDispenserEEpromData.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubDispenserEEpromData.pb-c.c
index 26e3d8b31..fe523f009 100644
--- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubDispenserEEpromData.pb-c.c
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubDispenserEEpromData.pb-c.c
@@ -142,7 +142,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
8,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_minimalpressure),
offsetof(StubDispenserEEpromData, minimalpressure),
NULL,
@@ -154,7 +154,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
9,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_maximalpressure),
offsetof(StubDispenserEEpromData, maximalpressure),
NULL,
@@ -166,7 +166,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
10,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_minimalmv),
offsetof(StubDispenserEEpromData, minimalmv),
NULL,
@@ -178,7 +178,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
11,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_maximalmv),
offsetof(StubDispenserEEpromData, maximalmv),
NULL,
@@ -202,7 +202,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
13,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_bubblesize),
offsetof(StubDispenserEEpromData, bubblesize),
NULL,
@@ -214,7 +214,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
14,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_avg_nl_stepvalue_1_4),
offsetof(StubDispenserEEpromData, avg_nl_stepvalue_1_4),
NULL,
@@ -226,7 +226,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
15,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_avg_nl_stepvalue_2_4),
offsetof(StubDispenserEEpromData, avg_nl_stepvalue_2_4),
NULL,
@@ -238,7 +238,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
16,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_avg_nl_stepvalue_3_4),
offsetof(StubDispenserEEpromData, avg_nl_stepvalue_3_4),
NULL,
@@ -250,7 +250,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
17,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_avg_nl_stepvalue_4_4),
offsetof(StubDispenserEEpromData, avg_nl_stepvalue_4_4),
NULL,
@@ -262,7 +262,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
18,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_sw_reserve),
offsetof(StubDispenserEEpromData, sw_reserve),
NULL,
@@ -322,7 +322,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
23,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_pressureslope),
offsetof(StubDispenserEEpromData, pressureslope),
NULL,
@@ -358,7 +358,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
26,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_spare1),
offsetof(StubDispenserEEpromData, spare1),
NULL,
@@ -370,7 +370,7 @@ static const ProtobufCFieldDescriptor stub_dispenser_eeprom_data__field_descript
"",
27,
PROTOBUF_C_LABEL_OPTIONAL,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
offsetof(StubDispenserEEpromData, has_spare2),
offsetof(StubDispenserEEpromData, spare2),
NULL,
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubDispenserEEpromData.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubDispenserEEpromData.pb-c.h
index 8b1a70fd5..170c4028c 100644
--- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubDispenserEEpromData.pb-c.h
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubDispenserEEpromData.pb-c.h
@@ -37,27 +37,27 @@ struct _StubDispenserEEpromData
char *pcbpartnumber;
char *dispensers_n;
protobuf_c_boolean has_minimalpressure;
- uint32_t minimalpressure;
+ int32_t minimalpressure;
protobuf_c_boolean has_maximalpressure;
- uint32_t maximalpressure;
+ int32_t maximalpressure;
protobuf_c_boolean has_minimalmv;
- uint32_t minimalmv;
+ int32_t minimalmv;
protobuf_c_boolean has_maximalmv;
- uint32_t maximalmv;
+ int32_t maximalmv;
protobuf_c_boolean has_totalcycles;
uint32_t totalcycles;
protobuf_c_boolean has_bubblesize;
- uint32_t bubblesize;
+ int32_t bubblesize;
protobuf_c_boolean has_avg_nl_stepvalue_1_4;
- uint32_t avg_nl_stepvalue_1_4;
+ int32_t avg_nl_stepvalue_1_4;
protobuf_c_boolean has_avg_nl_stepvalue_2_4;
- uint32_t avg_nl_stepvalue_2_4;
+ int32_t avg_nl_stepvalue_2_4;
protobuf_c_boolean has_avg_nl_stepvalue_3_4;
- uint32_t avg_nl_stepvalue_3_4;
+ int32_t avg_nl_stepvalue_3_4;
protobuf_c_boolean has_avg_nl_stepvalue_4_4;
- uint32_t avg_nl_stepvalue_4_4;
+ int32_t avg_nl_stepvalue_4_4;
protobuf_c_boolean has_sw_reserve;
- uint32_t sw_reserve;
+ int32_t sw_reserve;
protobuf_c_boolean has_spare1_pressure;
int32_t spare1_pressure;
protobuf_c_boolean has_spare2_pressure;
@@ -67,14 +67,14 @@ struct _StubDispenserEEpromData
protobuf_c_boolean has_color;
uint32_t color;
protobuf_c_boolean has_pressureslope;
- uint32_t pressureslope;
+ int32_t pressureslope;
char *productiondate;
protobuf_c_boolean has_atslocation;
uint32_t atslocation;
protobuf_c_boolean has_spare1;
- uint32_t spare1;
+ int32_t spare1;
protobuf_c_boolean has_spare2;
- uint32_t spare2;
+ int32_t spare2;
protobuf_c_boolean has_atschannel;
uint32_t atschannel;
protobuf_c_boolean has_unitempty;
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubMainCardEEpromWriteResponse.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubMainCardEEpromWriteResponse.pb-c.c
index 4d2e53d4c..818da358a 100644
--- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubMainCardEEpromWriteResponse.pb-c.c
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubMainCardEEpromWriteResponse.pb-c.c
@@ -52,9 +52,42 @@ void stub_main_card_eeprom_write_response__free_unpacked
assert(message->base.descriptor == &stub_main_card_eeprom_write_response__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
-#define stub_main_card_eeprom_write_response__field_descriptors NULL
-#define stub_main_card_eeprom_write_response__field_indices_by_name NULL
-#define stub_main_card_eeprom_write_response__number_ranges NULL
+static const ProtobufCFieldDescriptor stub_main_card_eeprom_write_response__field_descriptors[2] =
+{
+ {
+ "",
+ 1,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_INT32,
+ offsetof(StubMainCardEEpromWriteResponse, has_address),
+ offsetof(StubMainCardEEpromWriteResponse, address),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "",
+ 2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_INT32,
+ offsetof(StubMainCardEEpromWriteResponse, has_data),
+ offsetof(StubMainCardEEpromWriteResponse, data),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned stub_main_card_eeprom_write_response__field_indices_by_name[] = {
+ 0, /* field[0] = Address */
+ 1, /* field[1] = Data */
+};
+static const ProtobufCIntRange stub_main_card_eeprom_write_response__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 2 }
+};
const ProtobufCMessageDescriptor stub_main_card_eeprom_write_response__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
@@ -63,10 +96,10 @@ const ProtobufCMessageDescriptor stub_main_card_eeprom_write_response__descripto
"",
"",
sizeof(StubMainCardEEpromWriteResponse),
- 0,
+ 2,
stub_main_card_eeprom_write_response__field_descriptors,
stub_main_card_eeprom_write_response__field_indices_by_name,
- 0, stub_main_card_eeprom_write_response__number_ranges,
+ 1, stub_main_card_eeprom_write_response__number_ranges,
(ProtobufCMessageInit) stub_main_card_eeprom_write_response__init,
NULL,NULL,NULL /* reserved[123] */
};
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubMainCardEEpromWriteResponse.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubMainCardEEpromWriteResponse.pb-c.h
index 21c64bf05..90390c99f 100644
--- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubMainCardEEpromWriteResponse.pb-c.h
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/StubMainCardEEpromWriteResponse.pb-c.h
@@ -26,10 +26,14 @@ typedef struct _StubMainCardEEpromWriteResponse StubMainCardEEpromWriteResponse;
struct _StubMainCardEEpromWriteResponse
{
ProtobufCMessage base;
+ protobuf_c_boolean has_address;
+ int32_t address;
+ protobuf_c_boolean has_data;
+ int32_t data;
};
#define STUB_MAIN_CARD_EEPROM_WRITE_RESPONSE__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&stub_main_card_eeprom_write_response__descriptor) \
- }
+ , 0, 0, 0, 0 }
/* StubMainCardEEpromWriteResponse methods */
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingRequest.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingRequest.pb-c.c
new file mode 100644
index 000000000..cd1eff033
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingRequest.pb-c.c
@@ -0,0 +1,72 @@
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+/* Generated from: TryThreadLoadingRequest.proto */
+
+/* Do not generate deprecated warnings for self */
+#ifndef PROTOBUF_C__NO_DEPRECATED
+#define PROTOBUF_C__NO_DEPRECATED
+#endif
+
+#include "TryThreadLoadingRequest.pb-c.h"
+void try_thread_loading_request__init
+ (TryThreadLoadingRequest *message)
+{
+ static const TryThreadLoadingRequest init_value = TRY_THREAD_LOADING_REQUEST__INIT;
+ *message = init_value;
+}
+size_t try_thread_loading_request__get_packed_size
+ (const TryThreadLoadingRequest *message)
+{
+ assert(message->base.descriptor == &try_thread_loading_request__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t try_thread_loading_request__pack
+ (const TryThreadLoadingRequest *message,
+ uint8_t *out)
+{
+ assert(message->base.descriptor == &try_thread_loading_request__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t try_thread_loading_request__pack_to_buffer
+ (const TryThreadLoadingRequest *message,
+ ProtobufCBuffer *buffer)
+{
+ assert(message->base.descriptor == &try_thread_loading_request__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+TryThreadLoadingRequest *
+ try_thread_loading_request__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (TryThreadLoadingRequest *)
+ protobuf_c_message_unpack (&try_thread_loading_request__descriptor,
+ allocator, len, data);
+}
+void try_thread_loading_request__free_unpacked
+ (TryThreadLoadingRequest *message,
+ ProtobufCAllocator *allocator)
+{
+ if(!message)
+ return;
+ assert(message->base.descriptor == &try_thread_loading_request__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+#define try_thread_loading_request__field_descriptors NULL
+#define try_thread_loading_request__field_indices_by_name NULL
+#define try_thread_loading_request__number_ranges NULL
+const ProtobufCMessageDescriptor try_thread_loading_request__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "",
+ "",
+ "",
+ "",
+ sizeof(TryThreadLoadingRequest),
+ 0,
+ try_thread_loading_request__field_descriptors,
+ try_thread_loading_request__field_indices_by_name,
+ 0, try_thread_loading_request__number_ranges,
+ (ProtobufCMessageInit) try_thread_loading_request__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingRequest.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingRequest.pb-c.h
new file mode 100644
index 000000000..5de127af4
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingRequest.pb-c.h
@@ -0,0 +1,70 @@
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+/* Generated from: TryThreadLoadingRequest.proto */
+
+#ifndef PROTOBUF_C_TryThreadLoadingRequest_2eproto__INCLUDED
+#define PROTOBUF_C_TryThreadLoadingRequest_2eproto__INCLUDED
+
+#include <protobuf-c/protobuf-c.h>
+
+PROTOBUF_C__BEGIN_DECLS
+
+#if PROTOBUF_C_VERSION_NUMBER < 1003000
+# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
+#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION
+# 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
+
+
+typedef struct _TryThreadLoadingRequest TryThreadLoadingRequest;
+
+
+/* --- enums --- */
+
+
+/* --- messages --- */
+
+struct _TryThreadLoadingRequest
+{
+ ProtobufCMessage base;
+};
+#define TRY_THREAD_LOADING_REQUEST__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&try_thread_loading_request__descriptor) \
+ }
+
+
+/* TryThreadLoadingRequest methods */
+void try_thread_loading_request__init
+ (TryThreadLoadingRequest *message);
+size_t try_thread_loading_request__get_packed_size
+ (const TryThreadLoadingRequest *message);
+size_t try_thread_loading_request__pack
+ (const TryThreadLoadingRequest *message,
+ uint8_t *out);
+size_t try_thread_loading_request__pack_to_buffer
+ (const TryThreadLoadingRequest *message,
+ ProtobufCBuffer *buffer);
+TryThreadLoadingRequest *
+ try_thread_loading_request__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void try_thread_loading_request__free_unpacked
+ (TryThreadLoadingRequest *message,
+ ProtobufCAllocator *allocator);
+/* --- per-message closures --- */
+
+typedef void (*TryThreadLoadingRequest_Closure)
+ (const TryThreadLoadingRequest *message,
+ void *closure_data);
+
+/* --- services --- */
+
+
+/* --- descriptors --- */
+
+extern const ProtobufCMessageDescriptor try_thread_loading_request__descriptor;
+
+PROTOBUF_C__END_DECLS
+
+
+#endif /* PROTOBUF_C_TryThreadLoadingRequest_2eproto__INCLUDED */
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingResponse.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingResponse.pb-c.c
new file mode 100644
index 000000000..b12bf1438
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingResponse.pb-c.c
@@ -0,0 +1,72 @@
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+/* Generated from: TryThreadLoadingResponse.proto */
+
+/* Do not generate deprecated warnings for self */
+#ifndef PROTOBUF_C__NO_DEPRECATED
+#define PROTOBUF_C__NO_DEPRECATED
+#endif
+
+#include "TryThreadLoadingResponse.pb-c.h"
+void try_thread_loading_response__init
+ (TryThreadLoadingResponse *message)
+{
+ static const TryThreadLoadingResponse init_value = TRY_THREAD_LOADING_RESPONSE__INIT;
+ *message = init_value;
+}
+size_t try_thread_loading_response__get_packed_size
+ (const TryThreadLoadingResponse *message)
+{
+ assert(message->base.descriptor == &try_thread_loading_response__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t try_thread_loading_response__pack
+ (const TryThreadLoadingResponse *message,
+ uint8_t *out)
+{
+ assert(message->base.descriptor == &try_thread_loading_response__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t try_thread_loading_response__pack_to_buffer
+ (const TryThreadLoadingResponse *message,
+ ProtobufCBuffer *buffer)
+{
+ assert(message->base.descriptor == &try_thread_loading_response__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+TryThreadLoadingResponse *
+ try_thread_loading_response__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (TryThreadLoadingResponse *)
+ protobuf_c_message_unpack (&try_thread_loading_response__descriptor,
+ allocator, len, data);
+}
+void try_thread_loading_response__free_unpacked
+ (TryThreadLoadingResponse *message,
+ ProtobufCAllocator *allocator)
+{
+ if(!message)
+ return;
+ assert(message->base.descriptor == &try_thread_loading_response__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+#define try_thread_loading_response__field_descriptors NULL
+#define try_thread_loading_response__field_indices_by_name NULL
+#define try_thread_loading_response__number_ranges NULL
+const ProtobufCMessageDescriptor try_thread_loading_response__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "",
+ "",
+ "",
+ "",
+ sizeof(TryThreadLoadingResponse),
+ 0,
+ try_thread_loading_response__field_descriptors,
+ try_thread_loading_response__field_indices_by_name,
+ 0, try_thread_loading_response__number_ranges,
+ (ProtobufCMessageInit) try_thread_loading_response__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingResponse.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingResponse.pb-c.h
new file mode 100644
index 000000000..7340ada7c
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/TryThreadLoadingResponse.pb-c.h
@@ -0,0 +1,70 @@
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+/* Generated from: TryThreadLoadingResponse.proto */
+
+#ifndef PROTOBUF_C_TryThreadLoadingResponse_2eproto__INCLUDED
+#define PROTOBUF_C_TryThreadLoadingResponse_2eproto__INCLUDED
+
+#include <protobuf-c/protobuf-c.h>
+
+PROTOBUF_C__BEGIN_DECLS
+
+#if PROTOBUF_C_VERSION_NUMBER < 1003000
+# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
+#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION
+# 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
+
+
+typedef struct _TryThreadLoadingResponse TryThreadLoadingResponse;
+
+
+/* --- enums --- */
+
+
+/* --- messages --- */
+
+struct _TryThreadLoadingResponse
+{
+ ProtobufCMessage base;
+};
+#define TRY_THREAD_LOADING_RESPONSE__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&try_thread_loading_response__descriptor) \
+ }
+
+
+/* TryThreadLoadingResponse methods */
+void try_thread_loading_response__init
+ (TryThreadLoadingResponse *message);
+size_t try_thread_loading_response__get_packed_size
+ (const TryThreadLoadingResponse *message);
+size_t try_thread_loading_response__pack
+ (const TryThreadLoadingResponse *message,
+ uint8_t *out);
+size_t try_thread_loading_response__pack_to_buffer
+ (const TryThreadLoadingResponse *message,
+ ProtobufCBuffer *buffer);
+TryThreadLoadingResponse *
+ try_thread_loading_response__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void try_thread_loading_response__free_unpacked
+ (TryThreadLoadingResponse *message,
+ ProtobufCAllocator *allocator);
+/* --- per-message closures --- */
+
+typedef void (*TryThreadLoadingResponse_Closure)
+ (const TryThreadLoadingResponse *message,
+ void *closure_data);
+
+/* --- services --- */
+
+
+/* --- descriptors --- */
+
+extern const ProtobufCMessageDescriptor try_thread_loading_response__descriptor;
+
+PROTOBUF_C__END_DECLS
+
+
+#endif /* PROTOBUF_C_TryThreadLoadingResponse_2eproto__INCLUDED */
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.c
index 5fd916667..ffbbf6608 100644
--- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.c
+++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.c
@@ -94,7 +94,15 @@ uint32_t I2C_EEprom_Read_Ch(uint8_t Dispenser_ID, uint8_t EEprom_Add)
return status;
}
+uint32_t Dispenser_EEPROM_Read_Data(uint8_t Dispenser_ID)//0..7
+{
+ uint32_t status= OK;
+ assert(Dispenser_ID < MAX_SYSTEM_DISPENSERS);
+ status |= I2C_EEprom_Set_for_Read_Ch(Dispenser_ID, 0xA0);
+ status |= I2C_EEprom_Read_Ch(Dispenser_ID, 0xA0);
+ return status;
+}
uint32_t test_disp_eeprom(uint8_t Dispenser_ID , uint8_t EEprom_Add)//0..7
{
uint32_t status= OK;
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.h
index 1a1af1851..bdf1b3693 100644
--- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.h
+++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.h
@@ -17,6 +17,8 @@ uint32_t I2C_EEprom_Read_Ch(uint8_t Dispenser_ID, uint8_t EEprom_Add);
uint32_t test_disp_eeprom(uint8_t Dispenser_ID , uint8_t EEprom_Add);
uint8_t Check_Dispenser_Type();
+uint32_t Dispenser_EEPROM_Read_Data(uint8_t Dispenser_ID);//0..7
+
uint32_t DispenserEEpromRequestFunc(MessageContainer* requestContainer);
uint32_t StubDispenserEEpromRequestFunc(MessageContainer* requestContainer);
diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h
index 79a56d785..355af95b4 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h
+++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h
@@ -18,6 +18,37 @@
#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
#define TimerMotors_t HardwareMotorType
+ static char* MotorStr[30] = {
+ "Dh Clean Head",
+ "Dh Clean Mech",
+ "Dh Lid ",
+ "Dryer Driving",
+ "Dryer Lid ",
+ "Dryer Loadarm",
+ "Dispenser 1",
+ "Dispenser 2",
+ "Dispenser 3",
+ "Dispenser 4",
+ "Dispenser 5",
+ "Dispenser 6",
+ "Dispenser 7",
+ "Dispenser 8",
+ "Screw ",
+ "Winder ",
+ "Left Dancer ",
+ "Middle Dancer",
+ "Left Driving ",
+ "Left Loading ",
+ "Left pivot ",
+ "Right Dancer ",
+ "Right Driving",
+ "Right Loadarm",
+ "Right Loading",
+ "Spare1 1",
+ "Spare1 2",
+ "Spare2 1",
+ "Spare2 2",
+ "Spare3 1"};
//#define NUM_OF_MOTORS (HARDWARE_MOTOR_TYPE__MOTO_RLOADING + 1) // TODO After the integration with mulbery change to:
diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
index 2cf368ebd..39d10bfc2 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
+++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
@@ -483,9 +483,7 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest)
LOG_ERROR (Dispenser_i, "Dispenser identification failed");
//return ERROR;
}
-
- status |= I2C_EEprom_Set_for_Read_Ch(Dispenser_i, 0xA0);
- status |= I2C_EEprom_Read_Ch(Dispenser_i, 0xA0);
+ status |= Dispenser_EEPROM_Read_Data(Dispenser_i);
}
Calculateinit();
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
index a91781ce4..abfdd2237 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
@@ -44,26 +44,28 @@
#include "PMR/ThreadLoading/StartThreadLoadingResponse.pb-c.h"
#include "PMR/ThreadLoading/ContinueThreadLoadingRequest.pb-c.h"
#include "PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h"
+#include "PMR/ThreadLoading/TryThreadLoadingRequest.pb-c.h"
+#include "PMR/ThreadLoading/TryThreadLoadingResponse.pb-c.h"
#include "PMR/ThreadLoading/StopThreadLoadingRequest.pb-c.h"
#include "PMR/ThreadLoading/StopThreadLoadingResponse.pb-c.h"
//#include <stdint.h>
//#include <stdbool.h>
static char* LoadStagesStr[15] = {
- /*00*/ "INIT",
- /*01*/ "REDUCE_HEAT",
- /*02*/ "LIFT_ROCKERS",
- /*03*/ "SET_LOAD_ARM",
- /*04*/ "OPEN_COVERS",
- /*05*/ "LIFT_DANCERS",
- /*06*/ "INITIAL_TENSION",
- /*07*/ "CLOSE_ROCKERS",
- /*08*/ "CLOSE_DANCERS",
- /*09*/ "CLOSE_LIDS",
- /*10*/ "JOG_FEEDER",
- /*11*/ "DRYER_LOADING",
- /*12*/ "RESUME_HEATING",
- /*13*/ "JOG_THREAD" ,
+ /*00*/ "Initialization",
+ /*01*/ "heating stop",
+ /*02*/ "Rockers opening",
+ /*03*/ "Drier unloading",
+ /*04*/ "Lids opening",
+ /*05*/ "Dancers opening",
+ /*06*/ "Initial tension building",
+ /*07*/ "Rockers closing",
+ /*08*/ "Dancers closing",
+ /*09*/ "Lids closing",
+ /*10*/ "Feeder jogging",
+ /*11*/ "Drier loading",
+ /*12*/ "Heating resuming",
+ /*13*/ "Thread jogging" ,
/*14*/ "END"};
/* typedef enum
@@ -284,7 +286,7 @@
{
TimeoutsCounter = 0;
load.color = fastBILNK;
- usnprintf(LoadErrorMsg, 100, "Load sequence timeout %s motor %d",LoadStagesStr[LoadStages], MotorId);
+ usnprintf(LoadErrorMsg, 100, "Stage %s - motor %s timeout",LoadStagesStr[LoadStages], MotorStr[MotorId]);
Report(LoadErrorMsg,__FILE__,__LINE__,LoadStages,RpWarning,TimeoutsCounter,0);
LoadStatus = ERROR;
@@ -493,7 +495,7 @@
if (HandleProcessParameters(&ProcessParametersRecover,false)!= OK)
{
- usnprintf(LoadErrorMsg, 100, "Load sequence error %d",LoadStagesStr[LoadStages]);
+ usnprintf(LoadErrorMsg, 100, "Stage %s error",LoadStagesStr[LoadStages]);
Report(LoadErrorMsg,__FILE__,__LINE__,LoadStages,RpWarning,TimeoutsCounter,0);
}
else
@@ -617,8 +619,9 @@
Report("Store Number of cycles in drier - halted",__FILE__,__LINE__,numberOfCycles,RpMessage,LoadArmRounds,0);
MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,numberOfCycles);
TimeoutsCounter = 0;
+ CallbackCounter = 0;
load.color = fastBILNK;
- usnprintf(LoadErrorMsg, 100, "Load sequence timeout %s motor %d",LoadStagesStr[LoadStages], HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM);
+ usnprintf(LoadErrorMsg, 100, "Stage %s - Drier load arm timeout",LoadStagesStr[LoadStages]);
Report(LoadErrorMsg,__FILE__,__LINE__,LoadStages,RpWarning,TimeoutsCounter,0);
LoadStatus = ERROR;
MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 200);
@@ -834,7 +837,7 @@
MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,Hard_Hiz);
MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Stop);
load.color = fastBILNK;
- usnprintf(LoadErrorMsg, 100, "Load sequence timeout %s motor %d",LoadStagesStr[LoadStages], HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM);
+ usnprintf(LoadErrorMsg, 100, "Stage %s - Drier load arm timeout",LoadStagesStr[LoadStages]);
Report(LoadErrorMsg,__FILE__,__LINE__,LoadStages,RpWarning,TimeoutsCounter,0);
Report("Drier unloading timeout(1) or no movement",__FILE__,temp,DrierPrevLocation,RpWarning,ReadValue,0);
LoadStatus = ERROR;
@@ -950,6 +953,8 @@
{
REPORT_MSG(ReadValue,"ThreadLoadStateMachine");
ThreadLoaded();
+ ThreadLoadingReport();
+
if (LoadStages!=ReadValue)
LoadStages = ReadValue;
switch (ReadValue)
@@ -1038,6 +1043,7 @@
LOG_ERROR(LoadStages,"ERROR IN LOAD STATE MACHINE");
break;
}
+
return OK;
}
uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue)
@@ -1054,6 +1060,7 @@ uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue)
}
Report("ThreadLoadButton",__FILE__,__LINE__,LoadStages,RpMessage,ReadValue,0);
Report("ThreadLoadButton params",__FILE__,LoadStatus,TryAgain,RpMessage,SecondTry,0);
+ ThreadLoadingReport();
if (LoadStatus == ERROR)
{
if ((SecondTry == false)&&(TryAgain == true))
@@ -1387,6 +1394,25 @@ uint32_t ThreadLoadingReport(void)
}
+uint32_t TryThreadLoadingFunc(MessageContainer* requestContainer)
+{
+ TryThreadLoadingRequest *request = continue_thread_loading_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
+ TryThreadLoadingResponse Cresponse = TRY_THREAD_LOADING_RESPONSE__INIT;
+ MessageContainer responseContainer;
+ MessageState = 2;
+ ThreadLoadingReport();
+ Report("TryThreadLoadingFunc",__FILE__,__LINE__,MESSAGE_TYPE__TryThreadLoadingResponse,RpWarning,(int)LoadStages,0);
+
+ responseContainer = createContainer(MESSAGE_TYPE__TryThreadLoadingResponse, requestContainer->token, true, &Cresponse, &try_thread_loading_response__pack, &try_thread_loading_response__get_packed_size);
+ responseContainer.continuous = false;
+ uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer));
+ size_t container_size = message_container__pack(&responseContainer, container_buffer);
+ my_free(responseContainer.data.data);
+ SendChars((char*)container_buffer, container_size);
+
+ ThreadLoadButton(LoadStages);
+ return OK;
+}
uint32_t StartThreadLoadingFunc(MessageContainer* requestContainer)
{
StartThreadLoadingRequest *request = start_thread_loading_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h
index b8fb8efd7..8ce835a06 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h
+++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h
@@ -29,6 +29,8 @@
MACHINE_STATE_MAX,
}MACHINE_STATE_STAGES_ENUM;
+extern char PowerUpToken[36+1];
+
uint32_t Start_InitSequence(void);
void StopInitSequence(void);
MACHINE_STATE_STAGES_ENUM GetMachineState(void);
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
index 69df1c183..27ad14ea6 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
@@ -13,8 +13,15 @@
#include "modules/heaters/heaters_ex.h"
#include "modules/Diagnostics/Diagnostics.h"
#include "Modules/General/process.h"
-#include "PMR/MachineStatus/MachineStatus.pb-c.h"
#include "Modules/General/MachineStatus.h"
+#include "Modules/General/buttons.h"
+
+#include "PMR/Power/StartPowerUpRequest.pb-c.h"
+#include "PMR/Power/AbortPowerUpRequest.pb-c.h"
+#include "PMR/Power/StartPowerUpResponse.pb-c.h"
+#include "PMR/Power/AbortPowerUpResponse.pb-c.h"
+#include "PMR/Power/PowerUpState.pb-c.h"
+#include "PMR/MachineStatus/MachineStatus.pb-c.h"
#include "StateMachines/Printing/PrintingSTM.h"
#include "StateMachines/Initialization/PowerOffSequence.h"
@@ -24,7 +31,7 @@
#include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h"
#include "drivers/Valves/Valve.h"
#include <Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.h>
-#include "Modules/General/buttons.h"
+#include "drivers/Heater/TemperatureSensor.h"
#include "heaters/heaters_ex.h"
@@ -166,9 +173,67 @@ void setIdleLimit (int Limit) {powerIdleSecondsLimit = Limit;}
void setmachineActive(bool Active){machineActive = Active;}
void resetIdleCounter (void) {powerIdleSecondsCounter = 0;}
bool getIdleState (void) {return powerIdleState;}
+uint32_t OutOfIdleUpdate(bool last)
+{
+ uint32_t status = NOT_SUPPORTED;
+
+ double calculate;
+ int result = 0;
+ MessageContainer responseContainer;
+ ErrorCode Error = ERROR_CODE__NONE;
+
+ StartPowerUpResponse response = START_POWER_UP_RESPONSE__INIT;
+
+ if (PowerUpToken[0] == 0)
+ return OK;
+/* response.has_state = true;
+ response.has_progresspercentage = true;
+
+ if (last == false)
+ {
+ response.state = POWER_UP_STATE__HeatingStarted;
+ if (dryerzone1temp < 1)
+ response.progresspercentage = 30.0;
+ else
+ {
+ calculate = (double)((MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP1)/100)/(dryerzone1temp))*70.0;
+ if (calculate > 0)
+ result = (int)calculate;
+ response.progresspercentage = 30.0 + result;
+ }
+ //Report("Heating calculation",__FILE__,(int)dryerzone1temp,(int)response.progresspercentage,RpWarning,(int)result,0);
+ response.message = "Heating up";
+ }
+ else
+ {
+ response.state = POWER_UP_STATE__MachineReadyToDye;
+ response.progresspercentage = 100.0;
+ response.message = "Ready to dye";
+ }
+ //Report("PowerUpUpdate",__FILE__,last,(int)response.progresspercentage,RpWarning,(int)stage,0);
+ Report("OutOfIdleUpdate",__FILE__,last,response.state,RpWarning,(int)response.progresspercentage,0);
+ responseContainer = createContainer(MESSAGE_TYPE__StartPowerUpResponse, PowerUpToken, last, &response, &start_power_up_response__pack, &start_power_up_response__get_packed_size);
+ responseContainer.has_continuous = true;
+ responseContainer.continuous = true;
+ if (Error != ERROR_CODE__NONE)
+ {
+ responseContainer.has_error = true;
+ responseContainer.error = Error;
+ responseContainer.errormessage = response.message;
+ }
+ uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer));
+ size_t container_size = message_container__pack(&responseContainer, container_buffer);
+ my_free(responseContainer.data.data);
+
+ SendChars((char*)container_buffer, container_size);
+ //MessageContainer responseContainer;
+*/
+ return status;
+}
uint32_t PowerIdleStartHeatingCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
{
+ OutOfIdleUpdate(false);
if (HeaterCheckReady()==true)
{
//MachineStateDetail = MACHINE_STATE_MACHINE_READY_TO_DYE;
@@ -178,6 +243,7 @@ uint32_t PowerIdleStartHeatingCallBackFunction(uint32_t IfIndex, uint32_t BusyFl
Report("Remove control callback failed",__FILE__,__LINE__,(int)IdleHeatingControlId,RpWarning,(int)PowerIdleStartHeatingCallBackFunction,0);
//InitSequenceStateMachine(InitStages);
SetMachineStatus(MACHINE_STATE__Ready);
+ OutOfIdleUpdate(true);
}
return OK;