mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-25 18:46:45 +00:00
Fix formatting and trunk issues
This commit is contained in:
parent
479c1f5346
commit
c11680fcc0
1
.github/workflows/main_matrix.yml
vendored
1
.github/workflows/main_matrix.yml
vendored
@ -270,7 +270,6 @@ jobs:
|
|||||||
push: false
|
push: false
|
||||||
|
|
||||||
gather-artifacts:
|
gather-artifacts:
|
||||||
if: github.repository == 'meshtastic/firmware'
|
|
||||||
# trunk-ignore(checkov/CKV2_GHA_1)
|
# trunk-ignore(checkov/CKV2_GHA_1)
|
||||||
if: github.repository == 'meshtastic/firmware'
|
if: github.repository == 'meshtastic/firmware'
|
||||||
permissions:
|
permissions:
|
||||||
|
@ -956,7 +956,7 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
if (!hiddenFrames.clock) {
|
if (!hiddenFrames.clock) {
|
||||||
if (!hiddenFrames.clock) {
|
if (!hiddenFrames.clock) {
|
||||||
fsi.positions.clock = numframes;
|
fsi.positions.clock = numframes;
|
||||||
#if defined(M5STACK_UNITC6L)
|
#if defined(M5STACK_UNITC6L)
|
||||||
normalFrames[numframes++] = graphics::ClockRenderer::drawAnalogClockFrame;
|
normalFrames[numframes++] = graphics::ClockRenderer::drawAnalogClockFrame;
|
||||||
#else
|
#else
|
||||||
normalFrames[numframes++] = uiconfig.is_clockface_analog ? graphics::ClockRenderer::drawAnalogClockFrame
|
normalFrames[numframes++] = uiconfig.is_clockface_analog ? graphics::ClockRenderer::drawAnalogClockFrame
|
||||||
@ -1116,7 +1116,8 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
ui->disableAllIndicators();
|
ui->disableAllIndicators();
|
||||||
|
|
||||||
// Add overlays: frame icons and alert banner)
|
// Add overlays: frame icons and alert banner)
|
||||||
static OverlayCallback overlays[] = {graphics::UIRenderer::drawNavigationBar, NotificationRenderer::drawBannercallback};
|
static OverlayCallback overlays[] = {graphics::UIRenderer::drawNavigationBar,
|
||||||
|
NotificationRenderer::drawBannercallback};
|
||||||
ui->setOverlays(overlays, sizeof(overlays) / sizeof(overlays[0]));
|
ui->setOverlays(overlays, sizeof(overlays) / sizeof(overlays[0]));
|
||||||
|
|
||||||
prevFrame = -1; // Force drawNodeInfo to pick a new node (because our list just changed)
|
prevFrame = -1; // Force drawNodeInfo to pick a new node (because our list just changed)
|
||||||
@ -1163,17 +1164,17 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
this->framesetInfo = fsi;
|
this->framesetInfo = fsi;
|
||||||
|
|
||||||
setFastFramerate(); // Draw ASAP
|
setFastFramerate(); // Draw ASAP
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::setFrameImmediateDraw(FrameCallback *drawFrames)
|
void Screen::setFrameImmediateDraw(FrameCallback * drawFrames)
|
||||||
{
|
{
|
||||||
ui->disableAllIndicators();
|
ui->disableAllIndicators();
|
||||||
ui->setFrames(drawFrames, 1);
|
ui->setFrames(drawFrames, 1);
|
||||||
setFastFramerate();
|
setFastFramerate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::toggleFrameVisibility(const std::string &frameName)
|
void Screen::toggleFrameVisibility(const std::string &frameName)
|
||||||
{
|
{
|
||||||
#ifndef USE_EINK
|
#ifndef USE_EINK
|
||||||
if (frameName == "nodelist") {
|
if (frameName == "nodelist") {
|
||||||
hiddenFrames.nodelist = !hiddenFrames.nodelist;
|
hiddenFrames.nodelist = !hiddenFrames.nodelist;
|
||||||
@ -1210,10 +1211,10 @@ void Screen::toggleFrameVisibility(const std::string &frameName)
|
|||||||
if (frameName == "chirpy") {
|
if (frameName == "chirpy") {
|
||||||
hiddenFrames.chirpy = !hiddenFrames.chirpy;
|
hiddenFrames.chirpy = !hiddenFrames.chirpy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Screen::isFrameHidden(const std::string &frameName) const
|
bool Screen::isFrameHidden(const std::string &frameName) const
|
||||||
{
|
{
|
||||||
#ifndef USE_EINK
|
#ifndef USE_EINK
|
||||||
if (frameName == "nodelist")
|
if (frameName == "nodelist")
|
||||||
return hiddenFrames.nodelist;
|
return hiddenFrames.nodelist;
|
||||||
@ -1242,13 +1243,13 @@ bool Screen::isFrameHidden(const std::string &frameName) const
|
|||||||
return hiddenFrames.chirpy;
|
return hiddenFrames.chirpy;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dismisses the currently displayed screen frame, if possible
|
// Dismisses the currently displayed screen frame, if possible
|
||||||
// Relevant for text message, waypoint, others in future?
|
// Relevant for text message, waypoint, others in future?
|
||||||
// Triggered with a CardKB keycombo
|
// Triggered with a CardKB keycombo
|
||||||
void Screen::hideCurrentFrame()
|
void Screen::hideCurrentFrame()
|
||||||
{
|
{
|
||||||
uint8_t currentFrame = ui->getUiState()->currentFrame;
|
uint8_t currentFrame = ui->getUiState()->currentFrame;
|
||||||
bool dismissed = false;
|
bool dismissed = false;
|
||||||
if (currentFrame == framesetInfo.positions.textMessage && devicestate.has_rx_text_message) {
|
if (currentFrame == framesetInfo.positions.textMessage && devicestate.has_rx_text_message) {
|
||||||
@ -1273,20 +1274,20 @@ void Screen::hideCurrentFrame()
|
|||||||
if (dismissed) {
|
if (dismissed) {
|
||||||
setFrames(FOCUS_DEFAULT); // You could also use FOCUS_PRESERVE
|
setFrames(FOCUS_DEFAULT); // You could also use FOCUS_PRESERVE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::handleStartFirmwareUpdateScreen()
|
void Screen::handleStartFirmwareUpdateScreen()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Show firmware screen");
|
LOG_DEBUG("Show firmware screen");
|
||||||
showingNormalScreen = false;
|
showingNormalScreen = false;
|
||||||
EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); // E-Ink: Explicitly use fast-refresh for next frame
|
EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); // E-Ink: Explicitly use fast-refresh for next frame
|
||||||
|
|
||||||
static FrameCallback frames[] = {graphics::NotificationRenderer::drawFrameFirmware};
|
static FrameCallback frames[] = {graphics::NotificationRenderer::drawFrameFirmware};
|
||||||
setFrameImmediateDraw(frames);
|
setFrameImmediateDraw(frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::blink()
|
void Screen::blink()
|
||||||
{
|
{
|
||||||
setFastFramerate();
|
setFastFramerate();
|
||||||
uint8_t count = 10;
|
uint8_t count = 10;
|
||||||
dispdev->setBrightness(254);
|
dispdev->setBrightness(254);
|
||||||
@ -1299,12 +1300,13 @@ void Screen::blink()
|
|||||||
delay(50);
|
delay(50);
|
||||||
count = count - 1;
|
count = count - 1;
|
||||||
}
|
}
|
||||||
// The dispdev->setBrightness does not work for t-deck display, it seems to run the setBrightness function in OLEDDisplay.
|
// The dispdev->setBrightness does not work for t-deck display, it seems to run the setBrightness function in
|
||||||
|
// OLEDDisplay.
|
||||||
dispdev->setBrightness(brightness);
|
dispdev->setBrightness(brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::increaseBrightness()
|
void Screen::increaseBrightness()
|
||||||
{
|
{
|
||||||
brightness = ((brightness + 62) > 254) ? brightness : (brightness + 62);
|
brightness = ((brightness + 62) > 254) ? brightness : (brightness + 62);
|
||||||
|
|
||||||
#if defined(ST7789_CS)
|
#if defined(ST7789_CS)
|
||||||
@ -1313,10 +1315,10 @@ void Screen::increaseBrightness()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TO DO: add little popup in center of screen saying what brightness level it is set to*/
|
/* TO DO: add little popup in center of screen saying what brightness level it is set to*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::decreaseBrightness()
|
void Screen::decreaseBrightness()
|
||||||
{
|
{
|
||||||
brightness = (brightness < 70) ? brightness : (brightness - 62);
|
brightness = (brightness < 70) ? brightness : (brightness - 62);
|
||||||
|
|
||||||
#if defined(ST7789_CS)
|
#if defined(ST7789_CS)
|
||||||
@ -1324,10 +1326,10 @@ void Screen::decreaseBrightness()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TO DO: add little popup in center of screen saying what brightness level it is set to*/
|
/* TO DO: add little popup in center of screen saying what brightness level it is set to*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::setFunctionSymbol(std::string sym)
|
void Screen::setFunctionSymbol(std::string sym)
|
||||||
{
|
{
|
||||||
if (std::find(functionSymbol.begin(), functionSymbol.end(), sym) == functionSymbol.end()) {
|
if (std::find(functionSymbol.begin(), functionSymbol.end(), sym) == functionSymbol.end()) {
|
||||||
functionSymbol.push_back(sym);
|
functionSymbol.push_back(sym);
|
||||||
functionSymbolString = "";
|
functionSymbolString = "";
|
||||||
@ -1336,20 +1338,20 @@ void Screen::setFunctionSymbol(std::string sym)
|
|||||||
}
|
}
|
||||||
setFastFramerate();
|
setFastFramerate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::removeFunctionSymbol(std::string sym)
|
void Screen::removeFunctionSymbol(std::string sym)
|
||||||
{
|
{
|
||||||
functionSymbol.erase(std::remove(functionSymbol.begin(), functionSymbol.end(), sym), functionSymbol.end());
|
functionSymbol.erase(std::remove(functionSymbol.begin(), functionSymbol.end(), sym), functionSymbol.end());
|
||||||
functionSymbolString = "";
|
functionSymbolString = "";
|
||||||
for (auto symbol : functionSymbol) {
|
for (auto symbol : functionSymbol) {
|
||||||
functionSymbolString = symbol + " " + functionSymbolString;
|
functionSymbolString = symbol + " " + functionSymbolString;
|
||||||
}
|
}
|
||||||
setFastFramerate();
|
setFastFramerate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::handleOnPress()
|
void Screen::handleOnPress()
|
||||||
{
|
{
|
||||||
// If screen was off, just wake it, otherwise advance to next frame
|
// If screen was off, just wake it, otherwise advance to next frame
|
||||||
// If we are in a transition, the press must have bounced, drop it.
|
// If we are in a transition, the press must have bounced, drop it.
|
||||||
if (ui->getUiState()->frameState == FIXED) {
|
if (ui->getUiState()->frameState == FIXED) {
|
||||||
@ -1357,10 +1359,10 @@ void Screen::handleOnPress()
|
|||||||
lastScreenTransition = millis();
|
lastScreenTransition = millis();
|
||||||
setFastFramerate();
|
setFastFramerate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::handleShowPrevFrame()
|
void Screen::handleShowPrevFrame()
|
||||||
{
|
{
|
||||||
// If screen was off, just wake it, otherwise go back to previous frame
|
// If screen was off, just wake it, otherwise go back to previous frame
|
||||||
// If we are in a transition, the press must have bounced, drop it.
|
// If we are in a transition, the press must have bounced, drop it.
|
||||||
if (ui->getUiState()->frameState == FIXED) {
|
if (ui->getUiState()->frameState == FIXED) {
|
||||||
@ -1368,10 +1370,10 @@ void Screen::handleShowPrevFrame()
|
|||||||
lastScreenTransition = millis();
|
lastScreenTransition = millis();
|
||||||
setFastFramerate();
|
setFastFramerate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::handleShowNextFrame()
|
void Screen::handleShowNextFrame()
|
||||||
{
|
{
|
||||||
// If screen was off, just wake it, otherwise advance to next frame
|
// If screen was off, just wake it, otherwise advance to next frame
|
||||||
// If we are in a transition, the press must have bounced, drop it.
|
// If we are in a transition, the press must have bounced, drop it.
|
||||||
if (ui->getUiState()->frameState == FIXED) {
|
if (ui->getUiState()->frameState == FIXED) {
|
||||||
@ -1379,14 +1381,14 @@ void Screen::handleShowNextFrame()
|
|||||||
lastScreenTransition = millis();
|
lastScreenTransition = millis();
|
||||||
setFastFramerate();
|
setFastFramerate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SCREEN_TRANSITION_FRAMERATE
|
#ifndef SCREEN_TRANSITION_FRAMERATE
|
||||||
#define SCREEN_TRANSITION_FRAMERATE 30 // fps
|
#define SCREEN_TRANSITION_FRAMERATE 30 // fps
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Screen::setFastFramerate()
|
void Screen::setFastFramerate()
|
||||||
{
|
{
|
||||||
#if defined(M5STACK_UNITC6L)
|
#if defined(M5STACK_UNITC6L)
|
||||||
dispdev->clear();
|
dispdev->clear();
|
||||||
dispdev->display();
|
dispdev->display();
|
||||||
@ -1397,10 +1399,10 @@ void Screen::setFastFramerate()
|
|||||||
ui->setTargetFPS(targetFramerate);
|
ui->setTargetFPS(targetFramerate);
|
||||||
setInterval(0); // redraw ASAP
|
setInterval(0); // redraw ASAP
|
||||||
runASAP = true;
|
runASAP = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Screen::handleStatusUpdate(const meshtastic::Status *arg)
|
int Screen::handleStatusUpdate(const meshtastic::Status *arg)
|
||||||
{
|
{
|
||||||
// LOG_DEBUG("Screen got status update %d", arg->getStatusType());
|
// LOG_DEBUG("Screen got status update %d", arg->getStatusType());
|
||||||
switch (arg->getStatusType()) {
|
switch (arg->getStatusType()) {
|
||||||
case STATUS_TYPE_NODE:
|
case STATUS_TYPE_NODE:
|
||||||
@ -1412,11 +1414,11 @@ int Screen::handleStatusUpdate(const meshtastic::Status *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles when message is received; will jump to text message frame.
|
// Handles when message is received; will jump to text message frame.
|
||||||
int Screen::handleTextMessage(const meshtastic_MeshPacket *packet)
|
int Screen::handleTextMessage(const meshtastic_MeshPacket *packet)
|
||||||
{
|
{
|
||||||
if (showingNormalScreen) {
|
if (showingNormalScreen) {
|
||||||
if (packet->from == 0) {
|
if (packet->from == 0) {
|
||||||
// Outgoing message (likely sent from phone)
|
// Outgoing message (likely sent from phone)
|
||||||
@ -1483,11 +1485,11 @@ int Screen::handleTextMessage(const meshtastic_MeshPacket *packet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Triggered by MeshModules
|
// Triggered by MeshModules
|
||||||
int Screen::handleUIFrameEvent(const UIFrameEvent *event)
|
int Screen::handleUIFrameEvent(const UIFrameEvent *event)
|
||||||
{
|
{
|
||||||
// Block UI frame events when virtual keyboard is active
|
// Block UI frame events when virtual keyboard is active
|
||||||
if (NotificationRenderer::current_notification_type == notificationTypeEnum::text_input) {
|
if (NotificationRenderer::current_notification_type == notificationTypeEnum::text_input) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -1508,17 +1510,18 @@ int Screen::handleUIFrameEvent(const UIFrameEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Screen::handleInputEvent(const InputEvent *event)
|
int Screen::handleInputEvent(const InputEvent *event)
|
||||||
{
|
{
|
||||||
if (!screenOn)
|
if (!screenOn)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Handle text input notifications specially - pass input to virtual keyboard
|
// Handle text input notifications specially - pass input to virtual keyboard
|
||||||
if (NotificationRenderer::current_notification_type == notificationTypeEnum::text_input) {
|
if (NotificationRenderer::current_notification_type == notificationTypeEnum::text_input) {
|
||||||
NotificationRenderer::inEvent = *event;
|
NotificationRenderer::inEvent = *event;
|
||||||
static OverlayCallback overlays[] = {graphics::UIRenderer::drawNavigationBar, NotificationRenderer::drawBannercallback};
|
static OverlayCallback overlays[] = {graphics::UIRenderer::drawNavigationBar,
|
||||||
|
NotificationRenderer::drawBannercallback};
|
||||||
ui->setOverlays(overlays, sizeof(overlays) / sizeof(overlays[0]));
|
ui->setOverlays(overlays, sizeof(overlays) / sizeof(overlays[0]));
|
||||||
setFastFramerate(); // Draw ASAP
|
setFastFramerate(); // Draw ASAP
|
||||||
ui->update();
|
ui->update();
|
||||||
@ -1533,7 +1536,8 @@ int Screen::handleInputEvent(const InputEvent *event)
|
|||||||
#endif
|
#endif
|
||||||
if (NotificationRenderer::isOverlayBannerShowing()) {
|
if (NotificationRenderer::isOverlayBannerShowing()) {
|
||||||
NotificationRenderer::inEvent = *event;
|
NotificationRenderer::inEvent = *event;
|
||||||
static OverlayCallback overlays[] = {graphics::UIRenderer::drawNavigationBar, NotificationRenderer::drawBannercallback};
|
static OverlayCallback overlays[] = {graphics::UIRenderer::drawNavigationBar,
|
||||||
|
NotificationRenderer::drawBannercallback};
|
||||||
ui->setOverlays(overlays, sizeof(overlays) / sizeof(overlays[0]));
|
ui->setOverlays(overlays, sizeof(overlays) / sizeof(overlays[0]));
|
||||||
setFastFramerate(); // Draw ASAP
|
setFastFramerate(); // Draw ASAP
|
||||||
ui->update();
|
ui->update();
|
||||||
@ -1605,10 +1609,10 @@ int Screen::handleInputEvent(const InputEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Screen::handleAdminMessage(AdminModule_ObserverData *arg)
|
int Screen::handleAdminMessage(AdminModule_ObserverData * arg)
|
||||||
{
|
{
|
||||||
switch (arg->request->which_payload_variant) {
|
switch (arg->request->which_payload_variant) {
|
||||||
// Node removed manually (i.e. via app)
|
// Node removed manually (i.e. via app)
|
||||||
case meshtastic_AdminMessage_remove_by_nodenum_tag:
|
case meshtastic_AdminMessage_remove_by_nodenum_tag:
|
||||||
@ -1621,21 +1625,21 @@ int Screen::handleAdminMessage(AdminModule_ObserverData *arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Screen::isOverlayBannerShowing()
|
bool Screen::isOverlayBannerShowing()
|
||||||
{
|
{
|
||||||
return NotificationRenderer::isOverlayBannerShowing();
|
return NotificationRenderer::isOverlayBannerShowing();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace graphics
|
} // namespace graphics
|
||||||
|
|
||||||
#else
|
#else
|
||||||
graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {}
|
graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {}
|
||||||
#endif // HAS_SCREEN
|
#endif // HAS_SCREEN
|
||||||
|
|
||||||
bool shouldWakeOnReceivedMessage()
|
bool shouldWakeOnReceivedMessage()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
The goal here is to determine when we do NOT wake up the screen on message received:
|
The goal here is to determine when we do NOT wake up the screen on message received:
|
||||||
- Any ext. notifications are turned on
|
- Any ext. notifications are turned on
|
||||||
@ -1654,4 +1658,4 @@ bool shouldWakeOnReceivedMessage()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -50,15 +50,15 @@ class StreamAPI : public PhoneAPI
|
|||||||
* phone.
|
* phone.
|
||||||
*/
|
*/
|
||||||
virtual int32_t runOncePart();
|
virtual int32_t runOncePart();
|
||||||
virtual int32_t runOncePart(char *buf,uint16_t bufLen);
|
virtual int32_t runOncePart(char *buf, uint16_t bufLen);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Read any rx chars from the link and call handleToRadio
|
* Read any rx chars from the link and call handleToRadio
|
||||||
*/
|
*/
|
||||||
int32_t readStream();
|
int32_t readStream();
|
||||||
int32_t readStream(char *buf,uint16_t bufLen);
|
int32_t readStream(char *buf, uint16_t bufLen);
|
||||||
int32_t handleRecStream(char *buf,uint16_t bufLen);
|
int32_t handleRecStream(char *buf, uint16_t bufLen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* call getFromRadio() and deliver encapsulated packets to the Stream
|
* call getFromRadio() and deliver encapsulated packets to the Stream
|
||||||
|
Loading…
Reference in New Issue
Block a user