Compare commits

..

3 Commits

Author SHA1 Message Date
mathis_s d94341e1c0 Guard against race condition with targetReached
Test And Build / Lint (push) Failing after 4s
Test And Build / Build (push) Successful in 8s
2026-06-09 13:36:51 +02:00
mathis_s df7a15eeb2 Extended description of bit 2 in utils/decodeStatus.py 2026-06-09 13:24:32 +02:00
mathis_s 5165923595 Only print help in utils scripts if specifically requested (bugfix)
Test And Build / Lint (push) Failing after 4s
Test And Build / Build (push) Successful in 8s
2026-06-09 13:13:24 +02:00
3 changed files with 13 additions and 7 deletions
+10 -4
View File
@@ -532,9 +532,9 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
} else {
// If we wait for a handshake, but the motor was moving in its last poll
// cycle and has reached its target, it is not moving. Otherwise it is
// considered moving, even if we're still waiting for the handshake.
// If the motor hasn't moved after being enabled, we cannot trust
// targetReached. Hence, the targetReachedUninitialized flag guards
// against invalid detection of the "moving" status.
if (pMasterMacsA_->targetReachedUninitialized) {
*moving = false;
} else {
@@ -545,7 +545,13 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
}
}
if (targetReached()) {
// If the motor is not switched on, the targetReached bit is set to
// true. targetReachedUninitialized is set to true in the enable
// function, which is in a separate thread than doPoll. Therefore,
// doPoll can reset targetReachedUninitialized, which then can lead to
// a false "moving" status. Therefore, we only trust targetReached if
// the motor is switched on.
if (targetReached() && switchedOn()) {
pMasterMacsA_->targetReachedUninitialized = false;
}
}
+1 -1
View File
@@ -67,7 +67,7 @@ the next value can be typed in. Type 'quit' to close the prompt.
if __name__ == "__main__":
from sys import argv
if "-h" or "--help" in argv:
if "-h" in argv or "--help" in argv:
print(help)
if len(argv) == 1:
+2 -2
View File
@@ -18,7 +18,7 @@ from decodeCommon import interactive, decode, print_decoded
interpretation = [
("Not ready to be switched on", "Ready to be switched on"), # Bit 0
("Not switched on", "Switched on"), # Bit 1
("Disabled", "Enabled"), # Bit 2
("Operation disabled (no current)", "Operation enabled (current)"), # Bit 2
("Ok", "Fault condition set"), # Bit 3
("Motor supply voltage absent ", "Motor supply voltage present"), # Bit 4
("Motor performs quick stop", "Ok"), # Bit 5
@@ -68,7 +68,7 @@ the next value can be typed in. Type 'quit' to close the prompt.
if __name__ == "__main__":
from sys import argv
if "-h" or "--help" in argv:
if "-h" in argv or "--help" in argv:
print(help)
if len(argv) == 1: