- First complete version of firmware. Currently being tested in the rehearsal room

- Added bunch of screens, fonts and images
 - Added script to read out frame buffer (function currently disabled in Firmware)
This commit is contained in:
2025-10-26 20:57:58 +01:00
parent 90bca063e6
commit 89c875e38f
62 changed files with 4668 additions and 489 deletions

View File

@@ -10,27 +10,37 @@
#include "../Screens.h"
#include "../UI_Control.h"
#include "../Command_Definition.h"
#include "../Display_Default_Configurations.h"
#include "../Display.h"
#include "../Display_Font.h"
#include "../Display_Objects.h"
#include "../Display_Default_Configurations.h"
#include "../INA260.h"
#include "../EEPROM_M24C64.h"
// ============================================================================================
// Defines
#define GRAPH_DATA_WDITH 200
#define COLOR_DARKGREEN DISPLAY_COLOR_FROM_RGB888(0, 100, 0)
// ============================================================================================
// Variables
extern const unsigned char _Font_DejaVu_Sans_Mono_6x12[];
extern const unsigned char _Font_DejaVu_Sans_Mono_10x17[];
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_7x15[];
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_11x17[];
static Object_ID _Object_Value_BusVoltage;
static Object_ID _Object_Value_Current;
static uint16_t _Data_BusVoltage[GRAPH_DATA_WDITH];
static uint16_t _Data_BusVoltage_Threshold_Overvoltage[GRAPH_DATA_WDITH];
static uint16_t _Data_BusVoltage_Threshold_Undervoltage[GRAPH_DATA_WDITH];
static float _Current_BusVoltage_V;
static uint16_t _Data_Current[GRAPH_DATA_WDITH];
static uint16_t _Data_Threshold_Current[GRAPH_DATA_WDITH];
static float _Actual_BusVoltage_V;
static float _Actual_Current_A;
// ============================================================================================
@@ -58,8 +68,8 @@ void Screen_Setup_Graph(Screen_Transition_Direction direction_out, Screen_Transi
for(int i=0;i<GRAPH_DATA_WDITH;i++) {
_Data_BusVoltage[i] = 0;
_Data_BusVoltage_Threshold_Overvoltage[i] = THRESHOLD_OVERVOLTAGE_mV;
_Data_BusVoltage_Threshold_Undervoltage[i] = THRESHOLD_UNDERVOLTAGE_mV;
_Data_Current[i] = 0;
_Data_Threshold_Current[i] = _EEPROM_Content.Device_Configuration.Current_Threshold * 5; // 5x, due to 4x 1.25mA
}
}
@@ -82,23 +92,59 @@ void Screen_Init(Screen_Transition_Direction direction_out, Screen_Transition_Di
//////////////////////////////
// Add Display Objects here //
//////////////////////////////
char Current_Threshold[10];
Display_Font_Set_Font(_Font_DejaVu_Sans_Mono_6x12);
int16_t Font_6_1_Height = Display_Font_Get_Font_Height();
sprintf(Current_Threshold, "%.3fA", (float)(_EEPROM_Content.Device_Configuration.Current_Threshold * 5) / 1000.0f);
int16_t Current_Threshold_Label_Y = DISPLAY_Y_CENTER + 100 - _EEPROM_Content.Device_Configuration.Current_Threshold * 5 / 25;
if((Current_Threshold_Label_Y <= (149 + Font_6_1_Height)) && (Current_Threshold_Label_Y >= 149)) {
Current_Threshold_Label_Y += (Font_6_1_Height + 1);
}
else if((Current_Threshold_Label_Y <= 149) && (Current_Threshold_Label_Y >= 141)) {
Current_Threshold_Label_Y = 141;
}
Font_ID Font_6_1 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_6x12, 1);
Font_ID Font_10_1 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_10x17, 1);
Font_ID Font_7_1_B = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_Bold_7x15, 1);
Font_ID Font_11_1_B = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_Bold_11x17, 1);
Display_Objects_Add_Graph(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, false, _Data_BusVoltage, GRAPH_DATA_WDITH, 32000, 0, DISPLAY_COLOR_WHITE, 200, NO_STYLE, NO_ANIMATION);
Display_Objects_Add_Graph(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, false, _Data_BusVoltage_Threshold_Overvoltage, GRAPH_DATA_WDITH, 32000, 0, DISPLAY_COLOR_RED, 200, NO_STYLE, NO_ANIMATION);
Display_Objects_Add_Graph(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, false, _Data_BusVoltage_Threshold_Undervoltage, GRAPH_DATA_WDITH, 32000, 0, DISPLAY_COLOR_RED, 200, NO_STYLE, NO_ANIMATION);
// Threshold Lines / Areas
Display_Objects_Add_Rectangle_Frame(CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, 141, NOT_SELECTABLE, COLOR_DARKGREEN, GRAPH_DATA_WDITH+2, 8, 1, NO_STYLE, NO_ANIMATION);
Display_Objects_Add_Graph(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, false, _Data_Threshold_Current, GRAPH_DATA_WDITH, 5000, 0, DISPLAY_COLOR_ORANGE, 200, NO_STYLE, NO_ANIMATION);
Display_Objects_Add_Float(CENTER_MIDDLE, X_IN_PERCENT_Y_IN_PIXEL, 50, 232, NOT_SELECTABLE, &_Current_BusVoltage_V, "%2.3fV", Font_10_1, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
// Threshold Labels
Display_Objects_Add_Text(LEFT_BOTTOM, BOTH_IN_PIXEL, 19, 140, NOT_SELECTABLE, "12.5V", Font_6_1, COLOR_DARKGREEN, NO_STYLE, NO_ANIMATION);
Display_Objects_Add_Text(LEFT_TOP , BOTH_IN_PIXEL, 19, 149, NOT_SELECTABLE, "11.5V", Font_6_1, COLOR_DARKGREEN, NO_STYLE, NO_ANIMATION);
Display_Objects_Add_Text(CENTER_BOTTOM, X_IN_PERCENT_Y_IN_PIXEL, 50, Current_Threshold_Label_Y, NOT_SELECTABLE, Current_Threshold, Font_6_1, DISPLAY_COLOR_ORANGE, NO_STYLE, NO_ANIMATION);
// Data Graphs (Voltage and Current)
Display_Objects_Add_Graph(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, false, _Data_BusVoltage, GRAPH_DATA_WDITH, 32000, 0, DISPLAY_COLOR_RED, 200, NO_STYLE, NO_ANIMATION);
Display_Objects_Add_Graph(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, false, _Data_Current, GRAPH_DATA_WDITH, 5000, 0, DISPLAY_COLOR_YELLOW, 200, NO_STYLE, NO_ANIMATION);
// Data Values (Voltage and Current)
_Object_Value_BusVoltage = Display_Objects_Add_Float(RIGHT_MIDDLE, X_IN_PERCENT_Y_IN_PIXEL, 48, 50, NOT_SELECTABLE, &_Actual_BusVoltage_V, "%2.1fV", Font_11_1_B, DISPLAY_COLOR_WHITE, NO_STYLE, NO_ANIMATION);
_Object_Value_Current = Display_Objects_Add_Float(LEFT_MIDDLE, X_IN_PERCENT_Y_IN_PIXEL, 52, 50, NOT_SELECTABLE, &_Actual_Current_A, "%1.3fA", Font_11_1_B, DISPLAY_COLOR_YELLOW, NO_STYLE, NO_ANIMATION);
}
void Screen_Tick(void)
{
for(int i=0;i<GRAPH_DATA_WDITH-1;i++) {
Display_Objects_Update_Coordinates(_Object_Value_BusVoltage, RIGHT_MIDDLE, X_IN_PERCENT_Y_IN_PIXEL, 48, 50);
Display_Objects_Update_Coordinates(_Object_Value_Current, LEFT_MIDDLE, X_IN_PERCENT_Y_IN_PIXEL, 52, 50);
for(int i=0;i<GRAPH_DATA_WDITH-1;i++) {
_Data_BusVoltage[i] = _Data_BusVoltage[i+1];
_Data_Current[i] = _Data_Current[i+1];
}
_Data_BusVoltage[GRAPH_DATA_WDITH-1] = INA260_Get_BusVoltage_mV();
_Current_BusVoltage_V = ((float)_Data_BusVoltage[GRAPH_DATA_WDITH-1]) / 1000.0f;
_Actual_BusVoltage_V = ((float)_Data_BusVoltage[GRAPH_DATA_WDITH-1]) / 1000.0f;
_Data_Current[GRAPH_DATA_WDITH-1] = INA260_Get_Current_mA();
_Actual_Current_A = ((float)_Data_Current[GRAPH_DATA_WDITH-1]) / 1000.0f;
}
void Screen_Click(uint button_return_value)