aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Embedded_SW')
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c238
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c9
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c55
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c4
-rw-r--r--Software/Embedded_SW/Embedded/Software Release Notes.txt11
6 files changed, 199 insertions, 120 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
index 6c7ee97a4..a12c02867 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
@@ -51,8 +51,11 @@ char ErrorMsg[100];
#define MAX_CHUNK_LENGTH 2000
int FileLength = 0;
int FileReceivedLength = 0;
+int FileSentLength = 0;
static char g_cCwdBuf[50] = "/";
uint32_t WrittenBytes = 0;
+uint32_t ReadBytes = 0;
+
ErrorCode getErrorCode(FRESULT Fresult)
{
@@ -116,7 +119,6 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer)
return OK;
}
-
uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
{
//uint32_t status = OK;
@@ -186,6 +188,124 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
return OK;
}
+uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer)
+{
+ //uint32_t status = OK;
+
+ FRESULT Fresult = FR_OK;
+ FILINFO* fno;
+
+ MessageContainer responseContainer;
+
+ FileDownloadRequest* request = file_download_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
+
+ FileDownloadResponse response = FILE_DOWNLOAD_RESPONSE__INIT;
+
+ ReadBytes=0;
+ FileSentLength = 0;
+
+ fno = my_malloc(sizeof(FILINFO));
+ if (fno == 0)
+ Fresult = FR_DENIED;
+ else
+ {
+ memset (fno,0,sizeof(FILINFO));
+ Fresult = f_stat(request->filename,fno);
+ FileLength = fno->fsize;
+ DownloadFileHandle = my_malloc(sizeof(FIL));
+ if (DownloadFileHandle == 0)
+ Fresult = FR_DENIED;
+ else
+ {
+ Fresult = f_open(DownloadFileHandle,request->filename,FA_READ );
+ if (Fresult == FR_OK)
+ {
+ response.has_maxchunklength = true;
+ response.maxchunklength = MAX_CHUNK_LENGTH;
+ strcpy(FileHandleChar, "1234");
+ response.downloadid = FileHandleChar; //supporting only single file at each time.
+ }
+
+ }
+ }
+
+
+ responseContainer = createContainer(MESSAGE_TYPE__FileDownloadResponse, requestContainer->token, false, &response, &file_download_response__pack, &file_download_response__get_packed_size);
+ if (Fresult!= FR_OK)
+ {
+ responseContainer.error = getErrorCode(Fresult);
+ responseContainer.errormessage = "File operation error";
+ }
+ 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);
+ file_download_request__free_unpacked(request,NULL);
+ SendChars(container_buffer, container_size);
+ my_free(fno);
+
+ return OK;
+}
+uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer)
+{
+ MessageContainer responseContainer;
+ FileChunkDownloadRequest* request = file_chunk_download_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
+ FileChunkDownloadResponse response = FILE_CHUNK_DOWNLOAD_RESPONSE__INIT;
+ FRESULT Fresult = FR_OK;
+ FIL *SentFileHandle; //the system supports a single active file
+
+ SentFileHandle = DownloadFileHandle;
+ char *Buffer = 0;
+ Buffer = my_malloc (MAX_CHUNK_LENGTH);
+ if (Buffer != NULL)
+ {
+ Fresult = f_read(SentFileHandle,Buffer,2000,&ReadBytes );
+ if(Fresult != FR_OK)
+ {
+ LOG_ERROR (Fresult,"f_write error");
+ }
+ else
+ {
+ response.has_buffer = true;
+ response.buffer.len = ReadBytes;
+ response.buffer.data = Buffer;
+ FileSentLength += ReadBytes;
+ if (FileSentLength == FileLength)
+ {
+ REPORT_MSG (FileSentLength,"file download ended successfully");
+ f_close(SentFileHandle);
+ free (DownloadFileHandle);
+ FileSentLength = 0;
+ }
+ else
+ {
+ if (FileSentLength > FileLength)
+ {
+ REPORT_MSG (FileSentLength,"file download too much data!");
+ f_close(SentFileHandle);
+ free (DownloadFileHandle);
+ FileSentLength = 0;
+ }
+ }
+ }
+ }
+
+ 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.error = getErrorCode(Fresult);
+ responseContainer.errormessage = "File operation error";
+ }
+ 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);
+ file_chunk_download_request__free_unpacked(request,NULL);
+ my_free(responseContainer.data.data);
+ my_free(Buffer);
+ SendChars(container_buffer, container_size);
+
+ return OK;
+}
uint32_t ExecuteProcessRequestFunc(MessageContainer* requestContainer)
{
uint32_t status = OK;
@@ -517,122 +637,6 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer)
}
return Fresult;
}
-uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer)
-{
- //uint32_t status = OK;
-
- FRESULT Fresult = FR_OK;
- FILINFO* fno;
-
- MessageContainer responseContainer;
-
- FileDownloadRequest* request = file_download_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
-
- FileDownloadResponse response = FILE_DOWNLOAD_RESPONSE__INIT;
-
- WrittenBytes=0;
- FileReceivedLength = 0;
-
- fno = my_malloc(sizeof(FILINFO));
- if (fno == 0)
- Fresult = FR_DENIED;
- else
- {
- memset (fno,0,sizeof(FILINFO));
- Fresult = f_stat(request->filename,fno);
- FileLength = fno->fsize;
- DownloadFileHandle = my_malloc(sizeof(FIL));
- if (DownloadFileHandle == 0)
- Fresult = FR_DENIED;
- else
- {
- Fresult = f_open(DownloadFileHandle,request->filename,FA_READ );
- if (Fresult == FR_OK)
- {
- response.has_maxchunklength = true;
- response.maxchunklength = MAX_CHUNK_LENGTH;
- strcpy(FileHandleChar, "1234");
- response.downloadid = FileHandleChar; //supporting only single file at each time.
- }
-
- }
- }
-
-
- responseContainer = createContainer(MESSAGE_TYPE__FileDownloadResponse, requestContainer->token, false, &response, &file_download_response__pack, &file_download_response__get_packed_size);
- if (Fresult!= FR_OK)
- {
- responseContainer.error = getErrorCode(Fresult);
- responseContainer.errormessage = "File operation error";
- }
- 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);
- file_download_request__free_unpacked(request,NULL);
- SendChars(container_buffer, container_size);
-
- return OK;
-}
-uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer)
-{
- MessageContainer responseContainer;
- FileChunkDownloadRequest* request = file_chunk_download_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
- FileChunkDownloadResponse response = FILE_CHUNK_DOWNLOAD_RESPONSE__INIT;
- FRESULT Fresult = FR_OK;
- FIL *ReceivedFileHandle; //the system supports a single active file
-
- ReceivedFileHandle = DownloadFileHandle;
- char *Buffer = 0;
- Buffer = my_malloc (MAX_CHUNK_LENGTH);
- if (Buffer != NULL)
- {
- Fresult = f_read(ReceivedFileHandle,Buffer,2000,&WrittenBytes );
- if(Fresult != FR_OK)
- {
- LOG_ERROR (Fresult,"f_write error");
- }
- else
- {
- response.buffer.len = WrittenBytes;
- response.buffer.data = Buffer;
- FileReceivedLength += WrittenBytes;
- if (FileReceivedLength == FileLength)
- {
- REPORT_MSG (FileReceivedLength,"file download ended successfully");
- f_close(ReceivedFileHandle);
- free (DownloadFileHandle);
- FileReceivedLength = 0;
- }
- else
- {
- if (FileReceivedLength > FileLength)
- {
- REPORT_MSG (FileReceivedLength,"file download too much data!");
- f_close(ReceivedFileHandle);
- free (DownloadFileHandle);
- FileReceivedLength = 0;
- }
- }
- }
- }
-
- 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.error = getErrorCode(Fresult);
- responseContainer.errormessage = "File operation error";
- }
- 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);
- file_chunk_download_request__free_unpacked(request,NULL);
- my_free(responseContainer.data.data);
- my_free(Buffer);
- SendChars(container_buffer, container_size);
-
- return OK;
-}
FRESULT FileWrite(void * buffer, uint16_t size,char *path)
{
FRESULT Fresult = FR_OK;
diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c
index 06f082bca..c984f2c48 100644
--- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c
+++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c
@@ -677,6 +677,15 @@ uint32_t FPGA_MotorConfig_callback(TimerMotors_t _motorId, uint32_t ReadValue)
break;
}
break;
+ case MOTOR_CONFIG_END:
+ {
+ temp = x_HARD_HIZ;
+ temp = temp << 24;
+
+ MillisecWriteToMotor(_motorId, temp, 4, FPGA_MotorConfig_callback);
+ ConfigStages[_motorId]++;
+ }
+ break;
default:
return ERROR;
}
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c
index 566cb1cc6..38b029925 100644
--- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c
+++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c
@@ -22,6 +22,7 @@
#include "driverlib/i2c.h"
#include "drivers/I2C_Communication/I2C.h"
#include "Blower.h"
+#include "modules/control/control.h"
DAC_Union DAC;
@@ -159,6 +160,60 @@ uint32_t Turn_the_Blower_Off()
return status;
}
+uint32_t mInitial_mV, mTarget_mV;
+uint32_t mInterval = eOneSecond*20;
+uint32_t BlowerControlId = 0xFF;
+
+uint32_t Gradual_Increase_Blower_Callback(uint32_t DispenserId, uint32_t ReadValue)
+{
+ if ((mTarget_mV-mInitial_mV)<100)
+ {
+ Control_Voltage_To_Blower(mTarget_mV);
+ Report("Finished Increasing blower",__FILE__,__LINE__,(int)mTarget_mV,RpWarning,(int)millisecondCounter,0);
+ if (RemoveControlCallback(BlowerControlId, Gradual_Increase_Blower_Callback )==OK)
+ {
+ Report("Remove control callback",__FILE__,__LINE__,(int)1,RpWarning,(int)BlowerControlId,0);
+ BlowerControlId = 0xFF;
+ }
+ else
+ {
+ Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)BlowerControlId,0);
+ if (RemoveControlCallback(GetControlLowDevice_i(),Gradual_Increase_Blower_Callback)==OK)
+ {
+ Report("Remove control callback fixed",__FILE__,__LINE__,(int)1,RpWarning,(int)BlowerControlId,0);
+ BlowerControlId = 0xFF;
+ }
+ else
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)1,RpWarning,(int)BlowerControlId,0);
+ }
+ return OK;
+ }
+ mInitial_mV = mInitial_mV+100;
+ Control_Voltage_To_Blower(mInitial_mV);
+ Report("Increasing blower",__FILE__,__LINE__,(int)mInitial_mV,RpWarning,(int)millisecondCounter,0);
+ return OK;
+}
+
+uint32_t Gradual_Increase_Blower(uint32_t Initial_mV,uint32_t Target_mV)
+{
+ mInitial_mV = Initial_mV;
+ mTarget_mV = Target_mV;
+ if ((mTarget_mV-mInitial_mV)<100)
+ {
+ Control_Voltage_To_Blower(mTarget_mV);
+ Report("Finished Increasing blower",__FILE__,__LINE__,(int)mTarget_mV,RpWarning,(int)millisecondCounter,0);
+ return OK;
+ }
+ mInitial_mV = Initial_mV+100;
+ Control_Voltage_To_Blower(mInitial_mV);
+ Report("Increasing blower",__FILE__,__LINE__,(int)mInitial_mV,RpWarning,(int)millisecondCounter,0);
+ BlowerControlId = AddControlCallback( Gradual_Increase_Blower_Callback, mInterval,getBlowerState ,0, 0, 0 );
+ if (BlowerControlId == 0xFF)
+ {
+ Report("Add control callback failed",__FILE__,__LINE__,(int)0,RpWarning,(int)BlowerControlId,0);
+ return ERROR;
+ }
+}
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h
index 56a42a885..abe5d8a1a 100644
--- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h
+++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h
@@ -52,7 +52,7 @@ uint32_t Turn_the_Blower_On();
uint32_t Control_Voltage_To_Blower(uint32_t mV);
uint32_t Turn_the_Blower_Off();
uint32_t getBlowerState(void);
-
+uint32_t Gradual_Increase_Blower(uint32_t Initial_mV,uint32_t Target_mV);
#endif /* DRIVERS_I2C_COMMUNICATION_DAC_BLOWER_H_ */
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
index d6f661789..29a074fc0 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
@@ -717,8 +717,8 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
{
Turn_the_Blower_On();//Turn on with the Default_Voltage
if (BlowerCfg.voltage)
- Control_Voltage_To_Blower(BlowerCfg.voltage);
-
+ Gradual_Increase_Blower(BlowerCfg.heatingvoltage,BlowerCfg.voltage);
+ //Control_Voltage_To_Blower(BlowerCfg.voltage);
}
}
return OK;
diff --git a/Software/Embedded_SW/Embedded/Software Release Notes.txt b/Software/Embedded_SW/Embedded/Software Release Notes.txt
new file mode 100644
index 000000000..dd8679721
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Software Release Notes.txt
@@ -0,0 +1,11 @@
+Embedded SW Release note - Version 1.3.7.0
+This version includes massive changes in job handling, files support and hardware changes. also cleans multiple bugs and improves machine handing, cleans and removes unnecessary code from the SW files.
+it contains thet basis for improving the process and the operator control ability.
+1. file system: File system full handling, SW Upgrade support for FPGA, Load HW Config and embedded parameters from file, Dispensers activity stored in file.
+2. alarm handling: new list supports system definitions version 2. overheat/underheat type A/B handled,
+3. driver level support for all new HW/Backplan features. initial support for operator buttons. (tamper switches, WHS readout and sensors, buttons, magnet, head and cleaning motors and switches...)
+4. additional RAM space in internal RAM for additional development space
+5. Initial support for thread insertion fullprocess - not tested yet.
+6. bugs solved in control activity, in job handling and more. real time handling improved in main control functions
+7. IDS Infrastructure for testing: pressure bulding before job, coordinated activation of motors and valves (motor starts before valve opens, stops after valve closes.
+