SITL: SIM_RichenPower sets MaintenanceRequired error flag
Turns out the generator does set this flag when the generator reaches its maintenance required state.
This commit is contained in:
parent
1934b4a738
commit
c496985e37
@ -198,11 +198,15 @@ void RichenPower::update_send()
|
||||
u.packet.runtime_seconds = runtime_seconds_remainder;
|
||||
|
||||
const int32_t seconds_until_maintenance = (original_seconds_until_maintenance - _runtime_ms/1000.0f);
|
||||
uint16_t errors = htobe16(u.packet.errors);
|
||||
if (seconds_until_maintenance <= 0) {
|
||||
u.packet.seconds_until_maintenance = htobe32(0);
|
||||
errors |= (1U<<(uint8_t(Errors::MaintenanceRequired)));
|
||||
} else {
|
||||
u.packet.seconds_until_maintenance = htobe32(seconds_until_maintenance);
|
||||
errors &= ~(1U<<(uint8_t(Errors::MaintenanceRequired)));
|
||||
}
|
||||
u.packet.errors = htobe16(errors);
|
||||
|
||||
switch (_state) {
|
||||
case State::IDLE:
|
||||
|
@ -96,6 +96,10 @@ private:
|
||||
|
||||
uint32_t last_rpm_update_ms;
|
||||
|
||||
enum class Errors {
|
||||
MaintenanceRequired = 0,
|
||||
};
|
||||
|
||||
// packet to send:
|
||||
struct PACKED RichenPacket {
|
||||
uint8_t magic1;
|
||||
|
Loading…
Reference in New Issue
Block a user