mmu: add ResetCommunicationTimeoutAttempts

Adding __attribute__((noinline)) saves 14 bytes of flash

Change in memory:
Flash: +34 bytes
SRAM: 0 bytes
This commit is contained in:
Guðni Már Gilbert 2023-10-18 23:25:17 +00:00
parent ef33db9a71
commit 7b9e707709
3 changed files with 10 additions and 3 deletions

View File

@ -63,8 +63,8 @@ void MMU2::Start() {
// start the communication
logic.Start();
logic.ResetRetryAttempts();
logic.ResetCommunicationTimeoutAttempts();
}
void MMU2::Stop() {

View File

@ -256,7 +256,7 @@ StepStatus ProtocolLogic::ProcessVersionResponse(uint8_t stage) {
SendVersion(stage);
}
} else {
dataTO.Reset(); // got a meaningful response from the MMU, stop data layer timeout tracking
ResetCommunicationTimeoutAttempts(); // got a meaningful response from the MMU, stop data layer timeout tracking
SendVersion(stage + 1);
}
}
@ -774,7 +774,7 @@ void ProtocolLogic::LogResponse() {
StepStatus ProtocolLogic::SuppressShortDropOuts(const char *msg_P, StepStatus ss) {
if (dataTO.Record(ss)) {
LogError(msg_P);
dataTO.Reset(); // prepare for another run of consecutive retries before firing an error
ResetCommunicationTimeoutAttempts(); // prepare for another run of consecutive retries before firing an error
return dataTO.InitialCause();
} else {
return Processing; // suppress short drop outs of communication
@ -865,6 +865,11 @@ void ProtocolLogic::ResetRetryAttempts() {
retryAttempts = MAX_RETRIES;
}
void __attribute__((noinline)) ProtocolLogic::ResetCommunicationTimeoutAttempts() {
SERIAL_ECHOLNPGM("RSTCommTimeout");
dataTO.Reset();
}
bool DropOutFilter::Record(StepStatus ss) {
if (occurrences == maxOccurrences) {
cause = ss;

View File

@ -186,6 +186,8 @@ public:
/// Reset the retryAttempts back to the default value
void ResetRetryAttempts();
void ResetCommunicationTimeoutAttempts();
constexpr bool InAutoRetry() const { return inAutoRetry; }
void SetInAutoRetry(bool iar) {
inAutoRetry = iar;