Skip to content

Commit

Permalink
Use SH-2 error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
pembem22 committed Jan 20, 2025
1 parent a1b55a5 commit 1c2680e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/network/packets.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,14 @@
#define PACKET_INSPECTION_DATATYPE_INT 1
#define PACKET_INSPECTION_DATATYPE_FLOAT 2

// From the SH-2 interface that BNO08x use.
enum class PacketErrorCode : uint8_t {
SENSOR_TIMEOUT = 1,
NOT_APPLICABLE = 0,
POWER_ON_RESET = 1,
INTERNAL_SYSTEM_RESET = 2,
WATCHDOG_TIMEOUT = 3,
EXTERNAL_RESET = 4,
OTHER = 5,
};

#endif // SLIMEVR_PACKETS_H_
2 changes: 1 addition & 1 deletion src/sensors/icm20948sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ void ICM20948Sensor::checkSensorTimeout() {
);
networkConnection.sendSensorError(
this->sensorId,
static_cast<uint8_t>(PacketErrorCode::SENSOR_TIMEOUT)
static_cast<uint8_t>(PacketErrorCode::WATCHDOG_TIMEOUT)
);
lastData = currenttime;
}
Expand Down
2 changes: 1 addition & 1 deletion src/sensors/softfusion/softfusionsensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class SoftFusionSensor : public Sensor {
);
networkConnection.sendSensorError(
this->sensorId,
static_cast<uint8_t>(PacketErrorCode::SENSOR_TIMEOUT)
static_cast<uint8_t>(PacketErrorCode::WATCHDOG_TIMEOUT)
);
}

Expand Down

0 comments on commit 1c2680e

Please sign in to comment.