Skip to content

Commit

Permalink
Bugfix and refactor for EXRAIL getSignalSlot
Browse files Browse the repository at this point in the history
  • Loading branch information
pmantoine committed May 7, 2024
1 parent 1449dc7 commit a610e83
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
30 changes: 18 additions & 12 deletions EXRAIL2.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* © 2024 Paul M. Antoine
* © 2021 Neil McKechnie
* © 2021-2023 Harald Barth
* © 2020-2023 Chris Harlow
Expand Down Expand Up @@ -1143,20 +1144,25 @@ void RMFT2::kill(const FSH * reason, int operand) {
}

int16_t RMFT2::getSignalSlot(int16_t id) {
for (int sigslot=0;;sigslot++) {
int16_t sighandle=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigslot*8);
if (sighandle==0) { // end of signal list
DIAG(F("EXRAIL Signal %d not defined"), id);
return -1;
}
VPIN sigid = sighandle & SIGNAL_ID_MASK;

if (id > 0) {
int sigslot = 0;
int16_t sighandle = 0;
// Trundle down the signal list until we reach the end
while ((sighandle = GETHIGHFLASHW(RMFT2::SignalDefinitions, sigslot * 8)) != 0)
{
// sigid is the signal id used in RED/AMBER/GREEN macro
// for a LED signal it will be same as redpin
// but for a servo signal it will also have SERVO_SIGNAL_FLAG set.

if (sigid != id) continue; // keep looking
return sigslot; // relative slot in signals table
}
// but for a servo signal it will also have SERVO_SIGNAL_FLAG set.
VPIN sigid = sighandle & SIGNAL_ID_MASK;
if (sigid == (VPIN)id)
return sigslot; // found it
sigslot++; // keep looking
};
}
// We did not find the signal
DIAG(F("EXRAIL Signal %d not defined"), id);
return -1;
}

/* static */ void RMFT2::doSignal(int16_t id,char rag) {
Expand Down
3 changes: 2 additions & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

#include "StringFormatter.h"

#define VERSION "5.2.55"
#define VERSION "5.2.56"
// 5.2.56 - Bugfix and refactor for EXRAIL getSignalSlot
// 5.2.55 - Move EXRAIL isSignal() to public to allow use in STEALTH call
// 5.2.54 - Bugfix for EXRAIL signal handling for active high
// 5.2.53 - Bugfix for EX-Fastclock, call I2CManager.begin() before checking I2C address
Expand Down

0 comments on commit a610e83

Please sign in to comment.