Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r09e6cf9de34acf18f6e1138bf56ac0edb4821186 -rf1c099b79e0825afe54379577454518f7a134a73 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 09e6cf9de34acf18f6e1138bf56ac0edb4821186) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision f1c099b79e0825afe54379577454518f7a134a73) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2022 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file SystemComm.c * -* @author (last) Sean Nash -* @date (last) 12-Nov-2021 +* @author (last) Dara Navaei +* @date (last) 07-Dec-2021 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -23,7 +23,8 @@ #include "SystemComm.h" #include "Comm.h" -#include "Interrupts.h" +#include "Interrupts.h" +#include "OperationModes.h" #include "Timers.h" #include "Utilities.h" #include "SystemCommMessages.h" @@ -56,12 +57,13 @@ #define MAX_COMM_CRC_FAILURE_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< CRC error window #define MSG_NOT_ACKED_TIMEOUT_MS 150 ///< Maximum time for a Denali message that requires ACK to be ACK'd +#define MSG_NOT_ACKED_TIMEOUT_MS_INIT 5000 ///< Maximum time for a Denali message that requires ACK to be ACK'd on the INIT state for the first (UI version request) message of the POST #define MSG_NOT_ACKED_MAX_RETRIES 3 ///< Maximum number of times a message that requires ACK that was not ACK'd can be re-sent before alarm #define PENDING_ACK_LIST_SIZE 25 ///< Maximum number of Denali messages that can be pending ACK at any given time #pragma pack(push, 1) -/// Record for transmitted message that is pending acknowledgement from receiver. +/// Record for transmitted message that is pending acknowledgment from receiver. typedef struct { BOOL used; @@ -1046,8 +1048,13 @@ // Find expired messages pending ACK for ( i = 0; i < PENDING_ACK_LIST_SIZE; i++ ) - { // Pending ACK expired? - if ( ( TRUE == pendingAckList[ i ].used ) && ( TRUE == didTimeout( pendingAckList[ i ].timeStamp, MSG_NOT_ACKED_TIMEOUT_MS ) ) ) + { // Pending ACK expired? + U32 timeoutPeriod = MSG_NOT_ACKED_TIMEOUT_MS; // set the timeout as default + if ( MODE_INIT == getCurrentOperationMode() ) + { // change it to longer timeout if the HD is in INIT state + timeoutPeriod = MSG_NOT_ACKED_TIMEOUT_MS_INIT; + } + if ( ( TRUE == pendingAckList[ i ].used ) && ( TRUE == didTimeout( pendingAckList[ i ].timeStamp, timeoutPeriod ) ) ) { // If retries left, reset and resend pending message if ( pendingAckList[ i ].retries > 0 ) { // Re-queue message for transmit @@ -1156,7 +1163,7 @@ handleDGOpMode( message ); break; - case MSG_ID_DG_RESERVOIR_DATA: + case MSG_ID_DG_RESERVOIRS_DATA: handleDGReservoirData( message ); break;