mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-27 02:04:00 -04:00
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;
|
u.packet.runtime_seconds = runtime_seconds_remainder;
|
||||||
|
|
||||||
const int32_t seconds_until_maintenance = (original_seconds_until_maintenance - _runtime_ms/1000.0f);
|
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) {
|
if (seconds_until_maintenance <= 0) {
|
||||||
u.packet.seconds_until_maintenance = htobe32(0);
|
u.packet.seconds_until_maintenance = htobe32(0);
|
||||||
|
errors |= (1U<<(uint8_t(Errors::MaintenanceRequired)));
|
||||||
} else {
|
} else {
|
||||||
u.packet.seconds_until_maintenance = htobe32(seconds_until_maintenance);
|
u.packet.seconds_until_maintenance = htobe32(seconds_until_maintenance);
|
||||||
|
errors &= ~(1U<<(uint8_t(Errors::MaintenanceRequired)));
|
||||||
}
|
}
|
||||||
|
u.packet.errors = htobe16(errors);
|
||||||
|
|
||||||
switch (_state) {
|
switch (_state) {
|
||||||
case State::IDLE:
|
case State::IDLE:
|
||||||
|
@ -96,6 +96,10 @@ private:
|
|||||||
|
|
||||||
uint32_t last_rpm_update_ms;
|
uint32_t last_rpm_update_ms;
|
||||||
|
|
||||||
|
enum class Errors {
|
||||||
|
MaintenanceRequired = 0,
|
||||||
|
};
|
||||||
|
|
||||||
// packet to send:
|
// packet to send:
|
||||||
struct PACKED RichenPacket {
|
struct PACKED RichenPacket {
|
||||||
uint8_t magic1;
|
uint8_t magic1;
|
||||||
|
Loading…
Reference in New Issue
Block a user