mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-14 09:15:22 +00:00
Lots fixes
This commit is contained in:
parent
900a7c4c5e
commit
f1fda7bdeb
@ -3619,7 +3619,7 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
// Focus on a specific frame, in the frame set we just created
|
// Focus on a specific frame, in the frame set we just created
|
||||||
switch (focus) {
|
switch (focus) {
|
||||||
case FOCUS_DEFAULT:
|
case FOCUS_DEFAULT:
|
||||||
ui->switchToFrame(0); // First frame
|
ui->switchToFrame(fsi.positions.deviceFocused);
|
||||||
break;
|
break;
|
||||||
case FOCUS_FAULT:
|
case FOCUS_FAULT:
|
||||||
ui->switchToFrame(fsi.positions.fault);
|
ui->switchToFrame(fsi.positions.fault);
|
||||||
@ -3634,37 +3634,14 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
ui->switchToFrame(fsi.positions.focusedModule);
|
ui->switchToFrame(fsi.positions.focusedModule);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FOCUS_PRESERVE: {
|
case FOCUS_PRESERVE:
|
||||||
const FramesetInfo &oldFsi = this->framesetInfo;
|
// 🚫 No more adjustment — force stay on same index
|
||||||
|
if (originalPosition < fsi.frameCount)
|
||||||
// ✅ Fix: Account for new message insertion shifting frame positions
|
|
||||||
if (willInsertTextMessage && oldFsi.positions.textMessage == 0 && fsi.positions.textMessage <= originalPosition) {
|
|
||||||
originalPosition++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (originalPosition == oldFsi.positions.log && fsi.positions.log < fsi.frameCount)
|
|
||||||
ui->switchToFrame(fsi.positions.log);
|
|
||||||
else if (originalPosition == oldFsi.positions.settings && fsi.positions.settings < fsi.frameCount)
|
|
||||||
ui->switchToFrame(fsi.positions.settings);
|
|
||||||
else if (originalPosition == oldFsi.positions.wifi && fsi.positions.wifi < fsi.frameCount)
|
|
||||||
ui->switchToFrame(fsi.positions.wifi);
|
|
||||||
|
|
||||||
// If frame count has decreased
|
|
||||||
else if (fsi.frameCount < oldFsi.frameCount) {
|
|
||||||
uint8_t numDropped = oldFsi.frameCount - fsi.frameCount;
|
|
||||||
// Move n frames backwards
|
|
||||||
if (numDropped <= originalPosition)
|
|
||||||
ui->switchToFrame(originalPosition - numDropped);
|
|
||||||
// Unless that would put us "out of bounds" (< 0)
|
|
||||||
else
|
|
||||||
ui->switchToFrame(0);
|
|
||||||
} else if (originalPosition < fsi.frameCount)
|
|
||||||
ui->switchToFrame(originalPosition);
|
ui->switchToFrame(originalPosition);
|
||||||
else
|
else
|
||||||
ui->switchToFrame(fsi.frameCount - 1);
|
ui->switchToFrame(fsi.frameCount - 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Store the info about this frameset, for future setFrames calls
|
// Store the info about this frameset, for future setFrames calls
|
||||||
this->framesetInfo = fsi;
|
this->framesetInfo = fsi;
|
||||||
@ -3687,13 +3664,20 @@ void Screen::dismissCurrentFrame()
|
|||||||
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) {
|
// Only dismiss if the text message frame is currently valid and visible
|
||||||
|
if (framesetInfo.positions.textMessage != 255 &&
|
||||||
|
currentFrame == framesetInfo.positions.textMessage &&
|
||||||
|
devicestate.has_rx_text_message)
|
||||||
|
{
|
||||||
LOG_INFO("Dismiss Text Message");
|
LOG_INFO("Dismiss Text Message");
|
||||||
devicestate.has_rx_text_message = false;
|
devicestate.has_rx_text_message = false;
|
||||||
|
memset(&devicestate.rx_text_message, 0, sizeof(devicestate.rx_text_message)); // ✅ clear message
|
||||||
dismissed = true;
|
dismissed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (currentFrame == framesetInfo.positions.waypoint && devicestate.has_rx_waypoint) {
|
else if (currentFrame == framesetInfo.positions.waypoint &&
|
||||||
|
devicestate.has_rx_waypoint)
|
||||||
|
{
|
||||||
LOG_DEBUG("Dismiss Waypoint");
|
LOG_DEBUG("Dismiss Waypoint");
|
||||||
devicestate.has_rx_waypoint = false;
|
devicestate.has_rx_waypoint = false;
|
||||||
dismissed = true;
|
dismissed = true;
|
||||||
|
@ -607,6 +607,7 @@ class Screen : public concurrency::OSThread
|
|||||||
uint8_t log = 0;
|
uint8_t log = 0;
|
||||||
uint8_t settings = 0;
|
uint8_t settings = 0;
|
||||||
uint8_t wifi = 0;
|
uint8_t wifi = 0;
|
||||||
|
uint8_t deviceFocused = 0;
|
||||||
} positions;
|
} positions;
|
||||||
|
|
||||||
uint8_t frameCount = 0;
|
uint8_t frameCount = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user