mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-17 18:53:35 +00:00
trunk format
This commit is contained in:
parent
50f72b0ea0
commit
cbd6a0065b
@ -908,7 +908,10 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// #else
|
// #else
|
||||||
Screen::Screen(uint8_t address, int sda, int scl) : OSThread("Screen"), cmdQueue(32), dispdev(address, sda, scl, screen_model == Config_DisplayConfig_OledType_OLED_SH1107 ? GEOMETRY_128_128 : GEOMETRY_128_64), ui(&dispdev)
|
Screen::Screen(uint8_t address, int sda, int scl)
|
||||||
|
: OSThread("Screen"), cmdQueue(32),
|
||||||
|
dispdev(address, sda, scl, screen_model == Config_DisplayConfig_OledType_OLED_SH1107 ? GEOMETRY_128_128 : GEOMETRY_128_64),
|
||||||
|
ui(&dispdev)
|
||||||
{
|
{
|
||||||
address_found = address;
|
address_found = address;
|
||||||
cmdQueue.setReader(this);
|
cmdQueue.setReader(this);
|
||||||
|
@ -10,12 +10,12 @@ namespace graphics
|
|||||||
class Screen
|
class Screen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Screen(char){}
|
explicit Screen(char) {}
|
||||||
void onPress() {}
|
void onPress() {}
|
||||||
void setup() {}
|
void setup() {}
|
||||||
void setOn(bool) {}
|
void setOn(bool) {}
|
||||||
void print(const char*){}
|
void print(const char *) {}
|
||||||
void adjustBrightness(){}
|
void adjustBrightness() {}
|
||||||
void doDeepSleep() {}
|
void doDeepSleep() {}
|
||||||
void forceDisplay() {}
|
void forceDisplay() {}
|
||||||
void startBluetoothPinScreen(uint32_t pin) {}
|
void startBluetoothPinScreen(uint32_t pin) {}
|
||||||
@ -23,7 +23,7 @@ class Screen
|
|||||||
void startRebootScreen() {}
|
void startRebootScreen() {}
|
||||||
void startFirmwareUpdateScreen() {}
|
void startFirmwareUpdateScreen() {}
|
||||||
};
|
};
|
||||||
}
|
} // namespace graphics
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -49,9 +49,9 @@ class Screen
|
|||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "concurrency/LockGuard.h"
|
#include "concurrency/LockGuard.h"
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
|
#include "mesh/MeshModule.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "mesh/MeshModule.h"
|
|
||||||
|
|
||||||
// 0 to 255, though particular variants might define different defaults
|
// 0 to 255, though particular variants might define different defaults
|
||||||
#ifndef BRIGHTNESS_DEFAULT
|
#ifndef BRIGHTNESS_DEFAULT
|
||||||
@ -132,7 +132,8 @@ class Screen : public concurrency::OSThread
|
|||||||
void setOn(bool on)
|
void setOn(bool on)
|
||||||
{
|
{
|
||||||
if (!on)
|
if (!on)
|
||||||
handleSetOn(false); // We handle off commands immediately, because they might be called because the CPU is shutting down
|
handleSetOn(
|
||||||
|
false); // We handle off commands immediately, because they might be called because the CPU is shutting down
|
||||||
else
|
else
|
||||||
enqueueCmd(ScreenCmd{.cmd = on ? Cmd::SET_ON : Cmd::SET_OFF});
|
enqueueCmd(ScreenCmd{.cmd = on ? Cmd::SET_ON : Cmd::SET_OFF});
|
||||||
}
|
}
|
||||||
@ -223,29 +224,33 @@ class Screen : public concurrency::OSThread
|
|||||||
LASTCHAR = ch;
|
LASTCHAR = ch;
|
||||||
|
|
||||||
switch (last) { // conversion depending on first UTF8-character
|
switch (last) { // conversion depending on first UTF8-character
|
||||||
case 0xC2: {
|
case 0xC2: {
|
||||||
SKIPREST = false;
|
SKIPREST = false;
|
||||||
return (uint8_t)ch;
|
return (uint8_t)ch;
|
||||||
}
|
}
|
||||||
case 0xC3: {
|
case 0xC3: {
|
||||||
SKIPREST = false;
|
SKIPREST = false;
|
||||||
return (uint8_t)(ch | 0xC0);
|
return (uint8_t)(ch | 0xC0);
|
||||||
}
|
}
|
||||||
// map UTF-8 cyrillic chars to it Windows-1251 (CP-1251) ASCII codes
|
// map UTF-8 cyrillic chars to it Windows-1251 (CP-1251) ASCII codes
|
||||||
// note: in this case we must use compatible font - provided ArialMT_Plain_10/16/24 by 'ThingPulse/esp8266-oled-ssd1306' library
|
// note: in this case we must use compatible font - provided ArialMT_Plain_10/16/24 by 'ThingPulse/esp8266-oled-ssd1306'
|
||||||
// have empty chars for non-latin ASCII symbols
|
// library have empty chars for non-latin ASCII symbols
|
||||||
case 0xD0: {
|
case 0xD0: {
|
||||||
SKIPREST = false;
|
SKIPREST = false;
|
||||||
if (ch == 129) return (uint8_t)(168); // Ё
|
if (ch == 129)
|
||||||
if (ch > 143 && ch < 192) return (uint8_t)(ch + 48);
|
return (uint8_t)(168); // Ё
|
||||||
break;
|
if (ch > 143 && ch < 192)
|
||||||
}
|
return (uint8_t)(ch + 48);
|
||||||
case 0xD1: {
|
break;
|
||||||
SKIPREST = false;
|
}
|
||||||
if (ch == 145) return (uint8_t)(184); // ё
|
case 0xD1: {
|
||||||
if (ch > 127 && ch < 144) return (uint8_t)(ch + 112);
|
SKIPREST = false;
|
||||||
break;
|
if (ch == 145)
|
||||||
}
|
return (uint8_t)(184); // ё
|
||||||
|
if (ch > 127 && ch < 144)
|
||||||
|
return (uint8_t)(ch + 112);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to strip out prefix chars for two-byte char formats
|
// We want to strip out prefix chars for two-byte char formats
|
||||||
|
32
src/main.cpp
32
src/main.cpp
@ -3,12 +3,12 @@
|
|||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
|
#include "ReliableRouter.h"
|
||||||
#include "airtime.h"
|
#include "airtime.h"
|
||||||
#include "buzz.h"
|
#include "buzz.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "ReliableRouter.h"
|
|
||||||
// #include "debug.h"
|
// #include "debug.h"
|
||||||
#include "FSCommon.h"
|
#include "FSCommon.h"
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
@ -27,8 +27,8 @@
|
|||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
// #include <driver/rtc_io.h>
|
// #include <driver/rtc_io.h>
|
||||||
|
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
|
||||||
#include "mesh/eth/ethClient.h"
|
#include "mesh/eth/ethClient.h"
|
||||||
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
|
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "mesh/http/WebServer.h"
|
#include "mesh/http/WebServer.h"
|
||||||
@ -98,7 +98,8 @@ uint32_t serialSinceMsec;
|
|||||||
bool pmu_found;
|
bool pmu_found;
|
||||||
|
|
||||||
// Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan
|
// Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan
|
||||||
uint8_t nodeTelemetrySensorsMap[_TelemetrySensorType_MAX + 1] = { 0 }; // one is enough, missing elements will be initialized to 0 anyway.
|
uint8_t nodeTelemetrySensorsMap[_TelemetrySensorType_MAX + 1] = {
|
||||||
|
0}; // one is enough, missing elements will be initialized to 0 anyway.
|
||||||
|
|
||||||
Router *router = NULL; // Users of router don't care what sort of subclass implements that API
|
Router *router = NULL; // Users of router don't care what sort of subclass implements that API
|
||||||
|
|
||||||
@ -169,7 +170,7 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_PORT
|
#ifdef DEBUG_PORT
|
||||||
consoleInit(); // Set serial baud rate and init our mesh console
|
consoleInit(); // Set serial baud rate and init our mesh console
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
serialSinceMsec = millis();
|
serialSinceMsec = millis();
|
||||||
@ -249,12 +250,11 @@ void setup()
|
|||||||
powerStatus->observe(&power->newStatus);
|
powerStatus->observe(&power->newStatus);
|
||||||
power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration
|
power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration
|
||||||
|
|
||||||
|
|
||||||
#ifdef LILYGO_TBEAM_S3_CORE
|
#ifdef LILYGO_TBEAM_S3_CORE
|
||||||
// In T-Beam-S3-core, the I2C device cannot be scanned before power initialization, otherwise the device will be stuck
|
// In T-Beam-S3-core, the I2C device cannot be scanned before power initialization, otherwise the device will be stuck
|
||||||
// PCF8563 RTC in tbeam-s3 uses Wire1 to share I2C bus
|
// PCF8563 RTC in tbeam-s3 uses Wire1 to share I2C bus
|
||||||
Wire1.beginTransmission(PCF8563_RTC);
|
Wire1.beginTransmission(PCF8563_RTC);
|
||||||
if (Wire1.endTransmission() == 0){
|
if (Wire1.endTransmission() == 0) {
|
||||||
rtc_found = PCF8563_RTC;
|
rtc_found = PCF8563_RTC;
|
||||||
LOG_INFO("PCF8563 RTC found\n");
|
LOG_INFO("PCF8563 RTC found\n");
|
||||||
}
|
}
|
||||||
@ -452,18 +452,18 @@ void setup()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check if the radio chip matches the selected region
|
// check if the radio chip matches the selected region
|
||||||
|
|
||||||
if((config.lora.region == Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())){
|
if ((config.lora.region == Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())) {
|
||||||
LOG_WARN("Radio chip does not support 2.4GHz LoRa. Reverting to unset.\n");
|
LOG_WARN("Radio chip does not support 2.4GHz LoRa. Reverting to unset.\n");
|
||||||
config.lora.region = Config_LoRaConfig_RegionCode_UNSET;
|
config.lora.region = Config_LoRaConfig_RegionCode_UNSET;
|
||||||
nodeDB.saveToDisk(SEGMENT_CONFIG);
|
nodeDB.saveToDisk(SEGMENT_CONFIG);
|
||||||
if(!rIf->reconfigure()) {
|
if (!rIf->reconfigure()) {
|
||||||
LOG_WARN("Reconfigure failed, rebooting\n");
|
LOG_WARN("Reconfigure failed, rebooting\n");
|
||||||
screen->startRebootScreen();
|
screen->startRebootScreen();
|
||||||
rebootAtMsec = millis() + 5000;
|
rebootAtMsec = millis() + 5000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#if HAS_WIFI || HAS_ETHERNET
|
#if HAS_WIFI || HAS_ETHERNET
|
||||||
mqttInit();
|
mqttInit();
|
||||||
|
Loading…
Reference in New Issue
Block a user