refactor(simu): use SDL & ImGui (#6233)

Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
Co-authored-by: Malte Langermann <malte@langermann.net>
This commit is contained in:
Raphael Coeffic
2025-07-20 11:30:05 +02:00
committed by GitHub
co-authored by raphaelcoeffic Malte Langermann
parent 14287cb91d
commit 4eddda034d
46 changed files with 2136 additions and 1577 deletions
+33 -16
View File
@@ -23,13 +23,15 @@
#include "hal/rgbleds.h"
#include "definitions.h"
#include "board.h"
bool usbChargerLed() { return true; }
void ledRed() {}
void ledGreen() {}
void ledBlue() {}
void ledOff() {}
bool fsLedState(uint8_t) { return false;}
void rgbSetLedColor(unsigned char, unsigned char, unsigned char, unsigned char) {}
void rgbSetLedColor(uint8_t, uint8_t, uint8_t, uint8_t) {}
void rgbLedColorApply() {}
uint8_t getRGBColorIndex(uint32_t color)
@@ -41,24 +43,39 @@ uint8_t getRGBColorIndex(uint32_t color)
return 0; // Custom value set with Companion
}
// RGB
#define WS2812_BYTES_PER_LED 3
#if NUM_FUNCTIONS_SWITCHES > 0
static uint32_t _fs_switch_colors[NUM_FUNCTIONS_SWITCHES] = {0};
static uint32_t _fs_switch_color_mask = 0;
static uint32_t _fs_switch_mask = 0;
// Maximum number of supported LEDs
#if !defined(WS2812_MAX_LEDS)
# define WS2812_MAX_LEDS 48
#endif
// Pixel values
static uint8_t _led_colors[WS2812_BYTES_PER_LED * WS2812_MAX_LEDS];
uint32_t rgbGetLedColor(uint8_t led)
void fsLedRGB(uint8_t index, uint32_t col)
{
uint8_t* pixel = &_led_colors[led * WS2812_BYTES_PER_LED];
return (pixel[1] << 16) + (pixel[0] << 8) + pixel[2];
_fs_switch_color_mask |= (1 << index);
_fs_switch_colors[index] = col;
}
uint32_t fsGetLedRGB(uint8_t index)
{
return rgbGetLedColor(index);
return _fs_switch_colors[index];
}
bool fsLedIsColorSet(uint8_t index)
{
return _fs_switch_color_mask & (1 << index);
}
bool fsLedState(uint8_t index)
{
return _fs_switch_mask & (1 << index);
}
void fsLedOn(uint8_t index)
{
_fs_switch_mask |= (1 << index);
}
void fsLedOff(uint8_t index)
{
_fs_switch_mask &= ~(1 << index);
}
#endif