add menu type
This commit is contained in:
parent
c06794458c
commit
84827216c1
@ -21,7 +21,8 @@ static Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||
// ===== Main Display =====
|
||||
|
||||
static int currentStage = 0;
|
||||
static int totalStages = 0;
|
||||
static int totalStages = 5;
|
||||
static bool systemReady = false;
|
||||
|
||||
static void drawHeader() {
|
||||
// Заголовок (инверсия)
|
||||
@ -31,8 +32,8 @@ static void drawHeader() {
|
||||
display.setTextSize(1);
|
||||
display.print(ROBOT_NAME);
|
||||
|
||||
// Этапы (правый угол)
|
||||
if (totalStages > 0) {
|
||||
// Этапы (правый угол) - только если система не готова
|
||||
if (!systemReady && totalStages > 0) {
|
||||
char stageStr[8];
|
||||
snprintf(stageStr, sizeof(stageStr), "%d/%d", currentStage, totalStages);
|
||||
int textWidth = strlen(stageStr) * 6; // ~6px на символ
|
||||
@ -42,24 +43,39 @@ static void drawHeader() {
|
||||
}
|
||||
|
||||
static void drawFooter() {
|
||||
// Нижняя строка (резерв под кнопки)
|
||||
// Нижняя строка (разделитель)
|
||||
// display.drawLine(0, SCREEN_HEIGHT - 12, SCREEN_WIDTH, SCREEN_HEIGHT - 12, SSD1306_WHITE);
|
||||
|
||||
// Версия (правый угол)
|
||||
display.setTextColor(SSD1306_WHITE);
|
||||
display.setCursor(0, SCREEN_HEIGHT - 10);
|
||||
display.setTextSize(1);
|
||||
|
||||
if (systemReady) {
|
||||
// Кнопка Menu (правый угол)
|
||||
const char* menuBtn = "[MENU]";
|
||||
int textWidth = strlen(menuBtn) * 6;
|
||||
display.setCursor(SCREEN_WIDTH - textWidth - 2, SCREEN_HEIGHT - 10);
|
||||
display.print(menuBtn);
|
||||
} else {
|
||||
// Версия (правый угол)
|
||||
int textWidth = strlen(FIRMWARE_VERSION) * 6;
|
||||
display.setCursor(SCREEN_WIDTH - textWidth - 2, SCREEN_HEIGHT - 10);
|
||||
display.print(FIRMWARE_VERSION);
|
||||
}
|
||||
}
|
||||
|
||||
void oledSetStage(int current, int total) {
|
||||
currentStage = current;
|
||||
totalStages = total;
|
||||
}
|
||||
|
||||
void oledSetSystemReady(bool ready) {
|
||||
systemReady = ready;
|
||||
}
|
||||
|
||||
bool oledIsSystemReady() {
|
||||
return systemReady;
|
||||
}
|
||||
|
||||
void oledShowMain(const char* line1, const char* line2, const char* line3, const char* line4) {
|
||||
display.clearDisplay();
|
||||
|
||||
|
||||
@ -16,3 +16,7 @@ void oledShowCalibration();
|
||||
// основная отрисовка
|
||||
void oledSetStage(int current, int total);
|
||||
void oledShowMain(const char* line1, const char* line2, const char* line3, const char* line4);
|
||||
|
||||
// состояние системы
|
||||
void oledSetSystemReady(bool ready);
|
||||
bool oledIsSystemReady();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user