From fc23da7f3510cce58308841eefb96d59868317ff Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 17 Dec 2018 09:41:17 +0200 Subject: Version 1.3.0.2 Reset Cause in log, remove some logs, improve memory on alarm handling. stop heaters and dispensers on alarm without job. split microsecond and control tasks to high and low priorities. Heaters PID with multiplications - use with new CFG. --- .../Embedded/Modules/Control/MillisecTask.c | 82 ++++++++++++++++--- .../Embedded_SW/Embedded/Modules/Control/control.c | 91 +++++++++++++++++++++- 2 files changed, 160 insertions(+), 13 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 68bd680a8..64b6ac4e0 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -90,6 +90,7 @@ MillisecMotorDataStruc SpeedSetPending[NUM_OF_MOTORS] = {0}; MillisecMotorDataStruc PT100Data[MAX_TEMPERATURE_SENSOR_ID] = {0}; /******************** GLOBAL PARAMETERS ********************************************/ Mailbox_Handle MillisecMsgQ = NULL; +Mailbox_Handle TenMillisecMsgQ = NULL; Mailbox_Handle MotorsMsgQ[NUM_OF_MOTORS] = {NULL}; bool MillisecRestart; static GateMutex_Handle gateMillisecDB; @@ -114,6 +115,7 @@ void MillisecInit(void) Error_init(&eb); MillisecMsgQ = Mailbox_create(sizeof(MillisecMessageStruc), 2, NULL,&eb); + TenMillisecMsgQ = Mailbox_create(sizeof(MillisecMessageStruc), 2, NULL,&eb); for (i=0;i= 999) + backlogindex = 0; + switch (ControlArray[Device_i].ControlTiming) + { + case eOneMillisecond: + break; case eTenMillisecond: if (Ten_msTick) { @@ -374,7 +422,17 @@ uint32_t ControlLoop(uint32_t tick) memset (&ControlArray[Device_i],0,sizeof(ControlDeviceStruc) ); break; default: - LOG_ERROR (ControlArray[Device_i].ControlTiming, "Invalid control timing value"); + if (tick%ControlArray[Device_i].ControlTiming == 0) + { + if(ControlArray[Device_i].ControlDataReadPtr) + ControlDatalog[Device_i] = ControlArray[Device_i].ControlDataReadPtr( ControlArray[Device_i].Parameter1); + else + LOG_ERROR (Device_i, "Invalid callback ptr"); + if(ControlArray[Device_i].ControlCallbackPtr) + ControlArray[Device_i].ControlCallbackPtr(ControlArray[Device_i].IfIndex, ControlDatalog[Device_i]); + else + LOG_ERROR (Device_i, "Invalid callback ptr"); + } break; } //switch } //if control active @@ -410,3 +468,30 @@ void controlTask(UArg arg0, UArg arg1) } } } +/****************************************************************************** + * ======== messageTsk ======== + * Task for this function is created statically. See the project's .cfg file. + * this message task is created statically in system initialization, + ******************************************************************************/ +void controlLowTask(UArg arg0, UArg arg1) +{ + ControlMessageStruc Message; + //char str[60]; + //uint16_t length; + //Clock_setTimeout(HostKAClock, 1000); + //Clock_start(HostKAClock); + Control_Task_Handle = Task_self(); + + while(1) + { + Mailbox_pend(TenControlMsgQ , &Message, BIOS_WAIT_FOREVER); + switch (Message.messageId) + { + case OneMillisec: + ControlLowLoop(Message.tick); + break; + default: + break; + } + } +} -- cgit v1.3.1