Skip to content

Commit

Permalink
Clear servo alarms at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrGri committed Aug 2, 2024
1 parent 2dc60c0 commit fcde7c4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions ESP32/include/isv57communication.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class isv57communication {
void readServoStates();
bool checkCommunication();
bool findServosSlaveId();
bool clearServoAlarms();



Expand Down
3 changes: 3 additions & 0 deletions ESP32/src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ void setup()
ESP.restart();
}

// reset iSV57 alarms
bool servoAlarmsCleared = isv57.clearServoAlarms();
delay(500);

Serial.print("iSV57 communication state: ");
Serial.println(isv57LifeSignal_b);
Expand Down
15 changes: 15 additions & 0 deletions ESP32/src/isv57communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,18 @@ void isv57communication::readServoStates() {
}

}



bool isv57communication::clearServoAlarms() {

// read the alarm list
int8_t numberOfRegistersToRead_u8 = 0;
// Alarm register address: 0x02
//int bytesReceived_i = modbus.requestFrom(slaveId, 0x03, 0x02, numberOfRegistersToRead_u8);

// clear alarm list
modbus.holdingRegisterWrite(slaveId, 0x019a, 0x7777);

return 1;
}

0 comments on commit fcde7c4

Please sign in to comment.