feat: allow IMU inversion (#7505)

This commit is contained in:
3djc
2026-07-04 18:33:29 +10:00
committed by GitHub
parent c070ddda4b
commit 057883da83
20 changed files with 124 additions and 3 deletions
@@ -365,6 +365,7 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
if (Boards::getCapability(board, Board::HasIMU)) {
node["imuMax"] = rhs.imuMax;
node["imuOffset"] = rhs.imuOffset;
node["imuInvert"] = (rhs.imuInvertX ? 1 : 0) | (rhs.imuInvertY ? 2 : 0);
}
// OneBit sampling (X9D only?)
@@ -714,6 +715,10 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
node["imuMax"] >> rhs.imuMax;
node["imuOffset"] >> rhs.imuOffset;
int imuInvert = 0;
node["imuInvert"] >> imuInvert;
rhs.imuInvertX = imuInvert & 0x1;
rhs.imuInvertY = imuInvert & 0x2;
// OneBit sampling (X9D only?)
node["uartSampleMode"] >> rhs.uartSampleMode;
@@ -384,6 +384,8 @@ class GeneralSettings {
char registrationId[REGISTRATION_ID_LEN + 1];
int imuMax;
int imuOffset;
bool imuInvertX;
bool imuInvertY;
int uartSampleMode;
int pwrOnSpeed;