aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-03-08 14:23:47 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-03-08 14:23:47 +0200
commit1af84e3da709be4690ef561e4865097d4e9332a7 (patch)
tree07511123854b0481ddc8ee912a8273aef66a8ee0 /Software/Embedded_SW
parent0bafe1c34cb056a80b64d6a03c0dcf0fc921adca (diff)
downloadTango-1af84e3da709be4690ef561e4865097d4e9332a7.tar.gz
Tango-1af84e3da709be4690ef561e4865097d4e9332a7.zip
fix error reporting in powerbuff
Diffstat (limited to 'Software/Embedded_SW')
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c38
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c6
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c4
7 files changed, 40 insertions, 14 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
index e14727f4b..6715e8e42 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
@@ -89,7 +89,10 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer)
WrittenBytes=0;
if (JobIsActive())
+ {
Fresult = FR_DENIED;
+ Report("file uplad rejected - job is running", __FILE__, __LINE__, 4, RpWarning, (int)0, 0);
+ }
else
{
UploadFileHandle = my_malloc(sizeof(FIL));
@@ -132,9 +135,10 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer)
}
}
- responseContainer = createContainer(MESSAGE_TYPE__FileUploadResponse, requestContainer->token, false, &response, &file_upload_response__pack, &file_upload_response__get_packed_size);
+ responseContainer = createContainer(MESSAGE_TYPE__FileUploadResponse, requestContainer->token, true, &response, &file_upload_response__pack, &file_upload_response__get_packed_size);
if (Fresult!= FR_OK)
{
+ responseContainer.has_error = true;
responseContainer.error = getErrorCode(Fresult);
responseContainer.errormessage = "File operation error";
}
@@ -170,9 +174,17 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
//{
//Control_WD(ENABLE,55); //activate heaters/dispenser watchdog, 0.5 seconds
//GeneralHwReady = false;
- KeepAliveOneSecondCounter = 0;
- save_milisec = msec_millisecondCounter;
- Fresult = f_write(ReceivedFileHandle,request->buffer.data,request->buffer.len,&WrittenBytes );
+ if (ReceivedFileHandle==NULL)
+ {
+ Fresult = FR_DENIED;
+ Report("file chunk uplad rejected - file not created", __FILE__, __LINE__, 4, RpWarning, (int)0, 0);
+ FileDone = true;
+ }
+ else
+ {
+ KeepAliveOneSecondCounter = 0;
+ save_milisec = msec_millisecondCounter;
+ Fresult = f_write(ReceivedFileHandle,request->buffer.data,request->buffer.len,&WrittenBytes );
lFresult = Fresult;
if(Fresult != FR_OK)
{
@@ -207,18 +219,12 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
}
}
}
- /*}
- else
- {
- LOG_ERROR (ReceivedFileHandle,"file id error");
- f_close(FileHandle);
- free (FileHandle);
- status = ERROR_CODE__FILE_NOT_FOUND;
- }*/
+ }
responseContainer = createContainer(MESSAGE_TYPE__FileChunkUploadResponse, requestContainer->token, FileDone, &response, &file_chunk_upload_response__pack, &file_chunk_upload_response__get_packed_size);
if (Fresult!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = getErrorCode(Fresult);
responseContainer.errormessage = "File operation error";
}
@@ -308,6 +314,7 @@ uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__FileDownloadResponse, requestContainer->token, false, &response, &file_download_response__pack, &file_download_response__get_packed_size);
if (Fresult!= FR_OK)
{
+ responseContainer.has_error = true;
responseContainer.error = getErrorCode(Fresult);
responseContainer.errormessage = "File operation error";
}
@@ -372,6 +379,7 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__FileChunkDownloadResponse, requestContainer->token, false, &response, &file_chunk_download_response__pack, &file_chunk_download_response__get_packed_size);
if (Fresult!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = getErrorCode(Fresult);
responseContainer.errormessage = "File operation error";
}
@@ -399,6 +407,7 @@ uint32_t ExecuteProcessRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__ExecuteProcessResponse, requestContainer->token, false, &response, &execute_process_response__pack, &execute_process_response__get_packed_size);
if (status!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = ERROR_CODE__GENERAL_ERROR;//getErrorCode(Fresult);
responseContainer.errormessage = "File operation error";
}
@@ -425,6 +434,7 @@ uint32_t KillProcessRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__KillProcessResponse, requestContainer->token, false, &response, &kill_process_response__pack, &kill_process_response__get_packed_size);
if (status!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = ERROR_CODE__GENERAL_ERROR;//getErrorCode(Fresult);
responseContainer.errormessage = "File operation error";
}
@@ -488,6 +498,7 @@ uint32_t CreateRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__CreateResponse, requestContainer->token, false, &response, &create_response__pack, &create_response__get_packed_size);
if (Fresult!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = getErrorCode(Fresult);
responseContainer.errormessage = "File operation error";
}
@@ -530,6 +541,7 @@ uint32_t DeleteRequestFunc(MessageContainer* requestContainer)
if (Fresult!= OK)
{
usnprintf(ErrorMsg, 100, "File Operation failed error code %d",Fresult);
+ responseContainer.has_error = true;
responseContainer.error = getErrorCode(Fresult);
responseContainer.errormessage = ErrorMsg;
}
@@ -576,6 +588,7 @@ uint32_t GetStorageInfoRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__GetStorageInfoResponse, requestContainer->token, false, &response, &get_storage_info_response__pack, &get_storage_info_response__get_packed_size);
if (Fresult!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = getErrorCode(Fresult);
responseContainer.errormessage = "File operation error";
}
@@ -704,6 +717,7 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer)
if (Fresult!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = getErrorCode(Fresult);
responseContainer.errormessage = "File operation error";
}
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c
index 4bbe44aea..c3c273f56 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c
@@ -196,6 +196,7 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer)
responseContainer.continuous = true;
if (Fresult!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = FileError_to_ErrorCode[Fresult];
responseContainer.errormessage = "Activate Version Request error";
responseContainer.continuous = false;
@@ -223,6 +224,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.has_error = true;
responseContainer.error = ERROR_CODE__INVALID_UPLOAD_ID;
responseContainer.errormessage = "Validate Version Request error";
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c
index 427ed5098..685542722 100644
--- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c
+++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c
@@ -173,6 +173,7 @@ uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer)
}
}
}
+ responseContainer.has_error = true;
responseContainer.error = ERROR_CODE__INVALID_PROCESS_ID;
responseContainer.errormessage = "Job Active or incorrect motor ID";
responseContainer = createContainer(MESSAGE_TYPE__MotorHomingResponse, requestContainer->token, true, &response, &motor_homing_response__pack, &motor_homing_response__get_packed_size);
diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c
index e2eb264a7..a1a0c96c1 100644
--- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c
+++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c
@@ -90,6 +90,7 @@ uint32_t MotorJoggingRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__MotorJoggingResponse, requestContainer->token, false, &response, &motor_jogging_response__pack, &motor_jogging_response__get_packed_size);
if (status!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = ERROR_CODE__INVALID_PROCESS_ID;
responseContainer.errormessage = "JOb Active or incorrect parameters";
}
@@ -191,6 +192,7 @@ uint32_t DispenserJoggingRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__DispenserJoggingResponse, requestContainer->token, false, &response, &dispenser_jogging_response__pack, &dispenser_jogging_response__get_packed_size);
if (status!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = ERROR_CODE__INVALID_PROCESS_ID;
responseContainer.errormessage = "JOb Active or incorrect parameters";
}
diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
index 6297299de..618d4569c 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
+++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
@@ -649,6 +649,7 @@ uint32_t HWConfigurationFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__UploadHardwareConfigurationResponse, requestContainer->token, true, &response, &upload_hardware_configuration_response__pack, &upload_hardware_configuration_response__get_packed_size);
if (status!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = ERROR_CODE__INVALID_PARAMETER;
responseContainer.errormessage = "JOb Active or incorrect parameters";
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
index 9b628a160..ca4255a95 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
@@ -908,6 +908,7 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue)
}
else
{
+ ReportWithPackageFilter(HeatersFilter,"restoring read Temperature Spike",__FILE__,index,HeaterPreviousRead[index],RpWarning,HeaterSpikeRead[index], index);
HeaterPreviousRead[index] = HeaterSpikeRead[index];
HeaterSpikeRead[index] = 0;
}
@@ -1088,7 +1089,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
ReportWithPackageFilter(HeatersFilter,"AC Temperature Spike",__FILE__,index,HeaterPreviousRead[index],RpWarning,readValue, index);
if (readValue > HeaterCmd[index].targettemperatue)
{
- if (HeaterSpikeRead[index] == 0)
+ /*if (HeaterSpikeRead[index] == 0)
{
HeaterSpikeRead[index] = readValue;
}
@@ -1096,7 +1097,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
{
HeaterPreviousRead[index] = HeaterSpikeRead[index];
HeaterSpikeRead[index] = 0;
- }
+ }*/
DeActivateHeater(HEATER_TYPE__DryerSecondaryHeater);
DeActivateHeater(HEATER_TYPE__DryerMainHeater);
HeaterRecalculateSharedHeatersParams(HEATER_TYPE__DryerMainHeater,0);
@@ -1302,6 +1303,7 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
}
else
{
+ ReportWithPackageFilter(HeatersFilter,"restoring read Temperature Spike",__FILE__,index,HeaterPreviousRead[index],RpWarning,HeaterSpikeRead[index], index);
HeaterPreviousRead[index] = HeaterSpikeRead[index];
HeaterSpikeRead[index] = 0;
}
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
index 92d3e05a7..e3461515c 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
@@ -536,6 +536,7 @@ void ThreadJoggingRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__ThreadJoggingResponse, requestContainer->token, true, &response, &thread_jogging_response__pack, &thread_jogging_response__get_packed_size);
if (status!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = ERROR_CODE__INVALID_PARAMETER;
responseContainer.errormessage = "JOb Active or incorrect parameters";
}
@@ -663,6 +664,7 @@ void Stub_JobRequest(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__StubJobResponse, JobToken, false, &response, &stub_job_response__pack, &stub_job_response__get_packed_size);
if (status!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = ERROR_CODE__INVALID_PROCESS_ID;
responseContainer.errormessage = "JOb Active or incorrect parameters";
}
@@ -1058,6 +1060,7 @@ uint32_t CurrentJobRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__CurrentJobResponse, requestContainer->token, false, &response, &current_job_response__pack, &current_job_response__get_packed_size);
if (status!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = ERROR_CODE__INVALID_PROCESS_ID;
responseContainer.errormessage = "JOb Active or incorrect parameters";
}
@@ -1115,6 +1118,7 @@ uint32_t ResumeCurrentJobRequestFunc(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__ResumeCurrentJobResponse, JobToken, false, &response, &resume_current_job_response__pack, &resume_current_job_response__get_packed_size);
if (status!= OK)
{
+ responseContainer.has_error = true;
responseContainer.error = ERROR_CODE__INVALID_PROCESS_ID;
responseContainer.errormessage = "JOb Active or incorrect parameters";
}