Show true raw input value on radio analogs diagnose screen for FlySky hall gimbals (signed short).

This commit is contained in:
rotorman
2021-09-13 14:42:02 +02:00
committed by Raphael Coeffic
parent 3b937387d8
commit 4af5adecef
3 changed files with 180 additions and 123 deletions
+38 -4
View File
@@ -26,6 +26,10 @@
#include "imu_lsm6ds33.h"
#endif
#if defined (FLYSKY_HALL_STICKS) || defined (FLYSKY_HALL_STICKS_REVERSE)
#include "flyskyHallStick_driver.h"
#endif
constexpr coord_t ANA_OFFSET = 150;
class RadioAnalogsDiagsWindow: public Window {
@@ -43,19 +47,49 @@ class RadioAnalogsDiagsWindow: public Window {
void paint(BitmapBuffer * dc) override
{
#if defined (FLYSKY_HALL_STICKS) || defined (FLYSKY_HALL_STICKS_REVERSE)
for (uint8_t i = 0; i < FLYSKY_HALL_CHANNEL_COUNT; i++) {
#if LCD_W > LCD_H
coord_t y = 1 + (i / 2) * FH;
uint8_t x = i & 1 ? LCD_W / 2 + 10 : 10;
#else
coord_t y = 1 + i * FH;
uint8_t x = 10;
#endif
dc->drawNumber(x, y, i + 1, LEADING0 | LEFT, 2);
dc->drawText(x + 2 * 15 - 2, y, ":");
drawHexNumber(dc, x + 3 * 15 - 1, y, hall_raw_values[i]);
dc->drawNumber(x + ANA_OFFSET, y, hall_raw_values[i], RIGHT);
}
for (uint8_t i = FLYSKY_HALL_CHANNEL_COUNT; i < NUM_STICKS + NUM_POTS + NUM_SLIDERS; i++) {
#if LCD_W > LCD_H
coord_t y = 1 + (i / 2) * FH;
uint8_t x = i & 1 ? LCD_W / 2 + 10 : 10;
#else
coord_t y = 1 + i * FH;
uint8_t x = 10;
#endif
dc->drawNumber(x, y, i + 1, LEADING0 | LEFT, 2);
dc->drawText(x + 2 * 15 - 2, y, ":");
drawHexNumber(dc, x + 3 * 15 - 1, y, anaIn(i));
dc->drawNumber(x + ANA_OFFSET, y, (int16_t) calibratedAnalogs[CONVERT_MODE(i)] * 25 / 256, RIGHT);
}
#else
for (uint8_t i = 0; i < NUM_STICKS + NUM_POTS + NUM_SLIDERS; i++) {
#if LCD_W > LCD_H
coord_t y = 1 + (i / 2) * FH;
uint8_t x = i & 1 ? LCD_W / 2 + 10 : 10;
coord_t y = 1 + (i / 2) * FH;
uint8_t x = i & 1 ? LCD_W / 2 + 10 : 10;
#else
coord_t y = 1 + i * FH;
uint8_t x = 10;
coord_t y = 1 + i * FH;
uint8_t x = 10;
#endif
dc->drawNumber(x, y, i + 1, LEADING0 | LEFT, 2);
dc->drawText(x + 2 * 15 - 2, y, ":");
drawHexNumber(dc, x + 3 * 15 - 1, y, anaIn(i));
dc->drawNumber(x + ANA_OFFSET, y, (int16_t) calibratedAnalogs[CONVERT_MODE(i)] * 25 / 256, RIGHT);
}
#endif
#if !defined(SIMU) && defined(IMU_LSM6DS33)
coord_t yimu = MENU_CONTENT_TOP + 3 * FH;