Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
Diff: src/ConfigurationHandler/Controls/SetpointControl.cpp
- Revision:
- 71:34856d21f2bf
- Parent:
- 70:7427f4959201
- Child:
- 72:3754b352f156
--- a/src/ConfigurationHandler/Controls/SetpointControl.cpp Fri Sep 16 17:54:51 2016 +0000 +++ b/src/ConfigurationHandler/Controls/SetpointControl.cpp Fri Sep 16 20:54:07 2016 +0000 @@ -61,19 +61,6 @@ return true; // object created successfully } -// Method: registerControl -// Description: register the setpoint control with the output task -// -// @param none -// @return none - -void SetpointControl::registerControl(void) -{ - if ( GLOBAL_outputTask_thread ) { - // register our priority with the output master - } -} - // Method: start // Description: start the setpoint control // @@ -140,6 +127,11 @@ bool SetpointControl::overLimit(void) { + static int counter = 0; + // stubbed for now + if ( counter++ == 5 ) { + return true; + } // stubbed for now return false; } @@ -153,7 +145,6 @@ bool SetpointControl::underLimit(void) { - // stubbed for now return true; } @@ -169,15 +160,13 @@ logInfo("%s: %s attempting to start feed on relay %s\n", __func__, controlFile.c_str(), output.c_str()); - OutputControlMsg_t *msg = OutputMasterMailBox.alloc(); - - // construct the ON message - msg->output = this->output; - msg->state = ON; - msg->priority = this->priority; - - // ship it to the output task - OutputMasterMailBox.put(msg); + OutputControlMsg_t *output_mail = OutputMasterMailBox.alloc(); + memset(output_mail, 0, sizeof(OutputControlMsg_t)); + output_mail->action = ACTION_CONTROL_ON; + output_mail->priority = this->priority; + strncpy(output_mail->output, this->output.c_str(), sizeof(output_mail->output)-1); + strncpy(output_mail->id, this->id.c_str(), sizeof(output_mail->id)-1); + OutputMasterMailBox.put(output_mail); } // Method: stopFeed @@ -189,16 +178,14 @@ void SetpointControl::stopFeed(void) { - logInfo("%s: %s attempting to start feed on relay %s\n", + logInfo("%s: %s attempting to stop feed on relay %s\n", __func__, controlFile.c_str(), output.c_str()); - OutputControlMsg_t *msg = OutputMasterMailBox.alloc(); - - // construct the OFF message - msg->output = this->output; - msg->state = OFF; - msg->priority = this->priority; - - // ship it - OutputMasterMailBox.put(msg); + OutputControlMsg_t *output_mail = OutputMasterMailBox.alloc(); + memset(output_mail, 0, sizeof(OutputControlMsg_t)); + output_mail->action = ACTION_CONTROL_OFF; + output_mail->priority = this->priority; + strncpy(output_mail->output, this->output.c_str(), sizeof(output_mail->output)-1); + strncpy(output_mail->id, this->id.c_str(), sizeof(output_mail->id)-1); + OutputMasterMailBox.put(output_mail); } \ No newline at end of file