Merge remote-tracking branch 'origin/unify-tft' into screen-refactor

This commit is contained in:
Ben Meadors 2025-05-31 07:38:29 -05:00
commit 134e01aa70
2 changed files with 11 additions and 14 deletions

View File

@ -59,7 +59,7 @@ bool KeyVerificationModule::handleReceivedProtobuf(const meshtastic_MeshPacket &
r->hash1.size == 0) {
memcpy(hash2, r->hash2.bytes, 32);
if (screen)
screen->startAlert("Enter Security Number"); // TODO: replace with actual prompt in BaseUI
screen->showOverlayBanner("Enter Security Number", 15000);
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
cn->level = meshtastic_LogRecord_Level_WARNING;
@ -81,8 +81,7 @@ bool KeyVerificationModule::handleReceivedProtobuf(const meshtastic_MeshPacket &
generateVerificationCode(message + 15);
LOG_INFO("Hash1 matches!");
if (screen) {
screen->endAlert();
screen->startAlert(message);
screen->showOverlayBanner(message, 15000);
}
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
cn->level = meshtastic_LogRecord_Level_WARNING;
@ -180,7 +179,7 @@ meshtastic_MeshPacket *KeyVerificationModule::allocReply()
responsePacket->pki_encrypted = true;
if (screen) {
snprintf(message, 25, "Security Number \n%03u %03u", currentSecurityNumber / 1000, currentSecurityNumber % 1000);
screen->startAlert(message);
screen->showOverlayBanner(message, 15000);
LOG_WARN("%s", message);
}
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
@ -250,8 +249,7 @@ void KeyVerificationModule::processSecurityNumber(uint32_t incomingNumber)
sprintf(message, "Verification: \n");
generateVerificationCode(message + 15); // send the toPhone packet
if (screen) {
screen->endAlert();
screen->startAlert(message);
screen->showOverlayBanner(message, 15000);
}
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
cn->level = meshtastic_LogRecord_Level_WARNING;
@ -287,8 +285,6 @@ void KeyVerificationModule::resetToIdle()
currentSecurityNumber = 0;
currentRemoteNode = 0;
currentState = KEY_VERIFICATION_IDLE;
if (screen)
screen->endAlert();
}
void KeyVerificationModule::generateVerificationCode(char *readableCode)

View File

@ -328,7 +328,13 @@ void PositionModule::sendOurPosition()
// If we changed channels, ask everyone else for their latest info
LOG_INFO("Send pos@%x:6 to mesh (wantReplies=%d)", localPosition.timestamp, requestReplies);
sendOurPosition(NODENUM_BROADCAST, requestReplies);
for (uint8_t channelNum = 0; channelNum < 8; channelNum++) {
if (channels.getByIndex(channelNum).settings.has_module_settings &&
channels.getByIndex(channelNum).settings.module_settings.position_precision != 0) {
sendOurPosition(NODENUM_BROADCAST, requestReplies, channelNum);
return;
}
}
}
void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t channel)
@ -340,11 +346,6 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha
// Set's the class precision value for this particular packet
if (channels.getByIndex(channel).settings.has_module_settings) {
precision = channels.getByIndex(channel).settings.module_settings.position_precision;
} else if (channels.getByIndex(channel).role == meshtastic_Channel_Role_PRIMARY) {
// backwards compatibility for Primary channels created before position_precision was set by default
precision = 13;
} else {
precision = 0;
}
meshtastic_MeshPacket *p = allocPositionPacket();