Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -ra49d4033363206fc3ae86d8648eb5b9cc91e8dca -rf5e94d652d50cf8eac2fdc91948d4f5a52d6ce42 --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision a49d4033363206fc3ae86d8648eb5b9cc91e8dca) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision f5e94d652d50cf8eac2fdc91948d4f5a52d6ce42) @@ -101,8 +101,8 @@ enum EmbCommands { - NU = 0, ///< Null command. - CS, ///< Control S command to switch to embedded mode. + NU_EMB_MODE_CMD = 0, ///< Null command. + CS_EMB_MODE_CMD, ///< Control S command to switch to embedded mode. SP, ///< Set point command to set the set point. T, ///< Self test command. G, ///< Get self test command. @@ -225,7 +225,7 @@ bloodLeakPrevFPGARegisterCount = 0; bloodLeakPersistenceCtr = 0; bloodLeakSignalEmbModeReq = FALSE; - bloodLeakEmbModeRqstedCmd = NU; + bloodLeakEmbModeRqstedCmd = NU_EMB_MODE_CMD; bloodLeakEmbModeSubstate = BLOOD_LEAK_CAL_WAIT_FOR_COMAND_STATE; bloodLeakEmbModeOpsStartTime = 0; bloodLeakEmbModeRespIndex = 0; @@ -852,11 +852,11 @@ switch( bloodLeakEmbModeRqstedCmd ) { - case NU: + case NU_EMB_MODE_CMD: // Null command do nothing break; - case CS: + case CS_EMB_MODE_CMD: case T: case G: case I: @@ -903,7 +903,7 @@ switch ( bloodLeakEmbModeRqstedCmd ) { - case CS: + case CS_EMB_MODE_CMD: case T: case G: case I: @@ -992,7 +992,7 @@ U08 expChar2 = bloodLeakEmbModeCmd[ bloodLeakEmbModeRqstedCmd ].expChar2; U08 command = bloodLeakEmbModeCmd[ bloodLeakEmbModeRqstedCmd ].commandASCII; - if ( ( expChar1 != NU ) && ( NU == expChar2 ) ) + if ( ( expChar1 != NU_EMB_MODE_CMD ) && ( NU_EMB_MODE_CMD == expChar2 ) ) { // This is the case that there is a start character. If current character buffer index is less than the // length of the expected response of the command. @@ -1016,7 +1016,7 @@ } } } - else if ( ( expChar1 != NU ) && ( expChar2 != NU ) ) + else if ( ( expChar1 != NU_EMB_MODE_CMD ) && ( expChar2 != NU_EMB_MODE_CMD ) ) { // This is the case that both expected chars are not null. Either of the chars are accepted like P or F if ( bloodLeakEmbModeRespIndex < length ) @@ -1055,7 +1055,7 @@ } } } - else if ( ( NU == expChar1 ) && ( NU == expChar2 ) ) + else if ( ( NU_EMB_MODE_CMD == expChar1 ) && ( NU_EMB_MODE_CMD == expChar2 ) ) { // This is the case that there are no expected characters and the received value are numbers if ( bloodLeakEmbModeRespIndex < length ) @@ -1076,7 +1076,7 @@ { // Check if the first element of the response buffer is null and the number of tries has not exceeded. When the response buffer is // null but it is the end of the receive buffer it means no response has been received back - if ( ( NU == bloodLeakEmbModeRespBuffer[ 0 ] ) && ( ++bloodLeakEmbModeNumOfCmdTries < BLOOD_LEAK_EMB_MODE_MAX_NUM_CMD_TRIES ) ) + if ( ( NU_EMB_MODE_CMD == bloodLeakEmbModeRespBuffer[ 0 ] ) && ( ++bloodLeakEmbModeNumOfCmdTries < BLOOD_LEAK_EMB_MODE_MAX_NUM_CMD_TRIES ) ) { state = BLOOD_LEAK_CAL_SEND_COMMAND_STATE; } @@ -1090,20 +1090,20 @@ { // Loop through the elements of the buffer and make sure none of the elements are not NULL. // The elements are checked until the specified length that is expected for a command - isNull |= ( bloodLeakEmbModeRespBuffer[ i ] != NU ? FALSE : TRUE ); + isNull |= ( bloodLeakEmbModeRespBuffer[ i ] != NU_EMB_MODE_CMD ? FALSE : TRUE ); } // Check if the failed command is Control S which is switch to embedded mode and if // it failed set the embedded mode request to false so the other commands cannot be sent again - bloodLeakSignalEmbModeReq = ( ( CS == bloodLeakEmbModeRqstedCmd ) && ( NU == bloodLeakEmbModeRespBuffer[ 0 ] ) ? FALSE : TRUE ); + bloodLeakSignalEmbModeReq = ( ( CS_EMB_MODE_CMD == bloodLeakEmbModeRqstedCmd ) && ( NU_EMB_MODE_CMD == bloodLeakEmbModeRespBuffer[ 0 ] ) ? FALSE : TRUE ); if ( ( TRUE == isNull ) && ( ++bloodLeakEmbModeNumOfCmdTries < BLOOD_LEAK_EMB_MODE_MAX_NUM_CMD_TRIES ) ) { state = BLOOD_LEAK_CAL_SEND_COMMAND_STATE; } else { - bloodLeakEmbModeRqstedCmd = NU; + bloodLeakEmbModeRqstedCmd = NU_EMB_MODE_CMD; state = BLOOD_LEAK_CAL_WAIT_FOR_COMAND_STATE; handleSendBloodLeakEmbeddedModeCommandResponse( length, bloodLeakEmbModeRespBuffer ); @@ -1216,16 +1216,16 @@ static void initEmbModeSpecs( void ) { // Null command - bloodLeakEmbModeCmd[ NU ].commandASCII = NU; - bloodLeakEmbModeCmd[ NU ].expChar1 = NU; - bloodLeakEmbModeCmd[ NU ].expChar2 = NU; - bloodLeakEmbModeCmd[ NU ].length = 0; + bloodLeakEmbModeCmd[ NU_EMB_MODE_CMD ].commandASCII = NU_EMB_MODE_CMD; + bloodLeakEmbModeCmd[ NU_EMB_MODE_CMD ].expChar1 = NU_EMB_MODE_CMD; + bloodLeakEmbModeCmd[ NU_EMB_MODE_CMD ].expChar2 = NU_EMB_MODE_CMD; + bloodLeakEmbModeCmd[ NU_EMB_MODE_CMD ].length = 0; // Control S command - bloodLeakEmbModeCmd[ CS ].commandASCII = 19; // ASCII for Control S - bloodLeakEmbModeCmd[ CS ].expChar1 = 69; // ASCII for E (Embedded ...) - bloodLeakEmbModeCmd[ CS ].expChar2 = NU; - bloodLeakEmbModeCmd[ CS ].length = 5; + bloodLeakEmbModeCmd[ CS_EMB_MODE_CMD ].commandASCII = 19; // ASCII for Control S + bloodLeakEmbModeCmd[ CS_EMB_MODE_CMD ].expChar1 = 69; // ASCII for E (Embedded ...) + bloodLeakEmbModeCmd[ CS_EMB_MODE_CMD ].expChar2 = NU_EMB_MODE_CMD; + bloodLeakEmbModeCmd[ CS_EMB_MODE_CMD ].length = 5; // Set point command bloodLeakEmbModeCmd[ SP ].commandASCII = 83; // ASCII for S @@ -1242,25 +1242,25 @@ // Get self test command bloodLeakEmbModeCmd[ G ].commandASCII = 71; // ASCII for G bloodLeakEmbModeCmd[ G ].expChar1 = 71; - bloodLeakEmbModeCmd[ G ].expChar2 = NU; + bloodLeakEmbModeCmd[ G ].expChar2 = NU_EMB_MODE_CMD; bloodLeakEmbModeCmd[ G ].length = 5; // Intensity command bloodLeakEmbModeCmd[ I ].commandASCII = 73; // ASCII for I bloodLeakEmbModeCmd[ I ].expChar1 = 73; - bloodLeakEmbModeCmd[ I ].expChar2 = NU; + bloodLeakEmbModeCmd[ I ].expChar2 = NU_EMB_MODE_CMD; bloodLeakEmbModeCmd[ I ].length = 5; // Blood detection command bloodLeakEmbModeCmd[ V ].commandASCII = 86; // ASCII for V bloodLeakEmbModeCmd[ V ].expChar1 = 86; - bloodLeakEmbModeCmd[ V ].expChar2 = NU; + bloodLeakEmbModeCmd[ V ].expChar2 = NU_EMB_MODE_CMD; bloodLeakEmbModeCmd[ V ].length = 5; // Zero sensor command bloodLeakEmbModeCmd[ Z ].commandASCII = 90; // ASCII for Z bloodLeakEmbModeCmd[ Z ].expChar1 = 89; // ASCII for Y - bloodLeakEmbModeCmd[ Z ].expChar2 = NU; + bloodLeakEmbModeCmd[ Z ].expChar2 = NU_EMB_MODE_CMD; bloodLeakEmbModeCmd[ Z ].length = 1; // Zero confirm command @@ -1272,13 +1272,13 @@ // Display blood detection command bloodLeakEmbModeCmd[ D ].commandASCII = 68; bloodLeakEmbModeCmd[ D ].expChar1 = 68; // ASCII for D - bloodLeakEmbModeCmd[ D ].expChar2 = NU; + bloodLeakEmbModeCmd[ D ].expChar2 = NU_EMB_MODE_CMD; bloodLeakEmbModeCmd[ D ].length = 5; // Calibrate command bloodLeakEmbModeCmd[ C ].commandASCII = 67; bloodLeakEmbModeCmd[ C ].expChar1 = 67; // ASCII for C - bloodLeakEmbModeCmd[ C ].expChar2 = NU; + bloodLeakEmbModeCmd[ C ].expChar2 = NU_EMB_MODE_CMD; bloodLeakEmbModeCmd[ C ].length = 4; } @@ -1406,7 +1406,7 @@ if ( ( MODE_FAUL == mode ) || ( MODE_SERV == mode ) || ( MODE_STAN == mode ) ) { bloodLeakSignalEmbModeReq = TRUE; - bloodLeakEmbModeRqstedCmd = CS; + bloodLeakEmbModeRqstedCmd = CS_EMB_MODE_CMD; result = TRUE; } }