aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-01-29 18:33:11 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-01-29 18:33:11 +0200
commit99554aaefd61f29be38669d46c7e4a573bec311f (patch)
tree16bf2b5582424c961f87f4dc543f36f2167e6d08 /Software/Embedded_SW
parent4b7e196fe51e5a93b3c8090bbb43d05e3e6fd370 (diff)
downloadTango-99554aaefd61f29be38669d46c7e4a573bec311f.tar.gz
Tango-99554aaefd61f29be38669d46c7e4a573bec311f.zip
Version 1.3.5.3: IDS handling, control track and fixing, and other changes.
Diffstat (limited to 'Software/Embedded_SW')
-rw-r--r--Software/Embedded_SW/Embedded/.cproject4
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c9
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c4
-rw-r--r--Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c2
-rw-r--r--Software/Embedded_SW/Embedded/Common/Utilities/Utils.c2
-rw-r--r--Software/Embedded_SW/Embedded/Common/report/distributor.c2
-rw-r--r--Software/Embedded_SW/Embedded/Communication/Connection.c2
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.c198
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Common/MessageType.pb-c.h6
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/EmbeddedParameters/AlarmHandlingItem.pb-c.h4
-rw-r--r--Software/Embedded_SW/Embedded/DataDef.h1
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c12
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c10
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Speed_Sensor/Speed_Sensor.c2
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c29
-rw-r--r--Software/Embedded_SW/Embedded/Main.c5
-rw-r--r--Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c11
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/control.c3
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c24
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/buttons.c1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c27
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS.h3
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c106
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h3
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c28
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c74
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Valve.c1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c15
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h3
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c3
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c12
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c24
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c15
-rw-r--r--Software/Embedded_SW/Embedded/tm4c129xnczad.cmd4
35 files changed, 433 insertions, 218 deletions
diff --git a/Software/Embedded_SW/Embedded/.cproject b/Software/Embedded_SW/Embedded/.cproject
index 727bc4584..20edaeefb 100644
--- a/Software/Embedded_SW/Embedded/.cproject
+++ b/Software/Embedded_SW/Embedded/.cproject
@@ -55,10 +55,12 @@
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.OPT_FOR_SPEED.1241946699" name="Speed vs. size trade-offs (--opt_for_speed, -mf)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.INCLUDE_PATH.757500577" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.INCLUDE_PATH" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/Common/protobuf-c&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/Communication/PMR/Diagnostics&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/Communication/PMR/Hardware&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/Communication/PMR/Printing&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/Communication/PMR/Common&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/Communication/PMR/Debugging&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/Communication/PMR&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Communication}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Common}&quot;"/>
@@ -77,7 +79,7 @@
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP.951521584" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DISPLAY_ERROR_NUMBER.673976008" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.EMBEDDED_CONSTANTS.1849154369" name="Specify whether constants can be embedded in code sections (--embedded_constants)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.EMBEDDED_CONSTANTS" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.EMBEDDED_CONSTANTS.off" valueType="enumerated"/>
- <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_SUPPRESS.255311378" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_SUPPRESS" valueType="stringList">
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_SUPPRESS.255311378" name="Suppress diagnostic &lt;id&gt; (--diag_suppress, -pds)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_SUPPRESS" valueType="stringList">
<listOptionValue builtIn="false" value="190"/>
</option>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__C_SRCS.2123688088" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__C_SRCS"/>
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
index 49f65a764..bba8a61be 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
@@ -296,7 +296,7 @@ uint32_t DeleteRequestFunc(MessageContainer* requestContainer)
DIR dir;
FILINFO* fno = 0;
- int NumOfFiles = 0;
+ //int NumOfFiles = 0;
FRESULT Fresult = FR_OK;
Fresult |= f_opendir(&dir, g_cCwdBuf);
@@ -701,9 +701,6 @@ FRESULT FileOpen(char *path, uint32_t *Size, FIL *FileHandle)
{
FRESULT Fresult = FR_OK;
FILINFO* fno = 0;
- void* buffer = NULL;
- uint32_t Bytes = 0;
- uint32_t status = 0;
fno = my_malloc(sizeof(FILINFO));
if (fno == 0)
@@ -713,9 +710,11 @@ FRESULT FileOpen(char *path, uint32_t *Size, FIL *FileHandle)
*Size = (uint32_t)fno->fsize;
if (Fresult == FR_OK)
{
- FileHandle = my_malloc(sizeof(FIL));
+ //FileHandle = my_malloc(sizeof(FIL));
if (FileHandle == 0)
Fresult = FR_DENIED;
+ else
+ Fresult = f_open(FileHandle,path,FA_READ);
}
else
{
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c
index 424c7f11f..35bde3636 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c
@@ -65,7 +65,7 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer)
break;
default:
LOG_ERROR (VersionPackage->filedescriptors[File_i]->destination,"wrong fule update Destination");
- Fresult = ERROR_CODE__FILE_REQUEST_INVALID_NAME;
+ Fresult = FR_INVALID_NAME;
break;
}
}
@@ -100,7 +100,7 @@ uint32_t ValidateVersionRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__ValidateVersionResponse, requestContainer->token, false, &response, &validate_version_response__pack, &validate_version_response__get_packed_size);
if (status!= OK)
{
- responseContainer.error = getErrorCode(status);
+ responseContainer.error = ERROR_CODE__INVALID_UPLOAD_ID;
responseContainer.errormessage = "Validate Version Request error";
}
responseContainer.continuous = false;
diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
index e32e9ebc6..44dd47623 100644
--- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
+++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
@@ -20,7 +20,7 @@ typedef struct
} TangoVersion_t;
-TangoVersion_t _gTangoVersion = {1,3,5,2};
+TangoVersion_t _gTangoVersion = {1,3,5,3};
#define BUILD_DATE __DATE__
char Dat[50] = BUILD_DATE;
char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d
diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
index cd2ae5d64..9cdb3c6bd 100644
--- a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
+++ b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
@@ -12,8 +12,6 @@
//#include <driverlib/systick.h>
#include "driverlib/hibernate.h"
-static const float speedCoef = 5.3051647697298445256294587790838f;//(200 micro steping)/2*Pi*Radius - 200 micro steping
-
//*****************************************************************************
#define MAX_MEM_LOG 100
diff --git a/Software/Embedded_SW/Embedded/Common/report/distributor.c b/Software/Embedded_SW/Embedded/Common/report/distributor.c
index 46a3affd6..0515b0472 100644
--- a/Software/Embedded_SW/Embedded/Common/report/distributor.c
+++ b/Software/Embedded_SW/Embedded/Common/report/distributor.c
@@ -240,7 +240,7 @@ Void reportService(UArg arg0, UArg arg1)
int DistTableEntry;//,msgLen, errCode, par1, par2;
ReportInitParams InitParams;
- InitParams.DistributorQueueMaxMsgs = 20;
+ InitParams.DistributorQueueMaxMsgs = 30;
InitParams.DistributorTaskPriority = 6;
InitParams.MaxNumOfFilterNames = 1;
InitParams.MaxNumberOfPrivateDistributors = 2;
diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.c b/Software/Embedded_SW/Embedded/Communication/Connection.c
index 0039fd488..1669dd6a3 100644
--- a/Software/Embedded_SW/Embedded/Communication/Connection.c
+++ b/Software/Embedded_SW/Embedded/Communication/Connection.c
@@ -145,7 +145,7 @@ void KeepAliveOneSecondCall(void)
DiagnosticsStop();
JobStopReporting();
AlarmHandlingStop();
- CommunicationMailboxFlush();
+ //CommunicationMailboxFlush();
USBCDCD_Reinit();
//UART_ResetBuffers();
}
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 4a71c882c..0218796ed 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[203] =
+static const ProtobufCEnumValue message_type__enum_values_by_number[205] =
{
{ "None", "MESSAGE_TYPE__None", 0 },
{ "ErrorResponse", "MESSAGE_TYPE__ErrorResponse", 1 },
@@ -122,6 +122,10 @@ static const ProtobufCEnumValue message_type__enum_values_by_number[203] =
{ "DirectSynchronizationResponse", "MESSAGE_TYPE__DirectSynchronizationResponse", 1006 },
{ "OverrideDataBaseRequest", "MESSAGE_TYPE__OverrideDataBaseRequest", 1007 },
{ "OverrideDataBaseResponse", "MESSAGE_TYPE__OverrideDataBaseResponse", 1008 },
+ { "StartApplicationLogsRequest", "MESSAGE_TYPE__StartApplicationLogsRequest", 1009 },
+ { "StartApplicationLogsResponse", "MESSAGE_TYPE__StartApplicationLogsResponse", 1010 },
+ { "StopApplicationLogsRequest", "MESSAGE_TYPE__StopApplicationLogsRequest", 1011 },
+ { "StopApplicationLogsResponse", "MESSAGE_TYPE__StopApplicationLogsResponse", 1012 },
{ "StartDiagnosticsRequest", "MESSAGE_TYPE__StartDiagnosticsRequest", 2000 },
{ "StartDiagnosticsResponse", "MESSAGE_TYPE__StartDiagnosticsResponse", 2001 },
{ "MotorAbortHomingRequest", "MESSAGE_TYPE__MotorAbortHomingRequest", 2002 },
@@ -172,8 +176,6 @@ static const ProtobufCEnumValue message_type__enum_values_by_number[203] =
{ "CurrentJobResponse", "MESSAGE_TYPE__CurrentJobResponse", 3007 },
{ "ResumeCurrentJobRequest", "MESSAGE_TYPE__ResumeCurrentJobRequest", 3008 },
{ "ResumeCurrentJobResponse", "MESSAGE_TYPE__ResumeCurrentJobResponse", 3009 },
- { "JobDescriptionFileSegment", "MESSAGE_TYPE__JobDescriptionFileSegment", 3010 },
- { "JobDescriptionFileBrushStop", "MESSAGE_TYPE__JobDescriptionFileBrushStop", 3011 },
{ "StartDebugLogRequest", "MESSAGE_TYPE__StartDebugLogRequest", 4000 },
{ "StartDebugLogResponse", "MESSAGE_TYPE__StartDebugLogResponse", 4001 },
{ "StopDebugLogRequest", "MESSAGE_TYPE__StopDebugLogRequest", 4002 },
@@ -214,103 +216,105 @@ static const ProtobufCEnumValue message_type__enum_values_by_number[203] =
{ "ActivateVersionResponse", "MESSAGE_TYPE__ActivateVersionResponse", 7023 },
};
static const ProtobufCIntRange message_type__value_ranges[] = {
-{0, 0},{3, 2},{1000, 104},{2000, 113},{3000, 153},{4000, 165},{5000, 169},{6000, 173},{7000, 179},{0, 203}
+{0, 0},{3, 2},{1000, 104},{2000, 117},{3000, 157},{4000, 167},{5000, 171},{6000, 175},{7000, 181},{0, 205}
};
-static const ProtobufCEnumValueIndex message_type__enum_values_by_name[203] =
+static const ProtobufCEnumValueIndex message_type__enum_values_by_name[205] =
{
- { "AbortJobRequest", 155 },
- { "AbortJobResponse", 156 },
- { "ActivateVersionRequest", 201 },
- { "ActivateVersionResponse", 202 },
+ { "AbortJobRequest", 159 },
+ { "AbortJobResponse", 160 },
+ { "ActivateVersionRequest", 203 },
+ { "ActivateVersionResponse", 204 },
{ "CalculateRequest", 2 },
{ "CalculateResponse", 3 },
- { "ConnectRequest", 175 },
- { "ConnectResponse", 176 },
- { "CreateRequest", 187 },
- { "CreateResponse", 188 },
- { "CurrentJobRequest", 159 },
- { "CurrentJobResponse", 160 },
- { "DeleteRequest", 189 },
- { "DeleteResponse", 190 },
+ { "ConnectRequest", 177 },
+ { "ConnectResponse", 178 },
+ { "CreateRequest", 189 },
+ { "CreateResponse", 190 },
+ { "CurrentJobRequest", 163 },
+ { "CurrentJobResponse", 164 },
+ { "DeleteRequest", 191 },
+ { "DeleteResponse", 192 },
{ "DirectSynchronizationRequest", 109 },
{ "DirectSynchronizationResponse", 110 },
- { "DisconnectRequest", 177 },
- { "DisconnectResponse", 178 },
- { "DispenserAbortHomingRequest", 123 },
- { "DispenserAbortHomingResponse", 124 },
- { "DispenserAbortJoggingRequest", 129 },
- { "DispenserAbortJoggingResponse", 130 },
- { "DispenserHomingRequest", 125 },
- { "DispenserHomingResponse", 126 },
- { "DispenserJoggingRequest", 127 },
- { "DispenserJoggingResponse", 128 },
+ { "DisconnectRequest", 179 },
+ { "DisconnectResponse", 180 },
+ { "DispenserAbortHomingRequest", 127 },
+ { "DispenserAbortHomingResponse", 128 },
+ { "DispenserAbortJoggingRequest", 133 },
+ { "DispenserAbortJoggingResponse", 134 },
+ { "DispenserHomingRequest", 129 },
+ { "DispenserHomingResponse", 130 },
+ { "DispenserJoggingRequest", 131 },
+ { "DispenserJoggingResponse", 132 },
{ "ErrorResponse", 1 },
- { "ExecuteProcessRequest", 183 },
- { "ExecuteProcessResponse", 184 },
+ { "ExecuteProcessRequest", 185 },
+ { "ExecuteProcessResponse", 186 },
{ "ExternalBridgeLoginRequest", 105 },
{ "ExternalBridgeLoginResponse", 106 },
{ "ExternalBridgeLogoutRequest", 107 },
{ "ExternalBridgeLogoutResponse", 108 },
{ "ExternalBridgeUdpDiscoveryPacket", 104 },
- { "FileChunkDownloadRequest", 197 },
- { "FileChunkDownloadResponse", 198 },
- { "FileChunkUploadRequest", 181 },
- { "FileChunkUploadResponse", 182 },
- { "FileDownloadRequest", 195 },
- { "FileDownloadResponse", 196 },
- { "FileUploadRequest", 179 },
- { "FileUploadResponse", 180 },
- { "GetFilesRequest", 193 },
- { "GetFilesResponse", 194 },
- { "GetStorageInfoRequest", 191 },
- { "GetStorageInfoResponse", 192 },
- { "JobDescriptionFileBrushStop", 164 },
- { "JobDescriptionFileSegment", 163 },
- { "JobRequest", 153 },
- { "JobResponse", 154 },
- { "KeepAliveRequest", 173 },
- { "KeepAliveResponse", 174 },
- { "KillProcessRequest", 185 },
- { "KillProcessResponse", 186 },
- { "MotorAbortHomingRequest", 115 },
- { "MotorAbortHomingResponse", 116 },
- { "MotorAbortJoggingRequest", 121 },
- { "MotorAbortJoggingResponse", 122 },
- { "MotorHomingRequest", 117 },
- { "MotorHomingResponse", 118 },
- { "MotorJoggingRequest", 119 },
- { "MotorJoggingResponse", 120 },
+ { "FileChunkDownloadRequest", 199 },
+ { "FileChunkDownloadResponse", 200 },
+ { "FileChunkUploadRequest", 183 },
+ { "FileChunkUploadResponse", 184 },
+ { "FileDownloadRequest", 197 },
+ { "FileDownloadResponse", 198 },
+ { "FileUploadRequest", 181 },
+ { "FileUploadResponse", 182 },
+ { "GetFilesRequest", 195 },
+ { "GetFilesResponse", 196 },
+ { "GetStorageInfoRequest", 193 },
+ { "GetStorageInfoResponse", 194 },
+ { "JobRequest", 157 },
+ { "JobResponse", 158 },
+ { "KeepAliveRequest", 175 },
+ { "KeepAliveResponse", 176 },
+ { "KillProcessRequest", 187 },
+ { "KillProcessResponse", 188 },
+ { "MotorAbortHomingRequest", 119 },
+ { "MotorAbortHomingResponse", 120 },
+ { "MotorAbortJoggingRequest", 125 },
+ { "MotorAbortJoggingResponse", 126 },
+ { "MotorHomingRequest", 121 },
+ { "MotorHomingResponse", 122 },
+ { "MotorJoggingRequest", 123 },
+ { "MotorJoggingResponse", 124 },
{ "None", 0 },
{ "OverrideDataBaseRequest", 111 },
{ "OverrideDataBaseResponse", 112 },
{ "ProgressRequest", 4 },
{ "ProgressResponse", 5 },
- { "ResolveEventRequest", 139 },
- { "ResolveEventResponse", 140 },
- { "ResumeCurrentJobRequest", 161 },
- { "ResumeCurrentJobResponse", 162 },
- { "SetBlowerStateRequest", 149 },
- { "SetBlowerStateResponse", 150 },
- { "SetComponentValueRequest", 137 },
- { "SetComponentValueResponse", 138 },
- { "SetDigitalOutRequest", 131 },
- { "SetDigitalOutResponse", 132 },
- { "SetHeaterStateRequest", 147 },
- { "SetHeaterStateResponse", 148 },
- { "SetValveStateRequest", 151 },
- { "SetValveStateResponse", 152 },
- { "StartDebugLogRequest", 165 },
- { "StartDebugLogResponse", 166 },
- { "StartDiagnosticsRequest", 113 },
- { "StartDiagnosticsResponse", 114 },
- { "StartEventsNotificationRequest", 143 },
- { "StartEventsNotificationResponse", 144 },
- { "StopDebugLogRequest", 167 },
- { "StopDebugLogResponse", 168 },
- { "StopDiagnosticsRequest", 141 },
- { "StopDiagnosticsResponse", 142 },
- { "StopEventsNotificationRequest", 145 },
- { "StopEventsNotificationResponse", 146 },
+ { "ResolveEventRequest", 143 },
+ { "ResolveEventResponse", 144 },
+ { "ResumeCurrentJobRequest", 165 },
+ { "ResumeCurrentJobResponse", 166 },
+ { "SetBlowerStateRequest", 153 },
+ { "SetBlowerStateResponse", 154 },
+ { "SetComponentValueRequest", 141 },
+ { "SetComponentValueResponse", 142 },
+ { "SetDigitalOutRequest", 135 },
+ { "SetDigitalOutResponse", 136 },
+ { "SetHeaterStateRequest", 151 },
+ { "SetHeaterStateResponse", 152 },
+ { "SetValveStateRequest", 155 },
+ { "SetValveStateResponse", 156 },
+ { "StartApplicationLogsRequest", 113 },
+ { "StartApplicationLogsResponse", 114 },
+ { "StartDebugLogRequest", 167 },
+ { "StartDebugLogResponse", 168 },
+ { "StartDiagnosticsRequest", 117 },
+ { "StartDiagnosticsResponse", 118 },
+ { "StartEventsNotificationRequest", 147 },
+ { "StartEventsNotificationResponse", 148 },
+ { "StopApplicationLogsRequest", 115 },
+ { "StopApplicationLogsResponse", 116 },
+ { "StopDebugLogRequest", 169 },
+ { "StopDebugLogResponse", 170 },
+ { "StopDiagnosticsRequest", 145 },
+ { "StopDiagnosticsResponse", 146 },
+ { "StopEventsNotificationRequest", 149 },
+ { "StopEventsNotificationResponse", 150 },
{ "StubAbortJobRequest", 100 },
{ "StubAbortJobResponse", 101 },
{ "StubCartridgeReadRequest", 6 },
@@ -409,18 +413,18 @@ static const ProtobufCEnumValueIndex message_type__enum_values_by_name[203] =
{ "StubTivaWriteRegResponse", 79 },
{ "StubValveRequest", 30 },
{ "StubValveResponse", 31 },
- { "SystemResetRequest", 171 },
- { "SystemResetResponse", 172 },
- { "ThreadAbortJoggingRequest", 135 },
- { "ThreadAbortJoggingResponse", 136 },
- { "ThreadJoggingRequest", 133 },
- { "ThreadJoggingResponse", 134 },
- { "UploadHardwareConfigurationRequest", 169 },
- { "UploadHardwareConfigurationResponse", 170 },
- { "UploadProcessParametersRequest", 157 },
- { "UploadProcessParametersResponse", 158 },
- { "ValidateVersionRequest", 199 },
- { "ValidateVersionResponse", 200 },
+ { "SystemResetRequest", 173 },
+ { "SystemResetResponse", 174 },
+ { "ThreadAbortJoggingRequest", 139 },
+ { "ThreadAbortJoggingResponse", 140 },
+ { "ThreadJoggingRequest", 137 },
+ { "ThreadJoggingResponse", 138 },
+ { "UploadHardwareConfigurationRequest", 171 },
+ { "UploadHardwareConfigurationResponse", 172 },
+ { "UploadProcessParametersRequest", 161 },
+ { "UploadProcessParametersResponse", 162 },
+ { "ValidateVersionRequest", 201 },
+ { "ValidateVersionResponse", 202 },
};
const ProtobufCEnumDescriptor message_type__descriptor =
{
@@ -429,9 +433,9 @@ const ProtobufCEnumDescriptor message_type__descriptor =
"MessageType",
"MessageType",
"",
- 203,
+ 205,
message_type__enum_values_by_number,
- 203,
+ 205,
message_type__enum_values_by_name,
9,
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 aad677235..bfbdf880d 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
@@ -133,6 +133,10 @@ typedef enum _MessageType {
MESSAGE_TYPE__DirectSynchronizationResponse = 1006,
MESSAGE_TYPE__OverrideDataBaseRequest = 1007,
MESSAGE_TYPE__OverrideDataBaseResponse = 1008,
+ MESSAGE_TYPE__StartApplicationLogsRequest = 1009,
+ MESSAGE_TYPE__StartApplicationLogsResponse = 1010,
+ MESSAGE_TYPE__StopApplicationLogsRequest = 1011,
+ MESSAGE_TYPE__StopApplicationLogsResponse = 1012,
MESSAGE_TYPE__StartDiagnosticsRequest = 2000,
MESSAGE_TYPE__StartDiagnosticsResponse = 2001,
MESSAGE_TYPE__MotorAbortHomingRequest = 2002,
@@ -183,8 +187,6 @@ typedef enum _MessageType {
MESSAGE_TYPE__CurrentJobResponse = 3007,
MESSAGE_TYPE__ResumeCurrentJobRequest = 3008,
MESSAGE_TYPE__ResumeCurrentJobResponse = 3009,
- MESSAGE_TYPE__JobDescriptionFileSegment = 3010,
- MESSAGE_TYPE__JobDescriptionFileBrushStop = 3011,
MESSAGE_TYPE__StartDebugLogRequest = 4000,
MESSAGE_TYPE__StartDebugLogResponse = 4001,
MESSAGE_TYPE__StopDebugLogRequest = 4002,
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/EmbeddedParameters/AlarmHandlingItem.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/EmbeddedParameters/AlarmHandlingItem.pb-c.h
index 1226e4429..467dc0c7d 100644
--- a/Software/Embedded_SW/Embedded/Communication/PMR/EmbeddedParameters/AlarmHandlingItem.pb-c.h
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/EmbeddedParameters/AlarmHandlingItem.pb-c.h
@@ -15,8 +15,8 @@ PROTOBUF_C__BEGIN_DECLS
#endif
#include "AlarmSourceType.pb-c.h"
-#include <debugging/DebugLogCategory.pb-c.h>
-#include <PMR/Diagnostics/EventType.pb-c.h>
+#include "DebugLogCategory.pb-c.h"
+#include "EventType.pb-c.h"
typedef struct _AlarmHandlingItem AlarmHandlingItem;
diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h
index c6d9a9e89..4c7698c1b 100644
--- a/Software/Embedded_SW/Embedded/DataDef.h
+++ b/Software/Embedded_SW/Embedded/DataDef.h
@@ -15,6 +15,7 @@
//#define DEBUG_TEST_FUNCTIONS
#define HIZ_TIMEOUT 1000
#define DEMO_TEMPERATURE
+//#define TEST_LONGER_PID_THREAD
#define MAX_STRING_LEN 255 //Embedded version + filter.c
diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c
index c04271c93..b427bf1d2 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c
+++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c
@@ -315,9 +315,9 @@ void SSILibSendEraseCommand (uint32_t ui32Base, uint32_t ui32Address, uint8_t ui
int FlashFS_Init()
{
- uint32_t ui32TotalSize;
- uint32_t ui32FileCount;
- uint32_t ui32DirCount;
+ //uint32_t ui32TotalSize;
+ //uint32_t ui32FileCount;
+ //uint32_t ui32DirCount;
FRESULT fresult = FR_OK;
//FATFS *pFatFs;
uint32_t a;
@@ -369,9 +369,9 @@ int FlashFS_Init()
return(fresult);
}
- ui32TotalSize = 0;
- ui32FileCount = 0;
- ui32DirCount = 0;
+ //ui32TotalSize = 0;
+ //ui32FileCount = 0;
+ //ui32DirCount = 0;
//
// Read an entry from the directory.
diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c
index c7235ee74..89b57ac83 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c
+++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c
@@ -46,8 +46,8 @@ uint32_t MotorVerifiedCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag);
uint32_t MotorControlId[NUM_OF_MOTORS];
uint32_t StoredMotorPosition[NUM_OF_MOTORS];
FPGA_GPI_ENUM Motor_Id_to_LS_IdDown[NUM_OF_MOTORS] = { // limit switch for normal homing into working mode
- MAX_GPI, //MOTO_DH_CLEANHEAD = 0, // closing the loading system
- MAX_GPI, //MOTO_DH_CLEANMECH = 1, //dispensers down
+ GPI_LS_DH_CLEAN_LEFT , //MOTO_DH_CLEANHEAD = 0,
+ GPI_LS_DH_CLEAN_RIGHT, //MOTO_DH_CLEANMECH = 1,
GPI_LS_DH_LID_CLOSED, //MOTO_DH_LID = 2,
MAX_GPI, //MOTO_DRYER_DRIVING = 3,
GPI_LS_DRYER_LID_CLOSED, //MOTO_DRYER_LID = 4,
@@ -73,8 +73,8 @@ FPGA_GPI_ENUM Motor_Id_to_LS_IdDown[NUM_OF_MOTORS] = { // limit switch for n
GPI_LS_RLOADMOTOR_DOWN, //MOTO_RLOADING = 24,
};
FPGA_GPI_ENUM Motor_Id_to_LS_IdUp[NUM_OF_MOTORS] = { // limit switch for normal homing out of working mode
- MAX_GPI, //MOTO_DH_CLEANHEAD = 0, // opening the loading system
- MAX_GPI, //MOTO_DH_CLEANMECH = 1, //dispensers up - empting
+ GPI_LS_DH_CLEAN_LEFT , //MOTO_DH_CLEANHEAD = 0,
+ GPI_LS_DH_CLEAN_RIGHT, //MOTO_DH_CLEANMECH = 1,
GPI_LS_DH_LID_OPEN, //MOTO_DH_LID = 2,
MAX_GPI, //MOTO_DRYER_DRIVING = 3,
GPI_LS_DRYER_LID_OPEN, //MOTO_DRYER_LID = 4,
@@ -120,7 +120,7 @@ MotorHomingDirectionEnum Motor_Id_to_LS_Direction[NUM_OF_MOTORS] = {
MotorHomingDirectionDown, //MOTO_LDANCER1 = 16,
MotorHomingDirectionDown, //MOTO_LDANCER2 = 17,
MotorHomingDirectionNoHoming, //MOTO_LDRIVING = 18,
- MotorHomingDirectionUp, //MOTO_LLOADING = 19,
+ MotorHomingDirectionDown, //MOTO_LLOADING = 19,
MotorHomingDirectionUp, //MOTO_LPIVOT1 = 20,
MotorHomingDirectionDown, //MOTO_RDANCER = 21,
MotorHomingDirectionNoHoming, //MOTO_RDRIVING = 22,
diff --git a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Speed_Sensor/Speed_Sensor.c b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Speed_Sensor/Speed_Sensor.c
index 9cea9414e..0bbe14935 100644
--- a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Speed_Sensor/Speed_Sensor.c
+++ b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Speed_Sensor/Speed_Sensor.c
@@ -85,7 +85,7 @@ float Calculate_Speed_Sensor_Velocity( void ) // Call the function every 100mSec
uint32_t pulses_per_rotation = 4096; // 12 bit
- temp = number_of_pulses * 8.3;//8.9 cm per round CHANGED TO 8.3 - Yoav
+ temp = number_of_pulses * 8.0;//8.9 cm per round CHANGED TO 8.3 - Yoav changed to 8.0 - shlomo
temp /=pulses_per_rotation;//bits for round
temp /=Prev_delta_Sec;//100mSec - sampling period
diff --git a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c
index 3430e693f..3cf9de832 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c
+++ b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c
@@ -346,7 +346,16 @@ uint32_t Valve3WayCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
Valve3WayControlId[ValveId] = 0xFF;
}
else
- Report("Remove control callback failed",__FILE__,__LINE__,(int)ValveId,RpWarning,(int)Valve3WayControlId[ValveId],0);
+ {
+ Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)Valve3WayControlId[ValveId],0);
+ if (RemoveControlCallback(GetControlLowDevice_i(),Valve3WayCallBackFunction)==OK)
+ {
+ Report("Remove control callback fixed",__FILE__,__LINE__,(int)ValveId,RpWarning,(int)Valve3WayControlId[ValveId],0);
+ Valve3WayControlId[ValveId] = 0xFF;
+ }
+ else
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)ValveId,RpWarning,(int)Valve3WayControlId[ValveId],0);
+ }
//call the module callback
if (Valve3WayModuleCallback[ValveId])
@@ -363,13 +372,15 @@ uint32_t Valve3WayCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
uint32_t Control3WayValvesWithCallback (Valves_t _ValveId, bool direction, callback_fptr callback) //direction: MidTank_Dispenser or Dispenser_Mixer
{
+ if (Valve3WayControlId[_ValveId] != 0xFF)
+ Report("Control3WayValvesWithCallback called busy ",__FILE__,__LINE__,(int)_ValveId,RpWarning,(int)Valve3WayControlId[_ValveId],0);
Valve3WayModuleCallback[_ValveId] = callback;
Valve3WayControlId[_ValveId] = AddControlCallback( Valve3WayCallBackFunction, eOneSecond/*eHundredMillisecond*/, FPGA_GetDispenserValveBusyOCD,(IfTypeDisopenser*0x100+_ValveId), _ValveId, 0 );
if (Valve3WayControlId[_ValveId] == 0xFF)
Report("Add control callback failed",__FILE__,__LINE__,(int)_ValveId,RpWarning,(int)Valve3WayControlId[_ValveId],0);
- //else
- //Report("Add control callback",__FILE__,__LINE__,(int)_ValveId,RpWarning,(int)Valve3WayControlId[_ValveId],0);
+ else
+ Report("Add control callback",__FILE__,__LINE__,(int)_ValveId,RpWarning,(int)Valve3WayControlId[_ValveId],0);
EnableDisableDispenserValve(_ValveId, ENABLE);
@@ -379,15 +390,3 @@ uint32_t Control3WayValvesWithCallback (Valves_t _ValveId, bool direction, callb
return Valve3WayControlId[_ValveId];
}
-
-void test_valve_3_way(Valves_t _ValveId, bool direction)
-{
-
- //static bool dir= 1;
-
-
- EnableDisableDispenserValve(_ValveId, ENABLE );
- SysCtlDelay(10);
- Valve_Set(_ValveId, direction);
- //dir = dir ^ 0x01;
-}
diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c
index 34a72cbe7..84d836ef8 100644
--- a/Software/Embedded_SW/Embedded/Main.c
+++ b/Software/Embedded_SW/Embedded/Main.c
@@ -93,7 +93,8 @@ uint32_t HWControlId;
uint32_t MainHWInitCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
{
RemoveControlCallback(HWControlId, MainHWInitCallBackFunction );
- //HWConfigurationInit();
+ HWConfigurationInit();
+ return OK;
}
//*****************************************************************************
//
@@ -212,7 +213,7 @@ int main(void)
IDLE_TASK_package_init();
- HWControlId = AddControlCallback( MainHWInitCallBackFunction, 10* eOneSecond/*eHundredMillisecond*/, MainDummyFunction,0,0, 0 );
+ HWControlId = AddControlCallback( MainHWInitCallBackFunction, 4* eOneSecond/*eHundredMillisecond*/, MainDummyFunction,0,0, 0 );
BIOS_start();
diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
index 475a623f0..a7ac19ba1 100644
--- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
+++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
@@ -282,10 +282,15 @@ uint32_t AlarmHandlingConsequentActions(uint32_t AlarmId, DebugLogCategory Sever
HeaterCommandRequestMessage(AlarmItem[AlarmId].ModuleDeviceId, HEATER_OFF, 0);
break;
case LimitSwitchAlarm:
- IDS_StopDispenser (AlarmItem[AlarmId].ModuleDeviceId);
- break;
case PressureAlarm:
- IDS_StopDispenser (AlarmItem[AlarmId].ModuleDeviceId);
+ if (Severity == DEBUG_LOG_CATEGORY__Info)
+ {
+ IDS_Dispenser_Alarm_Off(AlarmItem[AlarmId].ModuleDeviceId);
+ }
+ else
+ {
+ IDS_Dispenser_Alarm_On (AlarmItem[AlarmId].ModuleDeviceId);
+ }
break;
case CurrentAlarm:
break;
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c
index fc843b78b..b57c6c8b0 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/control.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c
@@ -215,7 +215,10 @@ uint32_t AddControlCallback( ControlCBFunction Callback, CTRL_TIMING_ENUM CtrlF
}
}
if (deviceId == 0xFF)
+ {
+ LOG_ERROR(deviceId, "Add Callback failed");
return 0xFF;
+ }
key = GateMutex_enter(gateControlDB);
ControlArray[deviceId].ControlTiming = CtrlFrequency;
ControlArray[deviceId].ControlCallbackPtr = Callback;
diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
index f361153f3..8797e4c9d 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
+++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
@@ -13,6 +13,7 @@
#include "AlarmHandling/AlarmHandling.h"
#include "heaters/heaters_ex.h"
#include "StateMachines/Printing/PrintingSTM.h"
+#include "Diagnostics/Diagnostics.h"
#include "heaters/heaters_ex.h"
@@ -45,17 +46,29 @@ char HwConfigPath[50] = "0://SWInfo//GenHwCfg.msg";
uint32_t HWConfigurationInit(void)
{
FRESULT Fresult = FR_OK;
- void* buffer = NULL;
- uint32_t Bytes = 0;
+ FIL *FileHandle = 0; //the system supports a single active file
+ uint8_t* buffer = NULL;
+ uint32_t Bytes = 0,i,j,k=0;
uint32_t status = OK;
Fresult = f_mkdir(SW_INFO_DIR);
if ((Fresult == FR_OK)||(Fresult == FR_EXIST))
{
-
- /* Fresult = FileRead(HwConfigPath, &Bytes, &buffer);
+ FileHandle = my_malloc(sizeof(FIL));
+ Fresult = FileOpen(HwConfigPath, &Bytes, FileHandle);
if (Fresult == FR_OK)
{
+ buffer = my_malloc (Bytes);
+ if (buffer)
+ {
+ for (i=0;i<=(Bytes/100);i++)
+ {
+ Fresult = f_read(FileHandle,&buffer[i*100],100,&j );
+ k+=j;
+ }
+ if (k!=Bytes)
+ LOG_ERROR(k,"File read error");
+ }
UploadHardwareConfigurationRequest* UploadRequest = upload_hardware_configuration_request__unpack(NULL, Bytes, buffer);
status = HWConfiguration(UploadRequest);
if (status ==OK)
@@ -64,7 +77,8 @@ uint32_t HWConfigurationInit(void)
ReadAppAndProgram(GENHWCFG_MAP_IN_FLASH, Bytes, buffer);
}
free (buffer);
- }*/
+ }
+ f_close(FileHandle);
}
EmbeddedParametersInit();
IDS_Dispenser_Content_Init();
diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c
index 075e0f009..68199d19f 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c
+++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c
@@ -174,6 +174,7 @@ uint32_t Buttons_Init(void)
load.count = 0;
AddControlCallback( ButtonLoadCBFunction, BUTTOMS_SAMPLE_TIME, ButtonLoadCallBackFunction, 0,0,0 ); //
+return OK;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
index e8bb1ac76..6fbfa5884 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
@@ -64,7 +64,7 @@ uint32_t Heaters_Init(void)
//ROM_TimerDisable(Heater_timerBase, TIMER_A);
FPGA_SensorInitConfig();
memset(HeaterControl,0,sizeof(HeaterControl));
- for (i = 0;i<=MAX_HEATERS_NUM; i++)
+ for (i = 0;i<MAX_HEATERS_NUM; i++)
DeActivateHeater(i);
return OK;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
index f3a2e6274..8adf8754e 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
@@ -7,6 +7,9 @@
//by recieved esign flow of the user from the UI
///////////////////////////////////////////////////////////////////////////////////////////
#include "include.h"
+#include <DataDef.h>
+#include "heaters.h"
+#include "Heaters_ex.h"
#include "PMR/Hardware/HardwarePidControlType.pb-c.h"
#include "PMR/Hardware/HardwarePidControl.pb-c.h"
@@ -14,23 +17,20 @@
#include "PMR/Diagnostics/HeaterType.pb-c.h"
#include "PMR/Diagnostics/HeaterState.pb-c.h"
#include "PMR/common/MessageContainer.pb-c.h"
+#include "PMR/Diagnostics/EventType.pb-c.h"
-#include "drivers/I2C_Communication/DAC/Blower.h"
-#include <PMR/Diagnostics/EventType.pb-c.h>
-#include "Modules/AlarmHandling/AlarmHandling.h"
-
+#include "../AlarmHandling/AlarmHandling.h"
#include "../control/control.h"
#include "../control/pidalgo.h"
+
#include <driverlib/timer.h>
-#include <DataDef.h>
#include <inc/hw_ints.h>
#include <inc/hw_memmap.h>
-#include "heaters.h"
#include "Drivers/Heater/Heater.h"
-#include "Heaters_ex.h"
#include "Drivers/Heater/TemperatureSensor.h"
#include "Drivers/I2C_Communication/DAC/blower.h"
+#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
#include "StateMachines/Printing/PrintingSTM.h"
@@ -79,7 +79,8 @@ uint32_t SecondDryerHeaterMaxTempControl = 0xFF;
#define DRYER_MAIN_PT100 TEMP_SENSE_ANALOG_DRYER_TEMP2
#define DRYER_SECONDARY_PT100 TEMP_SENSE_ANALOG_DRYER_TEMP3
-uint32_t HeaterId2PT100Id[MAX_HEATERS_NUM] = {DRYER_AIR_PT100,DRYER_MAIN_PT100,DRYER_SECONDARY_PT100,TEMP_SENSE_ANALOG_DYEINGH_TEMP1,TEMP_SENSE_ANALOG_DYEINGH_TEMP2,TEMP_SENSE_ANALOG_DYEINGH_TEMP3,TEMP_SENSE_ANALOG_DYEINGH_TEMP4,TEMP_SENSE_ANALOG_DYEINGH_TEMP5,TEMP_SENSE_ANALOG_MIXCHIP_TEMP,TEMP_SENSE_AN_ENCLOSURETEMP3};
+ uint32_t HeaterId2PT100Id[MAX_HEATERS_NUM] = {DRYER_AIR_PT100,DRYER_MAIN_PT100,DRYER_SECONDARY_PT100,TEMP_SENSE_ANALOG_DYEINGH_TEMP1,TEMP_SENSE_ANALOG_DYEINGH_TEMP2,TEMP_SENSE_ANALOG_DYEINGH_TEMP3,TEMP_SENSE_ANALOG_DYEINGH_TEMP4,TEMP_SENSE_ANALOG_DYEINGH_TEMP5,TEMP_SENSE_ANALOG_MIXCHIP_TEMP,TEMP_SENSE_AN_ENCLOSURETEMP3};
+//newuint32_t HeaterId2PT100Id[MAX_HEATERS_NUM] = {DRYER_AIR_PT100,DRYER_MAIN_PT100,DRYER_SECONDARY_PT100,TEMP_SENSE_ANALOG_DYEINGH_TEMP1,TEMP_SENSE_ANALOG_DYEINGH_TEMP2,TEMP_SENSE_ANALOG_DYEINGH_TEMP3,TEMP_SENSE_ANALOG_DYEINGH_TEMP4,TEMP_SENSE_ANALOG_DYEINGH_TEMP5,TEMP_SENSE_AN_ENCLOSURETEMP3,TEMP_SENSE_ANALOG_MIXCHIP_TEMP};
uint32_t DryerInternalPT100Id = DRYER_AIR_PT100;
bool HeatersRestart = false;
@@ -204,11 +205,11 @@ void LoadHeaterState(HeaterType HeaterType,HeaterState *HeaterState)
HeaterState->isrampingup = 1-HeaterReady[HeaterId];
HeaterState->has_isinsetpoint = true;
HeaterState->isinsetpoint = HeaterReady[HeaterId];
- if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature)
+ /*if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature)
{
HeaterState->setpoint = HeaterControl[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain].outputproportionalpowerlimit;
//HeaterState->isrampingup = InitialHeating;
- }
+ }*/
return;
}
uint32_t HeatersSingleHeaterEnd(HardwarePidControlType HeaterId)
@@ -619,7 +620,7 @@ uint32_t DcHeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue)
return OK;
}
HeaterMinTempFlag[index] = true;
- Report("Heater under the min temperature",__FILE__,__LINE__,index,RpWarning,HeaterPreviousRead[index], HeaterControl[index].sensormaxvalue);
+// Report("Heater under the min temperature",__FILE__,__LINE__,index,RpWarning,HeaterPreviousRead[index], HeaterControl[index].sensormaxvalue);
if (HeaterReady[index]==false)
AlarmHandlingSetAlarm(HeaterUnderEventType[index], true);
else
@@ -659,7 +660,7 @@ char ACheatstr[100];
uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
{
int index=MAX_HEATERS_NUM;
- uint8_t len = 0;
+ //uint8_t len = 0;
if (IfIndex>>8 != IfTypeHeaters)
{
LOG_ERROR (IfIndex, "Wrong Interface type");
@@ -777,7 +778,7 @@ char heatstr[100];
uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
{
int index=MAX_HEATERS_NUM;
- int len;
+ //int len;
//uint8_t len = 0;
if (IfIndex>>8 != IfTypeHeaters)
{
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h
index 840a8a1e1..d27fb7c56 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h
@@ -11,6 +11,8 @@ uint32_t DispenserConfigMessage(HardwareDispenser * request);
extern HardwareDispenser DispensersCfg[ MAX_SYSTEM_DISPENSERS];
+extern bool DispensersAlarmState[ MAX_SYSTEM_DISPENSERS];
+
extern uint32_t DispenserIdToMotorId[MAX_SYSTEM_DISPENSERS];
uint32_t IDS_Dispenser_EmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue);
@@ -29,6 +31,7 @@ void IDS_Dispenser_Set_Flow_Params (char DispenserId,double NanoLitterPerPulse,c
void IDS_Dispenser_RefillStarted (char DispenserId);
void IDS_Dispenser_RefillEnded (char DispenserId);
void IDS_Dispenser_MovingDirection (char DispenserId, bool direction);
+uint32_t IDS_Dispenser_Build_Pressure(int DispenserId, callback_fptr callback);
#endif //MODULES_IDS_IDS_H_
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c
index d4ebcbf46..8fc98a74c 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c
@@ -23,6 +23,15 @@
uint32_t CloseValveTimeout = 250;
uint32_t OpenValveTimeout = 250;
+#define DISPENSER_BUILD_PRESSURE_SPEED 500
+#define DISPENSER_BUILD_PRESSURE_LIMIT 0.5
+#define DISPENSER_BUILD_PRESSURE_TIMEOUT 8000
+#define DISPENSER_BUILD_PRESSURE_LAG 50
+
+double DispenserPreparePressure = DISPENSER_BUILD_PRESSURE_LIMIT;
+uint32_t DispenserPrepareTimeout = DISPENSER_BUILD_PRESSURE_TIMEOUT;
+uint32_t DispenserPrepareTimeLag = DISPENSER_BUILD_PRESSURE_LAG;
+uint32_t DispenserPrepareTime[MAX_SYSTEM_DISPENSERS] = {0,0,0,0,0,0,0,0};
callback_fptr DispenserCallback[MAX_SYSTEM_DISPENSERS] = {0, 0, 0, 0, 0, 0, 0, 0,};
uint32_t DispenserControlId[MAX_SYSTEM_DISPENSERS] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
@@ -37,15 +46,84 @@ uint32_t IDS_Dispenser_EmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue)
return OK;
}
+uint32_t IDS_Dispenser_Build_Pressure_Callback(uint32_t DispenserId, uint32_t ReadValue)
+ {
+ DispenserPrepareTime[DispenserId]+=DispenserPrepareTimeLag;
+
+ if ((GetDispenserPressure(DispenserId)>=DISPENSER_BUILD_PRESSURE_LIMIT)||(DispenserPrepareTime[DispenserId]>=DISPENSER_BUILD_PRESSURE_TIMEOUT))
+ {
+ if (RemoveControlCallback(DispenserControlId[DispenserId], IDS_Dispenser_Build_Pressure_Callback )==OK)
+ {
+ Report("Remove control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ DispenserControlId[DispenserId] = 0xFF;
+ }
+ else
+ {
+ Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)DispenserControlId[DispenserId],0);
+ if (RemoveControlCallback(GetControlLowDevice_i(),IDS_Dispenser_Build_Pressure_Callback)==OK)
+ {
+ Report("Remove control callback fixed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ DispenserControlId[DispenserId] = 0xFF;
+ }
+ else
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ }
+
+ TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[DispenserId];
+ MotorStop(HW_Motor_Id,Hard_Hiz);
+
+ if (DispenserCallback[DispenserId])
+ {
+ DispenserCallback[DispenserId](DispenserId,ReadValue);
+ DispenserCallback[DispenserId] = 0;
+ }
+ }
+ return OK;
+}
+
+ uint32_t IDS_Dispenser_Build_Pressure(int DispenserId, callback_fptr callback)
+{
+ DispenserCallback[DispenserId] = callback;
+ Report("Control3WayValvesWithCallback called ",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)0,0);
+
+ Control3WayValvesWithCallback ((Valves_t)DispenserId, CloseValve, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer
+ if (DispenserControlId[DispenserId] != 0xFF)
+ Report("Cannot Add control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+
+ DispenserControlId[DispenserId] = AddControlCallback( IDS_Dispenser_Build_Pressure_Callback, DispenserPrepareTimeLag,IDS_Dispenser_EmptyCBFunction ,DispenserId, DispenserId, 0 );
+ if (DispenserControlId[DispenserId] == 0xFF)
+ Report("Add control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ else
+ {
+ Report("Add control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ DispenserPrepareTime[DispenserId]=0;
+ TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[DispenserId];
+ MotorSetSpeed(HW_Motor_Id, DISPENSER_BUILD_PRESSURE_SPEED);
+ }
+
+ return OK;
+}
+
uint32_t IDS_Dispenser_StopMotorCallback(uint32_t DispenserId, uint32_t ReadValue)
{
if (RemoveControlCallback(DispenserControlId[DispenserId], IDS_Dispenser_StopMotorCallback )==OK)
{
- Report("Remove control callback",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ Report("Remove control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
DispenserControlId[DispenserId] = 0xFF;
}
else
- Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ {
+ Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)DispenserControlId[DispenserId],0);
+ if (RemoveControlCallback(GetControlLowDevice_i(),IDS_Dispenser_StopMotorCallback)==OK)
+ {
+ Report("Remove control callback fixed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ DispenserControlId[DispenserId] = 0xFF;
+ }
+ else
+ {
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ }
+ }
TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[DispenserId];
MotorStop(HW_Motor_Id,Hard_Hiz);
@@ -62,13 +140,17 @@ uint32_t IDS_Dispenser_EmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
DispenserCallback[DispenserId] = callback;
+ Report("Control3WayValvesWithCallback called ",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)0,0);
+
Control3WayValvesWithCallback ((Valves_t)DispenserId, CloseValve, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer
+ if (DispenserControlId[DispenserId] != 0xFF)
+ Report("Cannot Add control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
DispenserControlId[DispenserId] = AddControlCallback( IDS_Dispenser_StopMotorCallback, CloseValveTimeout, IDS_Dispenser_EmptyCBFunction,DispenserId, DispenserId, 0 );
if (DispenserControlId[DispenserId] == 0xFF)
Report("Add control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
else
- Report("Add control callback",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ Report("Add control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
return OK;
}
@@ -78,12 +160,22 @@ uint32_t IDS_Dispenser_OpenValveCallback(uint32_t DispenserId, uint32_t ReadValu
if (RemoveControlCallback(DispenserControlId[DispenserId], IDS_Dispenser_OpenValveCallback )==OK)
{
- Report("Remove control callback",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ Report("Remove control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
DispenserControlId[DispenserId] = 0xFF;
}
else
- Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ {
+ Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)DispenserControlId[DispenserId],0);
+ if (RemoveControlCallback(GetControlLowDevice_i(),IDS_Dispenser_OpenValveCallback)==OK)
+ {
+ Report("Remove control callback fixed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ DispenserControlId[DispenserId] = 0xFF;
+ }
+ else
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ }
+ Report("Control3WayValvesWithCallback called ",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)0,0);
Control3WayValvesWithCallback (DispenserId, OpenValve, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer
if (DispenserCallback[DispenserId])
@@ -99,12 +191,14 @@ uint32_t IDS_Dispenser_Start_Motor_and_Open_Valve(int DispenserId, int MotorSpee
TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[DispenserId];
MotorSetSpeed(HW_Motor_Id, MotorSpeed);
+ if (DispenserControlId[DispenserId] != 0xFF)
+ Report("Cannot Add control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
DispenserControlId[DispenserId] = AddControlCallback( IDS_Dispenser_OpenValveCallback, OpenValveTimeout, IDS_Dispenser_EmptyCBFunction,DispenserId, DispenserId, 0 );
if (DispenserControlId[DispenserId] == 0xFF)
Report("Add control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
else
- Report("Add control callback",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
+ Report("Add control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0);
return OK;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h
index 1596a053f..73a7f29fd 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h
@@ -44,7 +44,8 @@ uint32_t IDS_DispenserPidRequestMessage(HardwarePidControl* request);
uint32_t IDS_HomeDispenser (uint32_t deviceID, uint32_t speed , callback_fptr callback);
uint32_t IDS_StopHomeDispenser (uint32_t deviceID);
uint32_t IDS_EmptyDispenser (uint32_t deviceID, uint32_t speed , callback_fptr callback);
-uint32_t IDS_StopDispenser (uint8_t deviceID);
+uint32_t IDS_Dispenser_Alarm_On (uint8_t deviceID);
+uint32_t IDS_Dispenser_Alarm_Off (uint8_t deviceID);
uint32_t IDS_CheckDispenserLimitSwitch (LimitSwitchAlarms LS_Id);
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c
index 16c4e4e1c..3a2221f82 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c
@@ -85,11 +85,19 @@ uint32_t IDS_HomeDispenserBackMoveCallback(uint32_t deviceID, uint32_t ReadValue
Report("End backlash",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0);
if (RemoveControlCallback(DispenserHomingControlId[DispenserId], IDS_HomeDispenserBackMoveCallback )==OK)
{
- //Report("Remove control callback",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)Valve3WayControlId[DispenserId],0);
DispenserHomingControlId[DispenserId] = 0xFF;
}
else
- Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserHomingControlId[DispenserId],0);
+ {
+ Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)DispenserHomingControlId[DispenserId],0);
+ if (RemoveControlCallback(GetControlLowDevice_i(),IDS_HomeDispenserBackMoveCallback)==OK)
+ {
+ Report("Remove control callback fixed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserHomingControlId[DispenserId],0);
+ DispenserHomingControlId[DispenserId] = 0xFF;
+ }
+ else
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserHomingControlId[DispenserId],0);
+ }
DispenserHomingTime[DispenserId]=0;
}
else
@@ -128,6 +136,9 @@ uint32_t IDS_HomeDispenser (uint32_t deviceID, uint32_t speed , callback_fptr ca
{
assert(deviceID < MAX_SYSTEM_DISPENSERS);
+ if (DispensersAlarmState[deviceID] == true)
+ return ERROR;
+
if (HomingActive[deviceID] == true)
return ERROR;
else
@@ -151,9 +162,10 @@ uint32_t IDS_HomeDispenser (uint32_t deviceID, uint32_t speed , callback_fptr ca
}
return ERROR;
}
-uint32_t IDS_StopDispenser (uint8_t deviceID)
+uint32_t IDS_Dispenser_Alarm_On (uint8_t deviceID)
{
uint32_t status = OK;
+ DispensersAlarmState[deviceID] = true;
TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + deviceID;
status |= MotorAbortMovetoLimitSwitch(MotorId);
Valve_Set(IDS_Id_to_AirValve[deviceID], Atm_MidTank_OFF);
@@ -161,6 +173,12 @@ uint32_t IDS_StopDispenser (uint8_t deviceID)
status |= MotorStop(deviceID, Hard_Hiz);
return status;
}
+uint32_t IDS_Dispenser_Alarm_Off (uint8_t deviceID)
+{
+ uint32_t status = OK;
+ DispensersAlarmState[deviceID] = false;
+ return status;
+}
uint32_t IDS_StopHomeDispenser (uint32_t deviceID)
{
@@ -200,11 +218,13 @@ uint32_t IDS_EmptyDispenser (uint32_t deviceID, uint32_t speed , callback_fptr c
{
assert(deviceID < MAX_SYSTEM_DISPENSERS);
+ if (DispensersAlarmState[deviceID] == true)
+ return ERROR;
+
if (HomingActive[deviceID] == true)
return ERROR;
else
HomingActive[deviceID] = true;
-
HomingRequestCallback[deviceID] = callback;
TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + deviceID;
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
index 6b4bc10d4..3610ca909 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
@@ -42,6 +42,7 @@ bool IDS_Active = false;
/******************** STRUCTURES AND ENUMs ********************************************/
uint32_t IDS_Valve_DistanceToSpoolReady(uint32_t deviceID, uint32_t ReadValue);
uint32_t IDS_Valve_PresegmentReady(uint32_t deviceID, uint32_t ReadValue);
+bool IDS_isDispenserUsedNextSegment(void *JobDetails,int DispenserId, int SegmentId);
/******************** GLOBAL PARAMETERS ********************************************/
DispenserControlConfig_t DispenserControlConfig[MAX_SYSTEM_DISPENSERS];
uint32_t ControlIdtoDispenserId [MAX_SYSTEM_DISPENSERS] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
@@ -49,6 +50,8 @@ int OriginalDispenserSpd_2PPS[MAX_SYSTEM_DISPENSERS] = {0,0,0,0,0,0,0,0};
bool DispenserPreSegmentReady[MAX_SYSTEM_DISPENSERS] = {true,true,true,true,true,true,true,true};
bool DispenserSegmentReady[MAX_SYSTEM_DISPENSERS] = {true,true,true,true,true,true,true,true};
bool DispenserDistanceToSpoolReady[MAX_SYSTEM_DISPENSERS] = {true,true,true,true,true,true,true,true};
+bool DispenserUsedInJob[MAX_SYSTEM_DISPENSERS] = {false,false,false,false,false,false,false,false};
+bool DispensersAlarmState[ MAX_SYSTEM_DISPENSERS] = {false,false,false,false,false,false,false,false};
int JobBrushStopId = 0;
uint32_t IDS_DispenserPidRequestMessage(HardwarePidControl* request)
@@ -111,6 +114,51 @@ void DispenserPrepareReady(void)
REPORT_MSG(Module_IDS,"DispenserPrepareReady");
PrepareReady(Module_IDS,ModuleDone);
}
+//********************************************************************************************************************
+ uint32_t IDS_PrepareReady(uint32_t deviceID, uint32_t ReadValue)
+ {
+ int i;
+ if (IDS_Active == false)
+ return ERROR;
+ DispenserReady[deviceID] = true;
+ REPORT_MSG(deviceID,"Dispenser prepare ready");
+ DispenserPrepareReady();
+ return OK; // all configured heaters are ready
+ }
+ bool IDS_MapDispenserUsedinJob(void *JobDetails)
+ {
+ JobTicket* JobTicket = JobDetails;
+ int Dispenser_i, Segment_i,Brush_i,DispenserId;
+
+ for (Dispenser_i = 0;Dispenser_i<MAX_SYSTEM_DISPENSERS;Dispenser_i++)
+ {
+ DispenserUsedInJob[Dispenser_i] = false;
+ }
+ if (JobTicket->n_segments == 0)
+ return false;
+
+ for (Segment_i=0;Segment_i<JobTicket->n_segments;Segment_i++)
+ {
+ for (Brush_i=0;Brush_i<JobTicket->segments[Segment_i]->n_brushstops;Brush_i++)
+ {
+ if (JobTicket->segments[Segment_i]->brushstops[Brush_i]->n_dispensers)
+ {
+ for (Dispenser_i = 0;Dispenser_i < JobTicket->segments[Segment_i]->brushstops[Brush_i]->n_dispensers;Dispenser_i++)
+ {
+ //prepare the SW structures
+ DispenserId = JobTicket->segments[Segment_i]->brushstops[Brush_i]->dispensers[Dispenser_i]->index;
+ if (JobTicket->segments[Segment_i]->brushstops[Brush_i]->dispensers[Dispenser_i]->nanolitterpersecond>0.0)
+ {
+ DispenserUsedInJob[DispenserId] = true;
+ }
+ }//for dispenser
+ }//if dispensers
+ }//for brush
+ }//for segments
+
+ return false;
+
+ }
//********************************************************************************************************************
uint32_t IDSPrepareState(void *JobDetails)
@@ -147,9 +195,17 @@ void DispenserPrepareReady(void)
//ValveCommand (Enable,MixerDirection);
}
//set 3 dancers to the profile positions
+ IDS_MapDispenserUsedinJob(JobDetails);
for (i = 0; i < MAX_SYSTEM_DISPENSERS; i++)
{
- DispenserReady[i] = true;
+ if (DispenserUsedInJob[i] == true) //we actually should check for all dispensers
+ {
+ DispenserReady[i] = false;
+ IDS_Dispenser_Build_Pressure(i, IDS_PrepareReady);
+ REPORT_MSG(i,"Dispenser prepare called");
+ }
+ else
+ DispenserReady[i] = true;
}
DispenserPrepareReady();
return OK;
@@ -200,15 +256,16 @@ bool IDS_isDispenserUsedNextSegment(void *JobDetails,int DispenserId, int Segmen
if (IDS_Active == false)
return ERROR;
DispenserPreSegmentReady[deviceID] = true;
+ REPORT_MSG(deviceID,"IDS_Valve_Presegment Ready");
for (i=0;i<MAX_SYSTEM_DISPENSERS;i++)
{
if (DispenserPreSegmentReady[i] == false)
{
- //REPORT_MSG(i,"IDS_Valve_Presegment Not Ready");
+ REPORT_MSG(i,"IDS_Valve_Presegment Not Ready");
return OK; //not all configured heaters are ready
}
}
- //REPORT_MSG(deviceID,"IDS_Valve_PresegmentReady");
+ REPORT_MSG(deviceID,"IDS_Valve_Presegment all Ready!!");
PreSegmentReady(Module_IDS,ModuleDone);
return OK; // all configured heaters are ready
}
@@ -251,13 +308,6 @@ uint32_t IDSPreSegmentState(void *JobDetails, int SegmentId)
n_dispensers = JobTicket->segments[SegmentId]->brushstops[JobBrushStopId]->n_dispensers;
for (Dispenser_i = 0;Dispenser_i < n_dispensers;Dispenser_i++)
{
- //prepare the SW structures
- DispenserId = JobTicket->segments[SegmentId]->brushstops[JobBrushStopId]->dispensers[Dispenser_i]->index;
- DispenserPreSegmentReady[DispenserId] = false;
- //REPORT_MSG(DispenserId,"Dispenser PreSegment Start");
- }
- for (Dispenser_i = 0;Dispenser_i < n_dispensers;Dispenser_i++)
- {
DispenserId = JobTicket->segments[SegmentId]->brushstops[JobBrushStopId]->dispensers[Dispenser_i]->index;
HW_Motor_Id = DispenserIdToMotorId[DispenserId];
if (MotorsCfg[HW_Motor_Id].hardwaremotortype != DispenserIdToMotorId[DispenserId])//unconfigured dispenser
@@ -265,6 +315,8 @@ uint32_t IDSPreSegmentState(void *JobDetails, int SegmentId)
REPORT_MSG(DispenserId,"Dispenser PreSegment not configured");
continue;
}
+ DispenserPreSegmentReady[DispenserId] = false;
+ REPORT_MSG(DispenserId,"IDS_Valve_Presegment start");
IDS_Dispenser_Set_Flow_Params(DispenserId,0,0);
if (JobTicket->segments[SegmentId]->brushstops[0]->dispensers[Dispenser_i]->nanolitterpersecond==0)
{
@@ -409,7 +461,7 @@ uint32_t IDSPreSegmentState(void *JobDetails, int SegmentId)
for (Dispenser_i = 0;Dispenser_i < MAX_SYSTEM_DISPENSERS;Dispenser_i++)
{
HW_Motor_Id = DispenserIdToMotorId[Dispenser_i];
- if (MotorsCfg[HW_Motor_Id].hardwaremotortype != DispenserIdToMotorId[Dispenser_i])//unconfigured dispenser
+ if (DispenserUsedInJob[Dispenser_i]==false)//unconfigured dispenser
continue;
DispenserDistanceToSpoolReady[Dispenser_i] = false;
IDS_Dispenser_Set_Flow_Params(Dispenser_i,0,0);
diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Valve.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Valve.c
index ff29994bc..1b6ed8989 100644
--- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Valve.c
+++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Valve.c
@@ -33,7 +33,6 @@ void Stub_ValveRequest(MessageContainer* requestContainer)
request->valveon
*/
//Control3WayValvesWithCallback (request->valveid, request->valveon, NULL);
- test_valve_3_way(request->valveid, request->valveon);
//Valve_Set(request->valveid, request->valveon);
StubValveResponse response = STUB_VALVE_RESPONSE__INIT;
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
index 34395b3e6..e19431abd 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
@@ -40,6 +40,7 @@
THREAD_LOAD_INIT,
THREAD_LOAD_REDUCE_HEAT, //HEATERS OFF, DRYER BLOWER OFF, BLOWER LOW,
THREAD_LOAD_SET_LOAD_ARM_TO_START_POSITION,//USE NOTATION HOW MANY ROTATIONS IN THE DRYER, OR CHECK AGAINST STOPPER. MOVE SLOWLY
+ THREAD_LOAD_CENTER_HEAD_ROCKERS, //puthead cleaning rockers to middle position
THREAD_LOAD_OPEN_COVERS, //OPEN DYEING HEAD COVER AND DRYER LID
THREAD_LOAD_LIFT_DANCERS,
THREAD_LOAD_LIFT_ROCKERS, //MACHINE IS READY. SEND MESSAGE, START TIMER TO CLOSE LIDS, WAIT FOR OPERATOR RESPONSE
@@ -201,6 +202,14 @@
LOG_ERROR(MotorId, "Thread_Load_HomingCallback Callback is already 0");
return OK;
}
+ uint32_t Thread_Load_Center_Head_Rockers(void)
+ {
+ CallbackCounter++;
+ MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD].directionthreadwize, 200, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD], Thread_Load_HomingCallback,10000);
+ CallbackCounter++;
+ MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH].directionthreadwize, 200, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH], Thread_Load_HomingCallback,10000);
+ return OK;
+ }
uint32_t Thread_Load_Open_Covers(void)
{
//Open Dyeing Head Cover And Dryer Lid
@@ -352,6 +361,10 @@
//LoadStages++;
Thread_Load_Set_Load_Arm_To_Start_Position();
break;
+ case THREAD_LOAD_CENTER_HEAD_ROCKERS:
+ //LoadStages++;
+ Thread_Load_Center_Head_Rockers();
+ break;
case THREAD_LOAD_OPEN_COVERS: //OPEN DYEING HEAD COVER AND DRYER LID
//LoadStages++;
Thread_Load_Open_Covers();
@@ -416,7 +429,7 @@ uint32_t ThreadLoadControlCBFunction(uint32_t index, uint32_t ReadValue)
//double tempcalcspeed = 0;
uint32_t calculated_speed;
double NormalizedError;
- char Message[60];
+ //char Message[60];
DancerId = ThreadMotorIdToDancerId[index];
if (ReadValue < 10)
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
index 511a4ef93..56b229ea8 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
@@ -43,4 +43,7 @@ uint32_t Winder_Prepare(void);
uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId);
uint32_t Winder_End(void);
+void ThreadLoadPollRequest(MessageContainer* requestContainer);
+void ThreadLoadRequest(MessageContainer* requestContainer);
+
#endif
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
index f525e4a04..04a0026bd 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
@@ -85,6 +85,9 @@ uint32_t MotorPidRequestMessage(HardwarePidControl* request)
memcpy (&MotorsControl[Motor_i],request,sizeof(HardwarePidControl));
if (MotorsControl[Motor_i].pvinputfilterfactormode > MAX_CONTROL_SAMPLES)
MotorsControl[Motor_i].pvinputfilterfactormode = MAX_CONTROL_SAMPLES;
+#ifdef TEST_LONGER_PID_THREAD
+ MotorsControl[Motor_i].pvinputfilterfactormode = 10; //test longer control
+#endif
for (i = 0;i < MotorsControl[Motor_i].pvinputfilterfactormode; i++)
MotorSamples[Motor_i][i] = 0; //reset the samples value for control beginning
NormalizedErrorCoEfficient[Motor_i] = (2*PI*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].armlength);
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index c48eec522..f0cf4f733 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -305,7 +305,7 @@ uint32_t ThreadControlSpeedReadFunction(uint32_t IfIndex, uint32_t ReadValue)
}
//double eNormalizedError[100];
//int TranslatedreadValue[100];
-#define MAX_THREAD_CONTROL_LOG 100
+/*#define MAX_THREAD_CONTROL_LOG 100
double calculatedError[MAX_THREAD_CONTROL_LOG+1];
double NormError[MAX_THREAD_CONTROL_LOG+1];
double mIntegral[MAX_THREAD_CONTROL_LOG+1];
@@ -313,7 +313,7 @@ int MotorId[MAX_THREAD_CONTROL_LOG+1];
int readValue[MAX_THREAD_CONTROL_LOG+1];
int AveragereadValue[MAX_THREAD_CONTROL_LOG+1];
int calculatedspeed[MAX_THREAD_CONTROL_LOG+1];
-int timestamp[MAX_THREAD_CONTROL_LOG+1];
+int timestamp[MAX_THREAD_CONTROL_LOG+1];*/
int controlIndex = 0;
bool keepdata = true;
/*int32_t KeepReadValue = 0;
@@ -403,6 +403,10 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
MotorSamplePointer[index]++;
if (MotorSamplePointer[index] >= MotorsControl[index].pvinputfilterfactormode)
MotorSamplePointer[index] = 0;
+#ifdef TEST_LONGER_PID_THREAD
+ else // test: handle tension once in pvinputfilterfactormode milliseconds
+ return OK;
+#endif
for (i=0;i<MotorsControl[index].pvinputfilterfactormode;i++)
avreageSampleValue += MotorSamples[index][i];
avreageSampleValue = avreageSampleValue / MotorsControl[index].pvinputfilterfactormode;
@@ -475,7 +479,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*OriginalMotorSpd_2PPS[index];
if (abs(calculated_speed-CurrentControlledSpeed[index])> MotorControlConfig[index].m_ingnoreValue)
{
- if (keepdata == true)
+ /*if (keepdata == true)
{
calculatedError[controlIndex] = MotorControlConfig[index].m_calculatedError;
MotorId[controlIndex] = index;
@@ -488,7 +492,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
timestamp[controlIndex] = msec_millisecondCounter;
if (controlIndex++>=MAX_THREAD_CONTROL_LOG)
controlIndex = 0;
- }
+ }*/
CurrentControlledSpeed[index] = calculated_speed;
MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed);
}
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
index de1d26ca4..4b41900d5 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
@@ -94,11 +94,11 @@ ModuleStateEnum PrepareWaiting[MAX_SYSTEM_MODULES] = {ModuleIdle,ModuleIdle,Modu
* functions describes motor operation flow and movement state during profile execution
* used to operate in runtime correct profileflow execution
*********************************************************************************************/
-static ReturnCode IdleState(void *JobDetails);
-static ReturnCode ValidateState(void *JobDetails);
+//static ReturnCode IdleState(void *JobDetails);
+//static ReturnCode ValidateState(void *JobDetails);
static ReturnCode PrepareState(void *JobDetails);
static ReturnCode PrintState(void *JobDetails);
-static ReturnCode CleanState(void *JobDetails);
+//static ReturnCode CleanState(void *JobDetails);
static ReturnCode ExitState(void *JobDetails);
/**********************************************************************
* the array and enum of JobState_t below must be in sync order
@@ -144,21 +144,21 @@ bool JobIsActive(void)
*function describes entry point of motor in profile execution - accelerate from stop position
*function described above used to operate motor operation flow and movement state during profile execution
*********************************************************************************************************************/
-static ReturnCode IdleState(void *JobDetails)
+/*static ReturnCode IdleState(void *JobDetails)
{
ReturnCode retcode;
retcode = JobSuccess;
return retcode;
-}
+}*/
//********************************************************************************************************************
-static ReturnCode ValidateState(void *JobDetails)
+/*static ReturnCode ValidateState(void *JobDetails)
{
ReturnCode retcode;
retcode = JobSuccess;
return retcode;
-}
+}*/
//********************************************************************************************************************
bool GetHeatersPrepareWaiting(void)
{
@@ -285,13 +285,13 @@ static ReturnCode PrintState(void *JobDetails)
}
//********************************************************************************************************************
-static ReturnCode CleanState(void *JobDetails)
+/*static ReturnCode CleanState(void *JobDetails)
{
ReturnCode retcode;
retcode = JobSuccess;
return retcode;
-}
+}*/
//********************************************************************************************************************
static ReturnCode ExitState(void *JobDetails)
{
@@ -707,11 +707,9 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes
MessageContainer responseContainer;
uint8_t* container_buffer;
-//
-
- int len;
+ //int len;
//static msdid = 0;
- int length = (int)(ProcessedLength*100);
+ //int length = (int)(ProcessedLength*100);
//len = usnprintf(logmsg, 254, "MSG: Job Progress Length %d, Seg %d Done %d ",length, SegmentId, done);
//REPORT_MSG(msdid++,logmsg);
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c
index 954ec2c1b..c4fd1f639 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c
@@ -34,12 +34,10 @@
* functions describes motor operation flow and movement state during profile execution
* used to operate in runtime correct profileflow execution
*********************************************************************************************/
-static uint32_t EntryState(void *JobDetails);
-static uint32_t PrepareState(void *JobDetails);
static uint32_t PreSegmentState(void *JobDetails, int);
static uint32_t SegmentState(void *JobDetails, int);
uint32_t EndState(void *JobDetails, char *Message);
-static uint32_t ExitState(void *JobDetails);
+//static uint32_t ExitState(void *JobDetails);
/**********************************************************************
* the array and enum of PrintingState_t below must be in sync order
@@ -144,10 +142,6 @@ uint32_t PrintingHWConfiguration(void *Configuration)
*function describes entry point of motor in profile execution - accelerate from stop position
*function described above used to operate motor operation flow and movement state during profile execution
*********************************************************************************************************************/
-static uint32_t EntryState(void *JobDetails)
-{
- return OK;
-}
uint32_t PreSegmentReady(int ModuleId, ModuleStateEnum result)
{
@@ -424,10 +418,10 @@ uint32_t EndState(void *JobDetails, char *Message)
return OK;
}
//********************************************************************************************************************
-static uint32_t ExitState(void *JobDetails)
+/*static uint32_t ExitState(void *JobDetails)
{
return OK;
-}
+}*/
//********************************************************************************************************************
@@ -470,7 +464,8 @@ void PrintSTMMsgHandler(void * msg)
SegmentState(CurrentJob,SegmentId);
break;
case PreSegmentResultsFail:
- ExitState(Message->messageData);
+ EndState(CurrentJob, "PreSegment Failed");
+ //ExitState(Message->messageData);
break;
case SegmentResultsOk:
SegmentId++;
diff --git a/Software/Embedded_SW/Embedded/tm4c129xnczad.cmd b/Software/Embedded_SW/Embedded/tm4c129xnczad.cmd
index fd7aae55c..d63d890cd 100644
--- a/Software/Embedded_SW/Embedded/tm4c129xnczad.cmd
+++ b/Software/Embedded_SW/Embedded/tm4c129xnczad.cmd
@@ -34,7 +34,7 @@
/* The starting address of the application. Normally the interrupt vectors */
/* must be located at the beginning of the application. */
#define APP_BASE 0x00000000
-#define FLASH_RAM_BASE 0x000B0000
+#define FLASH_RAM_BASE 0x000D0000
#define RAM_BASE 0x20000000
/* System memory map */
@@ -44,7 +44,7 @@ MEMORY
/* Application stored in and executes from internal flash */
FLASH (RX) : origin = APP_BASE, length = 0x000B0000
/* Application stored in and executes from internal flash */
- FLASH_RAM (RWX) : origin = FLASH_RAM_BASE, length = 0x00050000
+ FLASH_RAM (RWX) : origin = FLASH_RAM_BASE, length = 0x00030000
/* Application uses internal RAM for data */
SRAM (RWX) : origin = 0x20000000, length = 0x00040000
}