Make simulator read RC through real drone code

This commit is contained in:
Oleg Kalachev 2024-01-06 00:09:29 +03:00
parent 476f24f774
commit 48ea797a47
3 changed files with 5 additions and 4 deletions

View File

@ -9,5 +9,8 @@ class SBUS {
public:
SBUS(HardwareSerial& bus) {};
void begin() {};
bool read(int16_t* channels, bool* failsafe, bool* lostFrame) { joystickGet(); return true; }; // NOTE: on the hardware channels is uint16_t
bool read(int16_t* channels, bool* failsafe, bool* lostFrame) { // NOTE: on the hardware channels is uint16_t
joystickGet();
return true;
};
};

View File

@ -54,6 +54,4 @@ void joystickGet() {
}
channels[RC_CHANNEL_MODE] = SDL_JoystickGetButton(joystick, 0) ? 1 : 0;
controls[RC_CHANNEL_MODE] = channels[RC_CHANNEL_MODE];
normalizeRC();
}

View File

@ -67,7 +67,7 @@ public:
acc = this->accFilter.update(flu2frd(imu->LinearAcceleration()));
// read rc
joystickGet();
readRC();
controls[RC_CHANNEL_MODE] = 1; // 0 acro, 1 stab
controls[RC_CHANNEL_AUX] = 1; // armed