From 1c5f299b0e225e36c799dcc08c6bbb08c97f4adb Mon Sep 17 00:00:00 2001 From: Asbelos Date: Fri, 10 Nov 2023 23:28:41 +0000 Subject: [PATCH 1/3] Fix ESP32 cast issue --- EXRAIL2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 6a9ee40..9efd98b 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -332,7 +332,7 @@ void RMFT2::setTurntableHiddenState(Turntable * tto) { char RMFT2::getRouteType(int16_t id) { int16_t progCounter=routeLookup->find(id); if (progCounter>=0) { - OPCODE type=GET_OPCODE; + byte type=GET_OPCODE; if (type==OPCODE_ROUTE) return 'R'; if (type==OPCODE_AUTOMATION) return 'A'; } From 6c18226cb592f3244cc314d2a7d4ae280c4d2475 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Fri, 10 Nov 2023 23:46:17 +0000 Subject: [PATCH 2/3] Fix non-exrail crash --- MotorDriver.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MotorDriver.cpp b/MotorDriver.cpp index 61e229f..af322b8 100644 --- a/MotorDriver.cpp +++ b/MotorDriver.cpp @@ -676,8 +676,10 @@ void MotorDriver::checkPowerOverload(bool useProgLimit, byte trackno) { power_sample_overload_wait *= 2; if (power_sample_overload_wait > POWER_SAMPLE_RETRY_MAX) power_sample_overload_wait = POWER_SAMPLE_RETRY_MAX; + #ifdef EXRAIL_ACTIVE DIAG(F("Calling EXRAIL")); RMFT2::powerEvent(trackno, true); // Tell EXRAIL we have an overload + #endif // power on test DIAG(F("TRACK %c POWER RESTORE (after %4M)"), trackno + 'A', mslpc); setPower(POWERMODE::ALERT); From d877fc315ee1ddaedaf463ae883041974f63d36f Mon Sep 17 00:00:00 2001 From: Asbelos Date: Fri, 10 Nov 2023 23:56:41 +0000 Subject: [PATCH 3/3] Fix non-routestate code eliminator --- EXRAIL2Parser.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/EXRAIL2Parser.cpp b/EXRAIL2Parser.cpp index 7670118..7b241d0 100644 --- a/EXRAIL2Parser.cpp +++ b/EXRAIL2Parser.cpp @@ -122,7 +122,7 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16 case 'J': // throttle info commands // This entire code block is compiled out if FEATURE_ROUTESTATE macros not used - if (paramCount<1 || !(compileFeatures & FEATURE_ROUTESTATE)) return; + if (paramCount<1) return; switch(p[0]) case HASH_KEYWORD_A: // returns automations/routes if (paramCount==1) {// @@ -136,14 +136,16 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16 uint16_t id=p[1]; StringFormatter::send(stream,F("\n"), id, getRouteType(id), getRouteDescription(id)); - - // Send any non-default button states or captions - int16_t statePos=routeLookup->findPosition(id); - if (statePos>=0) { - if (routeStateArray[statePos]) - StringFormatter::send(stream,F("\n"), id, routeStateArray[statePos]); - if (routeCaptionArray[statePos]) - StringFormatter::send(stream,F("\n"), id,routeCaptionArray[statePos]); + + if (compileFeatures & FEATURE_ROUTESTATE) { + // Send any non-default button states or captions + int16_t statePos=routeLookup->findPosition(id); + if (statePos>=0) { + if (routeStateArray[statePos]) + StringFormatter::send(stream,F("\n"), id, routeStateArray[statePos]); + if (routeCaptionArray[statePos]) + StringFormatter::send(stream,F("\n"), id,routeCaptionArray[statePos]); + } } opcode=0; return;