mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-15 15:22:34 +00:00
Compare commits
6 Commits
esp32-h2
...
ble-Banner
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e5a89a57e | ||
|
|
ee071d3b41 | ||
|
|
3ab62c7355 | ||
|
|
591c17a61b | ||
|
|
04f8e7fb8b | ||
|
|
081c3fc034 |
@@ -174,7 +174,7 @@ void Screen::showOverlayBanner(BannerOverlayOptions banner_overlay_options)
|
|||||||
NotificationRenderer::pauseBanner = false;
|
NotificationRenderer::pauseBanner = false;
|
||||||
NotificationRenderer::current_notification_type = notificationTypeEnum::selection_picker;
|
NotificationRenderer::current_notification_type = notificationTypeEnum::selection_picker;
|
||||||
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, 2);
|
||||||
ui->setTargetFPS(60);
|
ui->setTargetFPS(60);
|
||||||
ui->update();
|
ui->update();
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ void Screen::showNodePicker(const char *message, uint32_t durationMs, std::funct
|
|||||||
NotificationRenderer::current_notification_type = notificationTypeEnum::node_picker;
|
NotificationRenderer::current_notification_type = notificationTypeEnum::node_picker;
|
||||||
|
|
||||||
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, 2);
|
||||||
ui->setTargetFPS(60);
|
ui->setTargetFPS(60);
|
||||||
ui->update();
|
ui->update();
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ void Screen::showNumberPicker(const char *message, uint32_t durationMs, uint8_t
|
|||||||
NotificationRenderer::currentNumber = 0;
|
NotificationRenderer::currentNumber = 0;
|
||||||
|
|
||||||
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, 2);
|
||||||
ui->setTargetFPS(60);
|
ui->setTargetFPS(60);
|
||||||
ui->update();
|
ui->update();
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ void Screen::showTextInput(const char *header, const char *initialText, uint32_t
|
|||||||
|
|
||||||
// Set the overlay using the same pattern as other notification types
|
// Set the overlay using the same pattern as other notification types
|
||||||
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, 2);
|
||||||
ui->setTargetFPS(60);
|
ui->setTargetFPS(60);
|
||||||
ui->update();
|
ui->update();
|
||||||
}
|
}
|
||||||
@@ -611,7 +611,7 @@ void Screen::setup()
|
|||||||
static OverlayCallback overlays[] = {
|
static OverlayCallback overlays[] = {
|
||||||
graphics::UIRenderer::drawNavigationBar // Custom indicator icons for each frame
|
graphics::UIRenderer::drawNavigationBar // Custom indicator icons for each frame
|
||||||
};
|
};
|
||||||
ui->setOverlays(overlays, sizeof(overlays) / sizeof(overlays[0]));
|
ui->setOverlays(overlays, 1);
|
||||||
|
|
||||||
// === Enable UTF-8 to display mapping ===
|
// === Enable UTF-8 to display mapping ===
|
||||||
dispdev->setFontTableLookupFunction(customFontTableLookup);
|
dispdev->setFontTableLookupFunction(customFontTableLookup);
|
||||||
@@ -1181,7 +1181,7 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
|
|
||||||
// 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, 2);
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
@@ -1649,7 +1649,7 @@ int Screen::handleInputEvent(const InputEvent *event)
|
|||||||
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, 2);
|
||||||
setFastFramerate(); // Draw ASAP
|
setFastFramerate(); // Draw ASAP
|
||||||
ui->update();
|
ui->update();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1664,7 +1664,7 @@ int Screen::handleInputEvent(const InputEvent *event)
|
|||||||
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, 2);
|
||||||
setFastFramerate(); // Draw ASAP
|
setFastFramerate(); // Draw ASAP
|
||||||
ui->update();
|
ui->update();
|
||||||
|
|
||||||
|
|||||||
@@ -1041,13 +1041,12 @@ void menuHandler::switchToMUIMenu()
|
|||||||
|
|
||||||
void menuHandler::TFTColorPickerMenu(OLEDDisplay *display)
|
void menuHandler::TFTColorPickerMenu(OLEDDisplay *display)
|
||||||
{
|
{
|
||||||
static const char *optionsArray[] = {
|
static const char *optionsArray[] = {"Back", "Default", "Meshtastic Green", "Yellow", "Red", "Orange", "Purple", "Teal",
|
||||||
"Back", "Default", "Meshtastic Green", "Yellow", "Red", "Orange", "Purple", "Blue", "Teal", "Cyan", "Ice", "Pink",
|
"Pink", "White"};
|
||||||
"White", "Gray"};
|
|
||||||
BannerOverlayOptions bannerOptions;
|
BannerOverlayOptions bannerOptions;
|
||||||
bannerOptions.message = "Select Screen Color";
|
bannerOptions.message = "Select Screen Color";
|
||||||
bannerOptions.optionsArrayPtr = optionsArray;
|
bannerOptions.optionsArrayPtr = optionsArray;
|
||||||
bannerOptions.optionsCount = 14;
|
bannerOptions.optionsCount = 10;
|
||||||
bannerOptions.bannerCallback = [display](int selected) -> void {
|
bannerOptions.bannerCallback = [display](int selected) -> void {
|
||||||
#if defined(HELTEC_MESH_NODE_T114) || defined(HELTEC_VISION_MASTER_T190) || defined(T_DECK) || defined(T_LORA_PAGER) || \
|
#if defined(HELTEC_MESH_NODE_T114) || defined(HELTEC_VISION_MASTER_T190) || defined(T_DECK) || defined(T_LORA_PAGER) || \
|
||||||
HAS_TFT || defined(HACKADAY_COMMUNICATOR)
|
HAS_TFT || defined(HACKADAY_COMMUNICATOR)
|
||||||
@@ -1083,40 +1082,20 @@ void menuHandler::TFTColorPickerMenu(OLEDDisplay *display)
|
|||||||
TFT_MESH_g = 153;
|
TFT_MESH_g = 153;
|
||||||
TFT_MESH_b = 255;
|
TFT_MESH_b = 255;
|
||||||
} else if (selected == 7) {
|
} else if (selected == 7) {
|
||||||
LOG_INFO("Setting color to Blue");
|
|
||||||
TFT_MESH_r = 0;
|
|
||||||
TFT_MESH_g = 0;
|
|
||||||
TFT_MESH_b = 255;
|
|
||||||
} else if (selected == 8) {
|
|
||||||
LOG_INFO("Setting color to Teal");
|
LOG_INFO("Setting color to Teal");
|
||||||
TFT_MESH_r = 16;
|
TFT_MESH_r = 64;
|
||||||
TFT_MESH_g = 102;
|
TFT_MESH_g = 224;
|
||||||
TFT_MESH_b = 102;
|
TFT_MESH_b = 208;
|
||||||
} else if (selected == 9) {
|
} else if (selected == 8) {
|
||||||
LOG_INFO("Setting color to Cyan");
|
|
||||||
TFT_MESH_r = 0;
|
|
||||||
TFT_MESH_g = 255;
|
|
||||||
TFT_MESH_b = 255;
|
|
||||||
} else if (selected == 10) {
|
|
||||||
LOG_INFO("Setting color to Ice");
|
|
||||||
TFT_MESH_r = 173;
|
|
||||||
TFT_MESH_g = 216;
|
|
||||||
TFT_MESH_b = 230;
|
|
||||||
} else if (selected == 11) {
|
|
||||||
LOG_INFO("Setting color to Pink");
|
LOG_INFO("Setting color to Pink");
|
||||||
TFT_MESH_r = 255;
|
TFT_MESH_r = 255;
|
||||||
TFT_MESH_g = 105;
|
TFT_MESH_g = 105;
|
||||||
TFT_MESH_b = 180;
|
TFT_MESH_b = 180;
|
||||||
} else if (selected == 12) {
|
} else if (selected == 9) {
|
||||||
LOG_INFO("Setting color to White");
|
LOG_INFO("Setting color to White");
|
||||||
TFT_MESH_r = 255;
|
TFT_MESH_r = 255;
|
||||||
TFT_MESH_g = 255;
|
TFT_MESH_g = 255;
|
||||||
TFT_MESH_b = 255;
|
TFT_MESH_b = 255;
|
||||||
} else if (selected == 13) {
|
|
||||||
LOG_INFO("Setting color to Gray");
|
|
||||||
TFT_MESH_r = 128;
|
|
||||||
TFT_MESH_g = 128;
|
|
||||||
TFT_MESH_b = 128;
|
|
||||||
} else {
|
} else {
|
||||||
menuQueue = system_base_menu;
|
menuQueue = system_base_menu;
|
||||||
screen->runNow();
|
screen->runNow();
|
||||||
|
|||||||
@@ -439,11 +439,6 @@ void setup()
|
|||||||
|
|
||||||
LOG_INFO("\n\n//\\ E S H T /\\ S T / C\n");
|
LOG_INFO("\n\n//\\ E S H T /\\ S T / C\n");
|
||||||
|
|
||||||
#if defined(ARCH_ESP32) && defined(BOARD_HAS_PSRAM)
|
|
||||||
// use PSRAM for malloc calls > 256 bytes
|
|
||||||
heap_caps_malloc_extmem_enable(256);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(DEBUG_MUTE) && defined(DEBUG_PORT)
|
#if defined(DEBUG_MUTE) && defined(DEBUG_PORT)
|
||||||
DEBUG_PORT.printf("\r\n\r\n//\\ E S H T /\\ S T / C\r\n");
|
DEBUG_PORT.printf("\r\n\r\n//\\ E S H T /\\ S T / C\r\n");
|
||||||
DEBUG_PORT.printf("Version %s for %s from %s\r\n", optstr(APP_VERSION), optstr(APP_ENV), optstr(APP_REPO));
|
DEBUG_PORT.printf("Version %s for %s from %s\r\n", optstr(APP_VERSION), optstr(APP_ENV), optstr(APP_REPO));
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
|
|
||||||
static MemoryDynamic<meshtastic_MeshPacket> dynamicPool;
|
static MemoryDynamic<meshtastic_MeshPacket> dynamicPool;
|
||||||
Allocator<meshtastic_MeshPacket> &packetPool = dynamicPool;
|
Allocator<meshtastic_MeshPacket> &packetPool = dynamicPool;
|
||||||
#elif defined(ARCH_STM32WL) || defined(BOARD_HAS_PSRAM)
|
#elif defined(ARCH_STM32WL)
|
||||||
// On STM32 and boards with PSRAM, there isn't enough heap left over for the rest of the firmware if we allocate this statically.
|
// On STM32 there isn't enough heap left over for the rest of the firmware if we allocate this statically.
|
||||||
// For now, make it dynamic again.
|
// For now, make it dynamic again.
|
||||||
#define MAX_PACKETS \
|
#define MAX_PACKETS \
|
||||||
(MAX_RX_TOPHONE + MAX_RX_FROMRADIO + 2 * MAX_TX_QUEUE + \
|
(MAX_RX_TOPHONE + MAX_RX_FROMRADIO + 2 * MAX_TX_QUEUE + \
|
||||||
|
|||||||
@@ -5,8 +5,7 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "input/InputBroker.h"
|
#include "input/InputBroker.h"
|
||||||
|
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||||
!defined(CONFIG_IDF_TARGET_ESP32H2)
|
|
||||||
#include <NonBlockingRtttl.h>
|
#include <NonBlockingRtttl.h>
|
||||||
#else
|
#else
|
||||||
// Noop class for portduino.
|
// Noop class for portduino.
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial
|
|||||||
api_type = TYPE_SERIAL;
|
api_type = TYPE_SERIAL;
|
||||||
}
|
}
|
||||||
static Print *serialPrint = &Serial;
|
static Print *serialPrint = &Serial;
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32C6) || defined(RAK3172) || defined(EBYTE_E77_MBL) || defined(CONFIG_IDF_TARGET_ESP32H2)
|
#elif defined(CONFIG_IDF_TARGET_ESP32C6) || defined(RAK3172) || defined(EBYTE_E77_MBL)
|
||||||
SerialModule::SerialModule() : StreamAPI(&Serial1), concurrency::OSThread("Serial")
|
SerialModule::SerialModule() : StreamAPI(&Serial1), concurrency::OSThread("Serial")
|
||||||
{
|
{
|
||||||
api_type = TYPE_SERIAL;
|
api_type = TYPE_SERIAL;
|
||||||
@@ -175,7 +175,7 @@ int32_t SerialModule::runOnce()
|
|||||||
// Give it a chance to flush out 💩
|
// Give it a chance to flush out 💩
|
||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
|
#if defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||||
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
|
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
|
||||||
Serial1.setRxBufferSize(RX_BUFFER);
|
Serial1.setRxBufferSize(RX_BUFFER);
|
||||||
Serial1.begin(baud, SERIAL_8N1, moduleConfig.serial.rxd, moduleConfig.serial.txd);
|
Serial1.begin(baud, SERIAL_8N1, moduleConfig.serial.rxd, moduleConfig.serial.txd);
|
||||||
@@ -277,7 +277,7 @@ int32_t SerialModule::runOnce()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
|
#if defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||||
while (Serial1.available()) {
|
while (Serial1.available()) {
|
||||||
serialPayloadSize = Serial1.readBytes(serialBytes, meshtastic_Constants_DATA_PAYLOAD_LEN);
|
serialPayloadSize = Serial1.readBytes(serialBytes, meshtastic_Constants_DATA_PAYLOAD_LEN);
|
||||||
#else
|
#else
|
||||||
@@ -538,7 +538,7 @@ void SerialModule::processWXSerial()
|
|||||||
{
|
{
|
||||||
#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \
|
#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \
|
||||||
!defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && \
|
!defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && \
|
||||||
!defined(ARCH_STM32WL) && !defined(MUZI_BASE) && !defined(CONFIG_IDF_TARGET_ESP32H2)
|
!defined(ARCH_STM32WL) && !defined(MUZI_BASE)
|
||||||
static unsigned int lastAveraged = 0;
|
static unsigned int lastAveraged = 0;
|
||||||
static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded.
|
static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded.
|
||||||
static double dir_sum_sin = 0;
|
static double dir_sum_sin = 0;
|
||||||
|
|||||||
@@ -573,51 +573,30 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks
|
|||||||
virtual uint32_t onPassKeyRequest()
|
virtual uint32_t onPassKeyRequest()
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
uint32_t passkey = config.bluetooth.fixed_pin;
|
uint32_t configuredPasskey = config.bluetooth.fixed_pin;
|
||||||
|
|
||||||
if (config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_RANDOM_PIN) {
|
if (config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_RANDOM_PIN) {
|
||||||
LOG_INFO("Use random passkey");
|
LOG_INFO("Use random passkey");
|
||||||
// This is the passkey to be entered on peer - we pick a number >100,000 to ensure 6 digits
|
// This is the passkey to be entered on peer - we pick a number >100,000 to ensure 6 digits
|
||||||
passkey = random(100000, 999999);
|
configuredPasskey = random(100000, 999999);
|
||||||
}
|
}
|
||||||
LOG_INFO("*** Enter passkey %d on the peer side ***", passkey);
|
LOG_INFO("*** Enter passkey %d on the peer side ***", configuredPasskey);
|
||||||
|
|
||||||
powerFSM.trigger(EVENT_BLUETOOTH_PAIR);
|
powerFSM.trigger(EVENT_BLUETOOTH_PAIR);
|
||||||
meshtastic::BluetoothStatus newStatus(std::to_string(passkey));
|
std::string passkey = std::to_string(configuredPasskey);
|
||||||
|
meshtastic::BluetoothStatus newStatus(passkey);
|
||||||
bluetoothStatus->updateStatus(&newStatus);
|
bluetoothStatus->updateStatus(&newStatus);
|
||||||
|
|
||||||
#if HAS_SCREEN // Todo: migrate this display code back into Screen class, and observe bluetoothStatus
|
#if HAS_SCREEN // Todo: migrate this display code back into Screen class, and observe bluetoothStatus
|
||||||
if (screen) {
|
if (screen) {
|
||||||
screen->startAlert([passkey](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void {
|
|
||||||
char btPIN[16] = "888888";
|
|
||||||
snprintf(btPIN, sizeof(btPIN), "%06u", passkey);
|
|
||||||
int x_offset = display->width() / 2;
|
|
||||||
int y_offset = display->height() <= 80 ? 0 : 12;
|
|
||||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
|
||||||
display->setFont(FONT_MEDIUM);
|
|
||||||
display->drawString(x_offset + x, y_offset + y, "Bluetooth");
|
|
||||||
#if !defined(M5STACK_UNITC6L)
|
|
||||||
display->setFont(FONT_SMALL);
|
|
||||||
y_offset = display->height() == 64 ? y_offset + FONT_HEIGHT_MEDIUM - 4 : y_offset + FONT_HEIGHT_MEDIUM + 5;
|
|
||||||
display->drawString(x_offset + x, y_offset + y, "Enter this code");
|
|
||||||
#endif
|
|
||||||
display->setFont(FONT_LARGE);
|
|
||||||
char pin[8];
|
|
||||||
snprintf(pin, sizeof(pin), "%.3s %.3s", btPIN, btPIN + 3);
|
|
||||||
y_offset = display->height() == 64 ? y_offset + FONT_HEIGHT_SMALL - 5 : y_offset + FONT_HEIGHT_SMALL + 5;
|
|
||||||
display->drawString(x_offset + x, y_offset + y, pin);
|
|
||||||
|
|
||||||
display->setFont(FONT_SMALL);
|
std::string ble_message = "Bluetooth\nPIN\n" + passkey.substr(0, 3) + " " + passkey.substr(3, 6);
|
||||||
char deviceName[64];
|
screen->showSimpleBanner(ble_message.c_str(), 30000);
|
||||||
snprintf(deviceName, sizeof(deviceName), "Name: %s", getDeviceName());
|
|
||||||
y_offset = display->height() == 64 ? y_offset + FONT_HEIGHT_LARGE - 6 : y_offset + FONT_HEIGHT_LARGE + 5;
|
|
||||||
display->drawString(x_offset + x, y_offset + y, deviceName);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
passkeyShowing = true;
|
passkeyShowing = true;
|
||||||
|
|
||||||
return passkey;
|
return configuredPasskey;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NIMBLE_TWO
|
#ifdef NIMBLE_TWO
|
||||||
|
|||||||
@@ -169,8 +169,6 @@ void esp32Setup()
|
|||||||
// #define APP_WATCHDOG_SECS 45
|
// #define APP_WATCHDOG_SECS 45
|
||||||
#define APP_WATCHDOG_SECS 90
|
#define APP_WATCHDOG_SECS 90
|
||||||
|
|
||||||
// esp_task_wdt_init returns an unknown error, so skip it on ESP32H2
|
|
||||||
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP32C6
|
#ifdef CONFIG_IDF_TARGET_ESP32C6
|
||||||
esp_task_wdt_config_t *wdt_config = (esp_task_wdt_config_t *)malloc(sizeof(esp_task_wdt_config_t));
|
esp_task_wdt_config_t *wdt_config = (esp_task_wdt_config_t *)malloc(sizeof(esp_task_wdt_config_t));
|
||||||
wdt_config->timeout_ms = APP_WATCHDOG_SECS * 1000;
|
wdt_config->timeout_ms = APP_WATCHDOG_SECS * 1000;
|
||||||
@@ -183,7 +181,7 @@ void esp32Setup()
|
|||||||
#endif
|
#endif
|
||||||
res = esp_task_wdt_add(NULL);
|
res = esp_task_wdt_add(NULL);
|
||||||
assert(res == ESP_OK);
|
assert(res == ESP_OK);
|
||||||
#endif
|
|
||||||
#if HAS_32768HZ
|
#if HAS_32768HZ
|
||||||
enableSlowCLK();
|
enableSlowCLK();
|
||||||
#endif
|
#endif
|
||||||
@@ -225,10 +223,9 @@ void cpuDeepSleep(uint32_t msecToWake)
|
|||||||
13,
|
13,
|
||||||
#endif
|
#endif
|
||||||
34, 35, 37};
|
34, 35, 37};
|
||||||
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
|
||||||
for (int i = 0; i < sizeof(rtcGpios); i++)
|
for (int i = 0; i < sizeof(rtcGpios); i++)
|
||||||
rtc_gpio_isolate((gpio_num_t)rtcGpios[i]);
|
rtc_gpio_isolate((gpio_num_t)rtcGpios[i]);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME, disable internal rtc pullups/pulldowns on the non isolated pins. for inputs that we aren't using
|
// FIXME, disable internal rtc pullups/pulldowns on the non isolated pins. for inputs that we aren't using
|
||||||
@@ -261,10 +258,10 @@ void cpuDeepSleep(uint32_t msecToWake)
|
|||||||
|
|
||||||
#endif // #end ESP32S3_WAKE_TYPE
|
#endif // #end ESP32S3_WAKE_TYPE
|
||||||
#endif
|
#endif
|
||||||
#ifdef ESP_PD_DOMAIN_RTC_PERIPH
|
|
||||||
// We want RTC peripherals to stay on
|
// We want RTC peripherals to stay on
|
||||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
||||||
#endif
|
|
||||||
esp_sleep_enable_timer_wakeup(msecToWake * 1000ULL); // call expects usecs
|
esp_sleep_enable_timer_wakeup(msecToWake * 1000ULL); // call expects usecs
|
||||||
esp_deep_sleep_start(); // TBD mA sleep current (battery)
|
esp_deep_sleep_start(); // TBD mA sleep current (battery)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,34 +338,11 @@ bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passke
|
|||||||
meshtastic::BluetoothStatus newStatus(textkey);
|
meshtastic::BluetoothStatus newStatus(textkey);
|
||||||
bluetoothStatus->updateStatus(&newStatus);
|
bluetoothStatus->updateStatus(&newStatus);
|
||||||
|
|
||||||
#if HAS_SCREEN && \
|
#if HAS_SCREEN && !defined(MESHTASTIC_EXCLUDE_SCREEN)
|
||||||
!defined(MESHTASTIC_EXCLUDE_SCREEN) // Todo: migrate this display code back into Screen class, and observe bluetoothStatus
|
|
||||||
if (screen) {
|
if (screen) {
|
||||||
screen->startAlert([](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void {
|
std::string passkey = std::to_string(configuredPasskey);
|
||||||
char btPIN[16] = "888888";
|
std::string ble_message = "Bluetooth\nPIN\n" + passkey.substr(0, 3) + " " + passkey.substr(3, 6);
|
||||||
snprintf(btPIN, sizeof(btPIN), "%06u", configuredPasskey);
|
screen->showSimpleBanner(ble_message.c_str(), 30000);
|
||||||
int x_offset = display->width() / 2;
|
|
||||||
int y_offset = display->height() <= 80 ? 0 : 12;
|
|
||||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
|
||||||
display->setFont(FONT_MEDIUM);
|
|
||||||
display->drawString(x_offset + x, y_offset + y, "Bluetooth");
|
|
||||||
|
|
||||||
display->setFont(FONT_SMALL);
|
|
||||||
y_offset = display->height() == 64 ? y_offset + FONT_HEIGHT_MEDIUM - 4 : y_offset + FONT_HEIGHT_MEDIUM + 5;
|
|
||||||
display->drawString(x_offset + x, y_offset + y, "Enter this code");
|
|
||||||
|
|
||||||
display->setFont(FONT_LARGE);
|
|
||||||
String displayPin(btPIN);
|
|
||||||
String pin = displayPin.substring(0, 3) + " " + displayPin.substring(3, 6);
|
|
||||||
y_offset = display->height() == 64 ? y_offset + FONT_HEIGHT_SMALL - 5 : y_offset + FONT_HEIGHT_SMALL + 5;
|
|
||||||
display->drawString(x_offset + x, y_offset + y, pin);
|
|
||||||
|
|
||||||
display->setFont(FONT_SMALL);
|
|
||||||
String deviceName = "Name: ";
|
|
||||||
deviceName.concat(getDeviceName());
|
|
||||||
y_offset = display->height() == 64 ? y_offset + FONT_HEIGHT_LARGE - 6 : y_offset + FONT_HEIGHT_LARGE + 5;
|
|
||||||
display->drawString(x_offset + x, y_offset + y, deviceName);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (match_request) {
|
if (match_request) {
|
||||||
|
|||||||
@@ -388,10 +388,10 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
|||||||
uint64_t sleepUsec = sleepMsec * 1000LL;
|
uint64_t sleepUsec = sleepMsec * 1000LL;
|
||||||
|
|
||||||
// NOTE! ESP docs say we must disable bluetooth and wifi before light sleep
|
// NOTE! ESP docs say we must disable bluetooth and wifi before light sleep
|
||||||
#ifdef ESP_PD_DOMAIN_RTC_PERIPH
|
|
||||||
// We want RTC peripherals to stay on
|
// We want RTC peripherals to stay on
|
||||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
||||||
#endif
|
|
||||||
#if defined(BUTTON_PIN) && defined(BUTTON_NEED_PULLUP)
|
#if defined(BUTTON_PIN) && defined(BUTTON_NEED_PULLUP)
|
||||||
gpio_pullup_en((gpio_num_t)BUTTON_PIN);
|
gpio_pullup_en((gpio_num_t)BUTTON_PIN);
|
||||||
#endif
|
#endif
|
||||||
@@ -523,8 +523,6 @@ void enableModemSleep()
|
|||||||
esp32_config.max_freq_mhz = CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ;
|
esp32_config.max_freq_mhz = CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ;
|
||||||
#elif CONFIG_IDF_TARGET_ESP32C6
|
#elif CONFIG_IDF_TARGET_ESP32C6
|
||||||
esp32_config.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ;
|
esp32_config.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ;
|
||||||
#elif CONFIG_IDF_TARGET_ESP32H2
|
|
||||||
esp32_config.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ;
|
|
||||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||||
esp32_config.max_freq_mhz = CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ;
|
esp32_config.max_freq_mhz = CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
[esp32h2_base]
|
|
||||||
extends = esp32_base
|
|
||||||
platform =
|
|
||||||
# Do not renovate until we have switched to pioarduino tagged builds
|
|
||||||
https://github.com/Jason2866/platform-espressif32/archive/39475a7213fa3a52b0c2048d1a31c215fc85fcf8.zip
|
|
||||||
build_flags =
|
|
||||||
${arduino_base.build_flags}
|
|
||||||
-Wall
|
|
||||||
-Wextra
|
|
||||||
-Isrc/platform/esp32
|
|
||||||
-std=c++11
|
|
||||||
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
|
||||||
-DSERIAL_BUFFER_SIZE=4096
|
|
||||||
-DLIBPAX_ARDUINO
|
|
||||||
-DLIBPAX_WIFI
|
|
||||||
-DLIBPAX_BLE
|
|
||||||
-DMESHTASTIC_EXCLUDE_WEBSERVER
|
|
||||||
;-DDEBUG_HEAP
|
|
||||||
; TEMP
|
|
||||||
-DHAS_BLUETOOTH=0
|
|
||||||
-DMESHTASTIC_EXCLUDE_PAXCOUNTER
|
|
||||||
-DMESHTASTIC_EXCLUDE_BLUETOOTH
|
|
||||||
|
|
||||||
lib_deps =
|
|
||||||
${arduino_base.lib_deps}
|
|
||||||
${networking_base.lib_deps}
|
|
||||||
${environmental_base.lib_deps}
|
|
||||||
${environmental_extra.lib_deps}
|
|
||||||
${radiolib_base.lib_deps}
|
|
||||||
# renovate: datasource=custom.pio depName=XPowersLib packageName=lewisxhe/library/XPowersLib
|
|
||||||
lewisxhe/XPowersLib@0.3.1
|
|
||||||
# renovate: datasource=git-refs depName=meshtastic-ESP32_Codec2 packageName=https://github.com/meshtastic/ESP32_Codec2 gitBranch=master
|
|
||||||
https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip
|
|
||||||
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
|
||||||
rweather/Crypto@0.4.0
|
|
||||||
|
|
||||||
build_src_filter =
|
|
||||||
${esp32_base.build_src_filter} -<mesh/http>
|
|
||||||
|
|
||||||
monitor_speed = 460800
|
|
||||||
monitor_filters = esp32_h2_exception_decoder
|
|
||||||
|
|
||||||
lib_ignore =
|
|
||||||
NonBlockingRTTTL
|
|
||||||
NimBLE-Arduino
|
|
||||||
libpax
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
[env:waveshare-esp32h2]
|
|
||||||
extends = esp32h2_base
|
|
||||||
board = esp32-h2-devkitm-1
|
|
||||||
board_build.f_flash = 16000000L
|
|
||||||
board_level = pr
|
|
||||||
build_flags =
|
|
||||||
${esp32h2_base.build_flags}
|
|
||||||
-I variants/esp32h2/waveshare-esp32-h2
|
|
||||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
|
||||||
-DARDUINO_USB_MODE=1
|
|
||||||
-DHAS_WIFI=0
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
#define HAS_SCREEN 0
|
|
||||||
#define HAS_WIFI 0
|
|
||||||
|
|
||||||
#define LORA_SCK 4
|
|
||||||
#define LORA_MISO 3
|
|
||||||
#define LORA_MOSI 2
|
|
||||||
#define LORA_CS 1
|
|
||||||
Reference in New Issue
Block a user