Reverting UITask.h changes

This commit is contained in:
hank
2025-06-01 20:45:18 -07:00
parent 33d5f85556
commit 884d8f1a98

View File

@@ -1,43 +1,52 @@
#pragma once
#include <MeshCore.h>
#include <helpers/ui/DisplayDriver.h>
#include <stddef.h>
#ifdef PIN_BUZZER
#include <helpers/ui/buzzer.h>
#include <helpers/ui/buzzer.h>
#endif
#include "Button.h"
#include "NodePrefs.h"
#include "Button.h"
enum class UIEventType { none, contactMessage, channelMessage, roomMessage, newContactMessage, ack };
enum class UIEventType
{
none,
contactMessage,
channelMessage,
roomMessage,
newContactMessage,
ack
};
class UITask {
DisplayDriver *_display;
mesh::MainBoard *_board;
DisplayDriver* _display;
mesh::MainBoard* _board;
#ifdef PIN_BUZZER
genericBuzzer buzzer;
#endif
unsigned long _next_refresh, _auto_off;
bool _connected;
uint32_t _pin_code;
NodePrefs *_node_prefs;
NodePrefs* _node_prefs;
char _version_info[32];
char _origin[62];
char _msg[80];
int _msgcount;
bool _need_refresh = true;
bool _displayWasOn = false; // Track display state before button press
bool _displayWasOn = false; // Track display state before button press
// Button handlers
#if defined(PIN_USER_BTN) || defined(PIN_USER_BTN_ANA)
Button *_userButton = nullptr;
Button* _userButton = nullptr;
#endif
void renderCurrScreen();
void userLedHandler();
void renderBatteryIndicator(uint16_t batteryMilliVolts);
// Button action handlers
void handleButtonAnyPress();
void handleButtonShortPress();
@@ -45,21 +54,21 @@ class UITask {
void handleButtonTriplePress();
void handleButtonLongPress();
public:
UITask(mesh::MainBoard *board) : _board(board), _display(NULL)
{
_next_refresh = 0;
_connected = false;
UITask(mesh::MainBoard* board) : _board(board), _display(NULL) {
_next_refresh = 0;
_connected = false;
}
void begin(DisplayDriver *display, NodePrefs *node_prefs, const char *build_date,
const char *firmware_version, uint32_t pin_code);
void begin(DisplayDriver* display, NodePrefs* node_prefs, const char* build_date, const char* firmware_version, uint32_t pin_code);
void setHasConnection(bool connected) { _connected = connected; }
bool hasDisplay() const { return _display != NULL; }
void clearMsgPreview();
void msgRead(int msgcount);
void newMsg(uint8_t path_len, const char *from_name, const char *text, int msgcount);
void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount);
void soundBuzzer(UIEventType bet = UIEventType::none);
void shutdown(bool restart = false);
void loop();
};
};