From 31eb2421db55f356d67a75bf8c2c1f74802f5d86 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 30 Jun 2019 10:11:59 +0300 Subject: Version 1.4.1.1 improve watchdog/DFU handling (works, not great) --- Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c | 4 ++-- Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index fe9671657..31783db49 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -644,7 +644,7 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue) { int index=MAX_HEATERS_NUM; int32_t MaxreadValue; - int32_t MinreadValue; + if (IfIndex>>8 != IfTypeHeaters) { LOG_ERROR (IfIndex, "Wrong Interface type"); @@ -677,7 +677,7 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue) SecondaryPT100Read = readValue; } MaxreadValue = max (MainPT100Read,SecondaryPT100Read); - MinreadValue = min (MainPT100Read,SecondaryPT100Read); + if (MaxreadValue >= HeaterControl[index].sensormaxvalue) { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 5efc3798e..eb1b751bb 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -733,6 +733,7 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request) if (Motor_i == FEEDER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled { + Report("Feeder Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0); if (SpeedControlId != 0xFF) { RemoveControlCallback(SpeedControlId,ThreadLengthCBFunction); @@ -744,6 +745,7 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request) } if (Motor_i == POOLER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled { + Report("Puller Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0); if (PoolerSpeedControlId != 0xFF) { if (RemoveControlCallback(PoolerSpeedControlId,PoolerThreadLengthCBFunction)!=OK) @@ -783,6 +785,7 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request) } if (Motor_i == WINDER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will n//ot be controlled { + Report("Winder Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0); if (ControlIdtoMotorId[Motor_i] != 0xFF) { if(RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction)!=OK) -- cgit v1.3.1 From 4d4f9ed9366692c80df960737d1b59f22f42cc14 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 2 Jul 2019 10:55:26 +0300 Subject: handle watchdog for long maintenance operations --- Software/Embedded_SW/Embedded/Main.c | 6 +++++- .../Embedded_SW/Embedded/Modules/General/GeneralHardware.c | 10 ++++++++++ Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c | 10 ++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index ebeb7d718..6c561a303 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -272,10 +272,12 @@ int main(void) Init_Machine_Leds(); #endif +#ifndef EVALUATION_BOARD WHS_init(); Buttons_Init(); //IDS_ModuleInit(); Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Waste); +#endif //////////////////////////// @@ -303,7 +305,9 @@ int main(void) - Set_Speed_Sensor_TypeII_Registers(2,2);//set default values +#ifndef EVALUATION_BOARD + //Set_Speed_Sensor_TypeII_Registers(2,2);//set default values +#endif //Read_Speed_Sensor_TypeII();//must be delay between Set_Speed_Sensor_TypeII_Registers to Read_Speed_Sensor_TypeII //Test_ADS120_Internal_Temperature_Sensor(0); diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 23009d7fb..2871a31c8 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -532,6 +532,11 @@ void FlashInitAndLoad(void) UploadProcessParametersRequest* request = NULL; char ProcessParamsPath[50] = "0://SysInfo//ProcessP.cfg"; +#ifdef WATCHDOG + ROM_WatchdogResetDisable(WATCHDOG0_BASE); + uint32_t timeout = 120000000*35; + ROM_WatchdogReloadSet(WATCHDOG0_BASE, timeout); +#endif FlashInit(); //initialize flash Report("Flash Initialized", __FILE__,__LINE__,FLASH_SIZE, RpMessage, FLASH_RAM_BASE, 0); @@ -593,5 +598,10 @@ void FlashInitAndLoad(void) } else Report("Process not Initialized", __FILE__,__LINE__,0, RpMessage, 0, 0); +#ifdef WATCHDOG + ROM_WatchdogResetEnable(WATCHDOG0_BASE); + timeout = 120000000*3; + ROM_WatchdogReloadSet(WATCHDOG0_BASE, timeout); +#endif } diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index c2f6a4384..ee568d686 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -39,12 +39,22 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) else if((request->amount == 0xCF) && (request->delay == 0xCF)) //Create File System on the Drive { +#ifdef WATCHDOG + ROM_WatchdogResetDisable(WATCHDOG0_BASE); + uint32_t timeout = 120000000*35; + ROM_WatchdogReloadSet(WATCHDOG0_BASE, timeout); +#endif FRESULT iFResult = Init_Flash_File_System(true); if(iFResult != FR_OK) { LOG_ERROR (iFResult, "Error during init Flash File System"); assert(iFResult); } +#ifdef WATCHDOG + ROM_WatchdogResetEnable(WATCHDOG0_BASE); + timeout = 120000000*3; + ROM_WatchdogReloadSet(WATCHDOG0_BASE, timeout); +#endif } else if((request->amount == 0x0C) && (request->delay == 0x0C)) //Get Gas Sensor -- cgit v1.3.1