Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -rf99f8b365af2274d68d7f424cc9be9815b4db19c -re9f15ff59ac0350adcbe544df8b3451e15ee7287 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision f99f8b365af2274d68d7f424cc9be9815b4db19c) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision e9f15ff59ac0350adcbe544df8b3451e15ee7287) @@ -571,6 +571,10 @@ SET_ALARM_WITH_1_U32_DATA( ALARM_ID_TD_UI_POST_TIMEOUT, 1 ) result = SELF_TEST_STATUS_FAILED; } + else + { + ; // do nothing + } return result; } Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -rad2492d1c1b63ec2727e5a7a13c5b3a4f8021f86 -re9f15ff59ac0350adcbe544df8b3451e15ee7287 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision ad2492d1c1b63ec2727e5a7a13c5b3a4f8021f86) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision e9f15ff59ac0350adcbe544df8b3451e15ee7287) @@ -448,7 +448,8 @@ broadcastModeIntervalCtr = 0; data.opMode = (U32)currentMode; data.subMode = currentSubMode; - broadcastData( MSG_ID_TD_OP_MODE_DATA, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&data, sizeof( OP_MODE_PAYLOAD_T ) ); + broadcastData( MSG_ID_TD_OP_MODE_DATA, COMM_BUFFER_OUT_CAN_TD_BROADCAST, + (U08*)&data, sizeof( OP_MODE_PAYLOAD_T ) ); } } @@ -466,28 +467,31 @@ U32 pendingIndex = 0; CONFIRMATION_REQUEST_STATUS_T status = CONFIRMATION_REQUEST_STATUS_PENDING; U32 i; - UI_PAYLOAD_T cmd; - cmd.id = 0; - cmd.reason = 0; + GENERIC_CONFIRMATION_REQUEST_T cmd = { 0 }; + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) { if ( confirmRequests[ i ].requestID == requestID ) { status = confirmRequests[ i ].status; if ( status != CONFIRMATION_REQUEST_STATUS_PENDING ) { - cmd.id = requestID; + cmd.requestID = requestID; // Send UI clear if ( CONFIRMATION_REQUEST_STATUS_TIMEOUT == status ) { - cmd.command = GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE; - sendMessage( MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST, COMM_BUFFER_OUT_CAN_TD_2_UI, (U08 *)&cmd, sizeof( UI_PAYLOAD_T ) ); + cmd.requestType = GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE; + sendMessage( MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST, + COMM_BUFFER_OUT_CAN_TD_2_UI, (U08 *)&cmd, + sizeof( GENERIC_CONFIRMATION_REQUEST_T ) ); } else { - cmd.command = GENERIC_CONFIRM_CMD_ACCEPT_CLOSE; - sendMessage( MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST, COMM_BUFFER_OUT_CAN_TD_2_UI, (U08 *)&cmd, sizeof( UI_PAYLOAD_T ) ); + cmd.requestType = GENERIC_CONFIRM_CMD_ACCEPT_CLOSE; + sendMessage( MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST, + COMM_BUFFER_OUT_CAN_TD_2_UI, (U08 *)&cmd, + sizeof( GENERIC_CONFIRMATION_REQUEST_T ) ); } // Clear the confirmation request, it is done and consumed @@ -518,8 +522,10 @@ if ( ( CONFIRMATION_REQUEST_STATUS_PENDING != status ) && ( TRUE == pending ) ) { // Last confirmation cleared, pending request must be resent to UI - cmd.command = confirmRequests[ pendingIndex ].requestType; - sendMessage( MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST, COMM_BUFFER_OUT_CAN_TD_2_UI, (U08 *)&cmd, sizeof( UI_PAYLOAD_T ) ); + cmd.requestType = confirmRequests[ pendingIndex ].requestType; + sendMessage( MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST, + COMM_BUFFER_OUT_CAN_TD_2_UI, (U08 *)&cmd, + sizeof( GENERIC_CONFIRMATION_REQUEST_T ) ); } return status; @@ -561,41 +567,46 @@ GENERIC_CONFIRM_ID_T addConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ) { U32 i; + BOOL confirmAlreadyPending = FALSE; GENERIC_CONFIRM_ID_T newID = GENERIC_CONFIRM_ID_NONE; - UI_PAYLOAD_T cmd; + GENERIC_CONFIRMATION_REQUEST_T cmd = { 0 }; // Check whether this confirmation is already pending for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) { - if ( ( confirmRequests[i].requestID == requestID ) && - ( confirmRequests[i].status == CONFIRMATION_REQUEST_STATUS_PENDING ) ) + if ( ( confirmRequests[ i ].requestID == requestID ) && + ( CONFIRMATION_REQUEST_STATUS_UNUSED != confirmRequests[ i ].status ) ) { + confirmAlreadyPending = TRUE; return requestID; } } - // Find an unused slot - for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) + if ( confirmAlreadyPending != TRUE) { - if ( confirmRequests[i].status == CONFIRMATION_REQUEST_STATUS_UNUSED ) + // Find an unused slot + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) { - confirmRequests[i].requestID = requestID; - confirmRequests[i].requestType = requestType; - confirmRequests[i].timeStamp = getMSTimerCount(); - confirmRequests[i].status = CONFIRMATION_REQUEST_STATUS_PENDING; + if ( CONFIRMATION_REQUEST_STATUS_UNUSED == confirmRequests[i].status ) + { + confirmRequests[ i ].requestID = requestID; + confirmRequests[ i ].requestType = requestType; + confirmRequests[ i ].timeStamp = getMSTimerCount(); + confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_PENDING; - newID = requestID; + newID = requestID; - cmd.id = requestID; - cmd.command = requestType; - cmd.reason = rejectReason; + cmd.requestID = requestID; + cmd.requestType = requestType; + cmd.rejectReason = rejectReason; - sendMessage( MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST, COMM_BUFFER_OUT_CAN_TD_2_UI, (U08 *)&cmd, sizeof( UI_PAYLOAD_T ) ); + sendMessage( MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST, COMM_BUFFER_OUT_CAN_TD_2_UI, + (U08 *)&cmd, sizeof( GENERIC_CONFIRMATION_REQUEST_T ) ); - break; + break; + } } } - return newID; } @@ -657,7 +668,7 @@ * The handleUIConfirmationResponse function handles a UI response for * confirmation request. * @details \b Inputs: none - * @details \b Outputs: message handled + * @details \b Outputs: none * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -669,10 +680,11 @@ if ( message->hdr.payloadLen == (2 * sizeof(U32)) ) { - memcpy( &request_id, &message->payload[0], sizeof(U32) ); - memcpy( &status, &message->payload[sizeof(U32)], sizeof(U32) ); + memcpy( &request_id, &message->payload[ 0 ], sizeof(U32) ); + memcpy( &status, &message->payload[sizeof( U32 )], sizeof(U32) ); - setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T)request_id, (CONFIRMATION_REQUEST_STATUS_T)status ); + setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T)request_id, + (CONFIRMATION_REQUEST_STATUS_T)status ); result = TRUE; } Index: firmware/App/Monitors/Buttons.c =================================================================== diff -u -rf99f8b365af2274d68d7f424cc9be9815b4db19c -re9f15ff59ac0350adcbe544df8b3451e15ee7287 --- firmware/App/Monitors/Buttons.c (.../Buttons.c) (revision f99f8b365af2274d68d7f424cc9be9815b4db19c) +++ firmware/App/Monitors/Buttons.c (.../Buttons.c) (revision e9f15ff59ac0350adcbe544df8b3451e15ee7287) @@ -286,7 +286,8 @@ * @brief * The initiatePowerOff function initiates a power off sequence. * @details \b Inputs: none - * @details \b Outputs: offRequestDelayTimer, offRequestPulseTimer, offRequestPulseCount, offButtonPressPending + * @details \b Outputs: offRequestDelayTimer, offRequestPulseTimer, + * offRequestPulseCount, offButtonPressPending * @return none *************************************************************************/ void initiatePowerOff( void ) @@ -308,13 +309,14 @@ * @details \b Message \b Sent: OFF_BUTTON_CMD_CANCEL_USER_CONFIRM_PROMPT when * pending off button expires. * @details \b Inputs: offButtonState, prevOffButtonState - * @details \b Outputs: offButtonPressPending, offRequestPulseCount, offRequestPulseTimer + * @details \b Outputs: offButtonPressPending, offRequestPulseCount, offRequestPulseTimer + * offRequestAwaitingUserConfirmation, offRequestPendingTimer * @return none *************************************************************************/ static void handleOffButtonProcessing( void ) { static U08 shutdownFlag = FALSE; - CONFIRMATION_REQUEST_STATUS_T responceStatus = CONFIRMATION_REQUEST_STATUS_UNUSED; + CONFIRMATION_REQUEST_STATUS_T responseStatus = CONFIRMATION_REQUEST_STATUS_UNUSED; // Handle button state transitions for off button if ( getOffButtonState() != prevOffButtonState ) @@ -354,17 +356,17 @@ CONFIRMATION_REQUEST_STATUS_TIMEOUT ); } - responceStatus = getConfirmationRequestStatus( GENERIC_CONFIRM_ID_POWER_OFF ); + responseStatus = getConfirmationRequestStatus( GENERIC_CONFIRM_ID_POWER_OFF ); - if ( CONFIRMATION_REQUEST_STATUS_REJECTED == responceStatus ) + if ( CONFIRMATION_REQUEST_STATUS_REJECTED == responseStatus ) { offRequestAwaitingUserConfirmation = FALSE; } - else if ( CONFIRMATION_REQUEST_STATUS_TIMEOUT == responceStatus ) + else if ( CONFIRMATION_REQUEST_STATUS_TIMEOUT == responseStatus ) { offRequestAwaitingUserConfirmation = FALSE; } - else if ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == responceStatus ) + else if ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == responseStatus ) { offRequestAwaitingUserConfirmation = FALSE; @@ -447,7 +449,7 @@ if ( getStopButtonState() == BUTTON_STATE_PRESSED ) { stopButtonPressPending = TRUE; - stopButtonPendingTimer = getMSTimerCount(); +// stopButtonPendingTimer = getMSTimerCount(); // Log stop button press SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_BUTTON, BUTTON_STOP, BUTTON_STATE_PRESSED ) } Index: firmware/App/Services/Messaging.c =================================================================== diff -u -rf99f8b365af2274d68d7f424cc9be9815b4db19c -re9f15ff59ac0350adcbe544df8b3451e15ee7287 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision f99f8b365af2274d68d7f424cc9be9815b4db19c) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision e9f15ff59ac0350adcbe544df8b3451e15ee7287) @@ -522,14 +522,16 @@ BOOL handleUIVersionResponse( MESSAGE_T *message ) { BOOL result = TRUE; + // Get UI version data and have it recorded if ( sizeof(UI_VERSIONS_T) == message->hdr.payloadLen ) { UI_VERSIONS_T uiVersion; - memcpy( &uiVersion, &message->payload[0], sizeof(UI_VERSIONS_T) ); + memcpy( &uiVersion, &message->payload[ 0 ], sizeof(UI_VERSIONS_T) ); signalUIVersion( uiVersion ); } + return result; } Index: firmware/App/Services/Messaging.h =================================================================== diff -u -rad2492d1c1b63ec2727e5a7a13c5b3a4f8021f86 -re9f15ff59ac0350adcbe544df8b3451e15ee7287 --- firmware/App/Services/Messaging.h (.../Messaging.h) (revision ad2492d1c1b63ec2727e5a7a13c5b3a4f8021f86) +++ firmware/App/Services/Messaging.h (.../Messaging.h) (revision e9f15ff59ac0350adcbe544df8b3451e15ee7287) @@ -51,13 +51,6 @@ U08 userRequest; ///< request to confirm, cancel, or reject off button request } UI_OFF_BUTTON_RESPONSE_PAYLOAD_T; -/// Payload record structure for off button response. -typedef struct -{ - U32 id; - U32 command; - U32 reason; -} UI_PAYLOAD_T; #pragma pack(pop) /// Payload record structure for UI response.