feat(driver): autodetect IMU, add support for SC7U22 (#7191)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
raphaelcoeffic
Claude Opus 4.6
parent
5ea531d391
commit
0ce5c8f3f2
@@ -125,13 +125,13 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
y += FH;
|
||||
uint8_t x = INDENT_WIDTH;
|
||||
lcdDrawText(x, y, "X:");
|
||||
lcdDrawNumber(x+3*FW-1, y, gyro.outputs[0] * 180 / 1024);
|
||||
lcdDrawNumber(x+3*FW-1, y, gyroOutputs[0] * 180 / 1024);
|
||||
lcdDrawChar(lcdNextPos, y, CHAR_BW_DEGREE);
|
||||
lcdDrawNumber(x+10*FW-1, y, gyro.scaledX(), RIGHT);
|
||||
lcdDrawNumber(x+10*FW-1, y, gyroScaledX(), RIGHT);
|
||||
x = LCD_W/2 + INDENT_WIDTH;
|
||||
lcdDrawText(x, y, "Y:");
|
||||
lcdDrawNumber(x+3*FW-1, y, gyro.outputs[1] * 180 / 1024);
|
||||
lcdDrawNumber(x+3*FW-1, y, gyroOutputs[1] * 180 / 1024);
|
||||
lcdDrawChar(lcdNextPos, y, CHAR_BW_DEGREE);
|
||||
lcdDrawNumber(x+10*FW-1, y, gyro.scaledY(), RIGHT);
|
||||
lcdDrawNumber(x+10*FW-1, y, gyroScaledY(), RIGHT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ void menuRadioSetup(event_t event)
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.imuMax, IMU_MAX_DEFAULT - IMU_MAX_RANGE, IMU_MAX_DEFAULT + IMU_MAX_RANGE);
|
||||
lcdDrawText(lp, y, ")", RIGHT);
|
||||
lcdDrawNumber(lcdLastLeftPos, y, max(abs(gyro.outputs[0]), abs(gyro.outputs[1])) * 180 / 1024, RIGHT);
|
||||
lcdDrawNumber(lcdLastLeftPos, y, max(abs(gyroOutputs[0]), abs(gyroOutputs[1])) * 180 / 1024, RIGHT);
|
||||
lcdDrawText(lcdLastLeftPos, y, "(", RIGHT);
|
||||
}
|
||||
}
|
||||
@@ -499,7 +499,7 @@ void menuRadioSetup(event_t event)
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.imuOffset, IMU_OFFSET_MIN, IMU_OFFSET_MAX);
|
||||
lcdDrawText(lp, y, ")", RIGHT);
|
||||
lcdDrawNumber(lcdLastLeftPos, y, gyro.outputs[0] * 180 / 1024, RIGHT);
|
||||
lcdDrawNumber(lcdLastLeftPos, y, gyroOutputs[0] * 180 / 1024, RIGHT);
|
||||
lcdDrawText(lcdLastLeftPos, y, "(", RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,26 +124,37 @@ class AnaViewWindow : public Window
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(IMU_ICM4207C) && LANDSCAPE
|
||||
line = newLine(grid);
|
||||
lv_obj_set_style_pad_column(line->getLvObj(), PAD_SMALL, LV_PART_MAIN);
|
||||
#if defined(IMU) && LANDSCAPE
|
||||
if (imuGetName()) {
|
||||
line = newLine(grid);
|
||||
lv_obj_set_style_pad_column(line->getLvObj(), PAD_SMALL, LV_PART_MAIN);
|
||||
|
||||
grid.setColSpan(2);
|
||||
new StaticText(line, rect_t{}, "Tilt X");
|
||||
grid.setColSpan(1);
|
||||
new DynamicNumber<int16_t>(line, rect_t{},
|
||||
[=]() { return gyro.scaledX(); }, COLOR_THEME_PRIMARY1_INDEX, RIGHT);
|
||||
grid.setColSpan(2);
|
||||
new StaticText(line, rect_t{}, STR_GYRO);
|
||||
grid.setColSpan(3);
|
||||
new StaticText(line, rect_t{}, imuGetName());
|
||||
grid.setColSpan(1);
|
||||
|
||||
for (int i = 0; i < 3; i++) {grid.nextCell();}
|
||||
line = newLine(grid);
|
||||
lv_obj_set_style_pad_column(line->getLvObj(), PAD_SMALL, LV_PART_MAIN);
|
||||
|
||||
line = newLine(grid);
|
||||
lv_obj_set_style_pad_column(line->getLvObj(), PAD_SMALL, LV_PART_MAIN);
|
||||
grid.setColSpan(2);
|
||||
new StaticText(line, rect_t{}, "Tilt X");
|
||||
grid.setColSpan(1);
|
||||
new DynamicNumber<int16_t>(line, rect_t{},
|
||||
[=]() { return gyroScaledX(); }, COLOR_THEME_PRIMARY1_INDEX, RIGHT);
|
||||
|
||||
grid.setColSpan(2);
|
||||
new StaticText(line, rect_t{}, "Tilt Y");
|
||||
grid.setColSpan(1);
|
||||
new DynamicNumber<int16_t>(line, rect_t{},
|
||||
[=]() { return gyro.scaledY(); }, COLOR_THEME_PRIMARY1_INDEX, RIGHT);
|
||||
for (int i = 0; i < 3; i++) {grid.nextCell();}
|
||||
|
||||
line = newLine(grid);
|
||||
lv_obj_set_style_pad_column(line->getLvObj(), PAD_SMALL, LV_PART_MAIN);
|
||||
|
||||
grid.setColSpan(2);
|
||||
new StaticText(line, rect_t{}, "Tilt Y");
|
||||
grid.setColSpan(1);
|
||||
new DynamicNumber<int16_t>(line, rect_t{},
|
||||
[=]() { return gyroScaledY(); }, COLOR_THEME_PRIMARY1_INDEX, RIGHT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LUMINOSITY_SENSOR)
|
||||
|
||||
Reference in New Issue
Block a user