From 5a3c7560c32ad3346fa2648466e9791c8bebf2aa Mon Sep 17 00:00:00 2001 From: Avi Levkovich Date: Thu, 7 Feb 2019 17:59:02 +0200 Subject: update the logic of Machine Leds (using PWM) and few changes in the buttons logic --- .../Embedded_SW/Embedded/Modules/Control/control.c | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Software/Embedded_SW/Embedded/Modules/Control/control.c') diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 0cda9b5a6..100fefbd8 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -51,6 +51,7 @@ #include #include "drivers/adc_sampling/adc.h" +#include "Modules/General/buttons.h" #include "control.h" #include "MillisecTask.h" @@ -157,10 +158,20 @@ void ControlStop(void) uint32_t ControlActivityLed( uint32_t Parameter1) { static bool flag = false; + static uint8_t counter; + const uint8_t Blink_Freq = 15;//odd number + if (flag==true) { COMM_RED_LED_ON; ACTIVITY_RED_LED_OFF; // Heaters indication - all the Heaters OFF + if(power.color == fastBILNK) + Pannel_Leds(POWER_ON_OFF,MODE_OFF); + + if((power.color == BLINK) && (counter % Blink_Freq == 0) ) + { + Pannel_Leds(POWER_ON_OFF,MODE_OFF); + } flag = false; } else @@ -168,8 +179,22 @@ uint32_t ControlActivityLed( uint32_t Parameter1) COMM_RED_LED_OFF; if (HeaterActive > 0)// Blink the led on heating ACTIVITY_RED_LED_ON;// Heaters indication - at least one of the Heaters is ON + + if(power.color == fastBILNK) + Pannel_Leds(POWER_ON_OFF,MODE_ON); + + if((power.color == BLINK) && (counter % Blink_Freq == 0) ) + { + Pannel_Leds(POWER_ON_OFF,MODE_ON); + } + flag = true; } + + if (counter < 0xFF) + counter++; + else + counter = Blink_Freq + 1; return OK; } uint32_t ControlEmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue) -- cgit v1.3.1 From 1cbfa754eea84d46fca7a9b0d27a0a1a212b9944 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 7 Feb 2019 22:29:44 +0200 Subject: reboot after load --- .../Embedded/Common/SWUpdate/FileSystem.c | 45 ---------------------- .../Embedded/Common/SWUpdate/FirmwareUpgrade.c | 9 +++-- .../Drivers/I2C_Communication/DAC/Blower.c | 1 + Software/Embedded_SW/Embedded/Main.c | 2 +- .../Embedded_SW/Embedded/Modules/Control/control.c | 26 ------------- 5 files changed, 8 insertions(+), 75 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Control/control.c') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index d39c335ef..c3bfa396d 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -422,51 +422,10 @@ uint32_t DeleteRequestFunc(MessageContainer* requestContainer) DeleteResponse response = DELETE_RESPONSE__INIT; - DIR dir; FILINFO* fno = 0; //int NumOfFiles = 0; FRESULT Fresult = FR_OK; - /*Fresult |= f_opendir(&dir, g_cCwdBuf); - if(Fresult != FR_OK) - { - LOG_ERROR (Fresult,"f_write error"); - } - else - { - - fno = my_malloc(sizeof(FILINFO)); - memset (fno,0,sizeof(FILINFO)); - Fresult = f_stat(request->path,fno); - if (Fresult == FR_OK) - { - if (isDirectory(fno->fattrib)) - { - //============================ - Fresult = f_opendir(&dir, request->path); - if (Fresult == FR_OK) - { - Fresult = f_readdir(&dir, &fno); - if (Fresult == FR_OK) - { - if(fno->fname[0] ==0) - { - //no files - Fresult = f_unlink(request->path); - } - else - { - LOG_ERROR (fno,"Directory not empty"); - } - } - } - } - else - { - Fresult = f_unlink(request->path); - } - } - }*/ Fresult = f_unlink(request->path); responseContainer = createContainer(MESSAGE_TYPE__DeleteResponse, requestContainer->token, false, &response, &delete_response__pack, &delete_response__get_packed_size); @@ -593,10 +552,6 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) Data[i].length = fno[i]->fsize; Data[i].lastmodifieddate = fno[i]->fdate; Data[i].lastmodifiedtime = fno[i]->ftime; - //strcpy(FullPath[i],request->path); - //strcat(FullPath[i],'\\'); - //strcat(FullPath[i],&fno[i]->fname); - //sprintf (FullPath[i], "%s/%s", request->path, &fno[i]->fname); if (i==0) usnprintf(&FullPath[i], 50, "%s", request->path); else diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c index dcb8cf8f2..e029bf2ce 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c @@ -32,7 +32,7 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer) char FullPath[50]; FRESULT Fresult = FR_OK; int File_i; - + bool Reboot = false; MessageContainer responseContainer; ActivateVersionRequest* request = activate_version_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); @@ -62,8 +62,11 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer) //validate //update usnprintf(FullPath, 50, "%s%s%s", request->path,"/", VersionPackage->filedescriptors[File_i]->filename); - - Fresult = FPGA_Programming_Request( FileDestinationToFPGAId[VersionPackage->filedescriptors[File_i]->destination], FullPath, false); + if (VersionPackage->filedescriptors[File_i]->destination == VERSION_FILE_DESTINATION__FPGA3) + Reboot = true; + else + Reboot = false; + Fresult = FPGA_Programming_Request( FileDestinationToFPGAId[VersionPackage->filedescriptors[File_i]->destination], FullPath, Reboot); break; default: LOG_ERROR (VersionPackage->filedescriptors[File_i]->destination,"wrong file update Destination"); 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 940cd136c..eced74d16 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c @@ -213,6 +213,7 @@ uint32_t Gradual_Increase_Blower(uint32_t Initial_mV,uint32_t Target_mV) Report("Add control callback failed",__FILE__,__LINE__,(int)0,RpWarning,(int)BlowerControlId,0); return ERROR; } + return OK; } uint32_t Cancel_Gradual_Increase_Blower(uint32_t Initial_mV) { diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index b13bab1d5..56382abd0 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -206,7 +206,7 @@ int main(void) //GetVmeByte(); ////////////////////////////////// - #warning + #warning breathing led test //Turn off LED1 //TODO temporary to stop the breathing leds - need the change the FPGA 3 F3_Prescaler1_reg5 = 0x03; F3_low_var_LED1 = 101; diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 0cda9b5a6..898f7ec67 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -334,20 +334,6 @@ uint32_t GetControlLowDevice_i(void) } uint32_t ControlLoop(uint32_t tick) { - //call all modules control functions - //test dancers and speed encoders - //check all callback units (state machine waiting for completion of a change) - //uint32_t ControlDevice_i; - /*bool Ten_msTick, Hundred_msTick, Onesecond_Tick,Tick98,Tick998; - Ten_msTick = (tick%eTenMillisecond == 0) ?true:false; - Hundred_msTick = (tick%eHundredMillisecond == 0) ?true:false; -// Hundred_msTick = (tick%200 == 0) ?true:false; - Onesecond_Tick = (tick%eOneSecond == 0) ?true:false; - Tick98 = (tick%eHundredMillisecond == 98) ?true:false; -// Tick98 = (tick%200 == 199) ?true:false; - Tick998 = (tick%eOneSecond == 996) ?true:false; -*/ - //ROM_IntMasterDisable(); //for (ControlDevice_i = 0; ControlDevice_i < MaxHighDevices;ControlDevice_i++) for (ControlDevice_i = 0; ControlDevice_i < MAX_TANGO_CONTROL_DEVICES;ControlDevice_i++) { @@ -379,18 +365,6 @@ uint32_t ControlLoop(uint32_t tick) } uint32_t ControlLowLoop(uint32_t tick) { - //call all modules control functions - //test dancers and speed encoders - //check all callback units (state machine waiting for completion of a change) - //uint32_t Device_i; - //bool Ten_msTick, Hundred_msTick, Onesecond_Tick,Tick98,Tick998; - //Ten_msTick = (tick%eTenMillisecond == 0) ?true:false; - //Hundred_msTick = (tick%eHundredMillisecond == 0) ?true:false; - //Onesecond_Tick = (tick%eOneSecond == 0) ?true:false; - //Tick98 = (tick%eHundredMillisecond == 98) ?true:false; - //Tick998 = (tick%eOneSecond == 996) ?true:false; - - //ROM_IntMasterDisable(); for (ControlLowDevice_i = 0; ControlLowDevice_i < MAX_TANGO_CONTROL_DEVICES;ControlLowDevice_i++) { if (ControlArray[ControlLowDevice_i].ControlActive) -- cgit v1.3.1