From 942b7d21a2a5f2300f47243738fc031d001a5350 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 21 Feb 2024 19:40:14 +0000 Subject: [PATCH 001/322] PacketQueue thread communication --- src/concurrency/PacketQueue.h | 73 ++++++++++++++++++++++ src/main.cpp | 10 ++++ src/mesh/PhoneAPI.h | 6 +- src/mesh/api/PacketAPI.cpp | 80 +++++++++++++++++++++++++ src/mesh/api/PacketAPI.h | 36 +++++++++++ src/mesh/sharedMem/MeshPacketServer.cpp | 44 ++++++++++++++ src/mesh/sharedMem/MeshPacketServer.h | 20 +++++++ src/mesh/sharedMem/Packet.h | 62 +++++++++++++++++++ src/mesh/sharedMem/PacketClient.cpp | 57 ++++++++++++++++++ src/mesh/sharedMem/PacketClient.h | 27 +++++++++ src/mesh/sharedMem/PacketServer.cpp | 51 ++++++++++++++++ src/mesh/sharedMem/PacketServer.h | 25 ++++++++ src/mesh/sharedMem/SharedQueue.cpp | 37 ++++++++++++ src/mesh/sharedMem/SharedQueue.h | 35 +++++++++++ variants/portduino/platformio.ini | 7 ++- variants/t-deck/platformio.ini | 1 + 16 files changed, 566 insertions(+), 5 deletions(-) create mode 100644 src/concurrency/PacketQueue.h create mode 100644 src/mesh/api/PacketAPI.cpp create mode 100644 src/mesh/api/PacketAPI.h create mode 100644 src/mesh/sharedMem/MeshPacketServer.cpp create mode 100644 src/mesh/sharedMem/MeshPacketServer.h create mode 100644 src/mesh/sharedMem/Packet.h create mode 100644 src/mesh/sharedMem/PacketClient.cpp create mode 100644 src/mesh/sharedMem/PacketClient.h create mode 100644 src/mesh/sharedMem/PacketServer.cpp create mode 100644 src/mesh/sharedMem/PacketServer.h create mode 100644 src/mesh/sharedMem/SharedQueue.cpp create mode 100644 src/mesh/sharedMem/SharedQueue.h diff --git a/src/concurrency/PacketQueue.h b/src/concurrency/PacketQueue.h new file mode 100644 index 0000000000..312dac5e5a --- /dev/null +++ b/src/concurrency/PacketQueue.h @@ -0,0 +1,73 @@ +#pragma once + +#include +#include +#include + +#ifdef BLOCKING_PACKET_QUEUE +#include +#endif + +/** + * Generic platform independent and re-entrant queue wrapper that can be used to + * safely pass (generic) movable objects between threads. + */ +template class PacketQueue +{ + public: + PacketQueue() {} + + PacketQueue(PacketQueue const &other) = delete; + + /** + * Push movable object into queue + */ + void push(T &&packet) + { + std::lock_guard lock(mutex); + queue.push(packet.move()); +#ifdef BLOCKING_PACKET_QUEUE + cond.notify_one(); +#endif + } + +#ifdef BLOCKING_PACKET_QUEUE + /** + * Pop movable object from queue (blocking) + */ + std::unique_ptr pop(void) + { + std::unique_lock lock(mutex); + cond.wait(lock, [this] { return !queue.empty(); }); + T packet = queue.front()->move(); + queue.pop(); + return packet; + } +#endif + + /** + * Pop movable object from queue (non-blocking) + */ + std::unique_ptr try_pop() + { + std::lock_guard lock(mutex); + if (queue.empty()) + return {nullptr}; // std::move(T()); + auto packet = queue.front()->move(); + queue.pop(); + return packet; + } + + uint32_t size() const + { + std::lock_guard lock(mutex); + return queue.size(); + } + + private: + mutable std::mutex mutex; + std::queue> queue; +#ifdef BLOCKING_PACKET_QUEUE + std::condition_variable cond; +#endif +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index fbfb983d24..92c651489b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -89,6 +89,11 @@ NRF52Bluetooth *nrf52Bluetooth; AudioThread *audioThread; #endif +#ifdef USE_PACKET_API +#include "sharedMem/MeshPacketServer.h" +#include "sharedMem/PacketClient.h" +#endif + using namespace concurrency; // We always create a screen object, but we only init it if we find the hardware @@ -860,6 +865,11 @@ void setup() initApiServer(TCPPort); #endif +#ifdef USE_PACKET_API + MeshPacketServer::init(); + PacketClient::init(); +#endif + // Start airtime logger thread. airTime = new AirTime(); diff --git a/src/mesh/PhoneAPI.h b/src/mesh/PhoneAPI.h index 450649d7bc..9a6ec4b85e 100644 --- a/src/mesh/PhoneAPI.h +++ b/src/mesh/PhoneAPI.h @@ -124,6 +124,9 @@ class PhoneAPI */ virtual void handleDisconnect(); + /// begin a new connection + void handleStartConfig(); + private: void releasePhonePacket(); @@ -131,9 +134,6 @@ class PhoneAPI void releaseMqttClientProxyPhonePacket(); - /// begin a new connection - void handleStartConfig(); - /** * Handle a packet that the phone wants us to send. We can write to it but can not keep a reference to it * @return true true if a packet was queued for sending diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp new file mode 100644 index 0000000000..d5507c98a5 --- /dev/null +++ b/src/mesh/api/PacketAPI.cpp @@ -0,0 +1,80 @@ +#include "api/PacketAPI.h" +#include "MeshService.h" +#include "RadioInterface.h" +#include "sharedMem/MeshPacketServer.h" + +PacketAPI *packetAPI = nullptr; + +void PacketAPI::init(void) {} + +PacketAPI::PacketAPI(PacketServer *_server) : concurrency::OSThread("PacketAPI"), isConnected(false), server(_server) {} + +int32_t PacketAPI::runOnce() +{ + bool success = sendPacket(); + success |= receivePacket(); + return success ? 10 : 50; +} + +bool PacketAPI::receivePacket(void) +{ + if (server->hasData()) { + isConnected = true; + + // TODO: think about redesign or drop class MeshPacketServer + meshtastic_ToRadio *mr; + // if (typeid(*server) == typeid(MeshPacketServer)) { + // dynamic_cast(server)->receivePacket(*mr); + // } + // else { + auto p = server->receivePacket()->move(); + int id = p->getPacketId(); + LOG_DEBUG("Received packet id=%u\n", id); + // mr = (meshtastic_ToRadio*)&dynamic_cast*>(p.get())->getData(); + mr = (meshtastic_ToRadio *)&static_cast *>(p.get())->getData(); + //} + + switch (mr->which_payload_variant) { + case meshtastic_ToRadio_packet_tag: { + meshtastic_MeshPacket *mp = &mr->packet; + printPacket("PACKET FROM QUEUE", mp); + service.handleToRadio(*mp); + break; + } + case meshtastic_ToRadio_want_config_id_tag: { + uint32_t config_nonce = mr->want_config_id; + LOG_INFO("Screen wants config, nonce=%u\n", config_nonce); + handleStartConfig(); + break; + } + default: + LOG_ERROR("Error: unhandled meshtastic_ToRadio variant: %d\n", mr->which_payload_variant); + break; + } + return true; + } else + return false; +} + +bool PacketAPI::sendPacket(void) +{ + // fill dummy buffer; we don't use it, we directly send the fromRadio structure + uint32_t len = getFromRadio(txBuf); + if (len != 0) { + // TODO: think about redesign or drop class MeshPacketServer + // if (typeid(*server) == typeid(MeshPacketServer)) + // return dynamic_cast(server)->sendPacket(fromRadioScratch); + // else + return server->sendPacket(DataPacket(fromRadioScratch.id, fromRadioScratch)); + } else + return false; +} + +/** + * return true if we got (once!) contact from our client and the server send queue is not full + */ +bool PacketAPI::checkIsConnected() +{ + isConnected |= server->hasData(); + return isConnected && server->available(); +} diff --git a/src/mesh/api/PacketAPI.h b/src/mesh/api/PacketAPI.h new file mode 100644 index 0000000000..015bec2247 --- /dev/null +++ b/src/mesh/api/PacketAPI.h @@ -0,0 +1,36 @@ +#pragma once + +#include "PhoneAPI.h" +#include "concurrency/OSThread.h" +#include "sharedMem/PacketServer.h" + +/** + * A version of the phone API used for inter task communication based on protobuf packets, e.g. + * between two tasks running on CPU0 and CPU1, respectively. + * + */ +class PacketAPI : public PhoneAPI, public concurrency::OSThread +{ + public: + PacketAPI(PacketServer *_server); + static void init(void); + virtual ~PacketAPI(){}; + virtual int32_t runOnce(); + + protected: + // Check the current underlying physical queue to see if the client is fetching packets + bool checkIsConnected() override; + + void onNowHasData(uint32_t fromRadioNum) override {} + void onConnectionChanged(bool connected) override {} + + private: + bool receivePacket(void); + bool sendPacket(void); + + bool isConnected; + PacketServer *server; + uint8_t txBuf[MAX_TO_FROM_RADIO_SIZE] = {0}; // dummy buf to obey PhoneAPI +}; + +extern PacketAPI *packetAPI; \ No newline at end of file diff --git a/src/mesh/sharedMem/MeshPacketServer.cpp b/src/mesh/sharedMem/MeshPacketServer.cpp new file mode 100644 index 0000000000..8df56ab4a8 --- /dev/null +++ b/src/mesh/sharedMem/MeshPacketServer.cpp @@ -0,0 +1,44 @@ +#include "sharedMem/MeshPacketServer.h" +#include "api/PacketAPI.h" +#include "sharedMem/SharedQueue.h" + +SharedQueue *sharedQueue = nullptr; + +MeshPacketServer *meshPacketServer = nullptr; + +void MeshPacketServer::init(void) +{ + meshPacketServer = new MeshPacketServer; + packetAPI = new PacketAPI(meshPacketServer); + meshPacketServer->begin(); +} + +MeshPacketServer::MeshPacketServer() {} + +void MeshPacketServer::begin(void) +{ + sharedQueue = new SharedQueue; + PacketServer::begin(sharedQueue); +} + +bool MeshPacketServer::receivePacket(meshtastic_ToRadio &to) +{ + // auto p = PacketServer::receivePacket()->move(); + auto p = PacketServer::receivePacket()->move(); + if (p) { + // TODO: avoid data copy :( + // to = dynamic_cast*>(p.get())->getData(); + to = static_cast *>(p.get())->getData(); + } + return p != nullptr; +} + +bool MeshPacketServer::sendPacket(meshtastic_FromRadio &from) +{ + return PacketServer::sendPacket(DataPacket(from.id, from)); +} + +bool MeshPacketServer::sendPacket(meshtastic_FromRadio &&from) +{ + return PacketServer::sendPacket(DataPacket(from.id, from)); +} diff --git a/src/mesh/sharedMem/MeshPacketServer.h b/src/mesh/sharedMem/MeshPacketServer.h new file mode 100644 index 0000000000..858f968df9 --- /dev/null +++ b/src/mesh/sharedMem/MeshPacketServer.h @@ -0,0 +1,20 @@ +#include "mesh-pb-constants.h" +#include "sharedMem/PacketServer.h" + +/** + * @brief This is a wrapper class for the PaketServer to avoid dealing with DataPackets + * in the application code. + * + */ +class MeshPacketServer : public PacketServer +{ + public: + MeshPacketServer(); + static void init(void); + virtual void begin(void); + virtual bool receivePacket(meshtastic_ToRadio &to); + virtual bool sendPacket(meshtastic_FromRadio &from); + virtual bool sendPacket(meshtastic_FromRadio &&from); +}; + +extern MeshPacketServer *meshPacketServer; \ No newline at end of file diff --git a/src/mesh/sharedMem/Packet.h b/src/mesh/sharedMem/Packet.h new file mode 100644 index 0000000000..5ddff3f8ec --- /dev/null +++ b/src/mesh/sharedMem/Packet.h @@ -0,0 +1,62 @@ +#pragma once + +#include + +/** + * Polymorphic packets that can be moved into and out of packet queues. + */ +class Packet +{ + public: + using PacketPtr = std::unique_ptr; + + Packet(int packetId) : id(packetId) {} + + // virtual move constructor + virtual PacketPtr move() { return PacketPtr(new Packet(std::move(*this))); } + + // Disable copying + Packet(const Packet &) = delete; + Packet &operator=(const Packet &) = delete; + + virtual ~Packet() {} + + int getPacketId() const { return id; } + + protected: + // Enable moving + Packet(Packet &&) = default; + Packet &operator=(Packet &&) = default; + + private: + int id; +}; + +/** + * generic packet type class + */ +template class DataPacket : public Packet +{ + public: + template DataPacket(int id, Args &&...args) : Packet(id), data(new PacketType(std::forward(args)...)) + { + } + + PacketPtr move() override { return PacketPtr(new DataPacket(std::move(*this))); } + + // Disable copying + DataPacket(const DataPacket &) = delete; + DataPacket &operator=(const DataPacket &) = delete; + + virtual ~DataPacket() {} + + const PacketType &getData() const { return *data; } + + protected: + // Enable moving + DataPacket(DataPacket &&) = default; + DataPacket &operator=(DataPacket &&) = default; + + private: + std::unique_ptr data; +}; diff --git a/src/mesh/sharedMem/PacketClient.cpp b/src/mesh/sharedMem/PacketClient.cpp new file mode 100644 index 0000000000..82eb4f67e8 --- /dev/null +++ b/src/mesh/sharedMem/PacketClient.cpp @@ -0,0 +1,57 @@ +#include "sharedMem/PacketClient.h" +#include "DebugConfiguration.h" +#include "sharedMem/SharedQueue.h" +#include + +const uint32_t max_packet_queue_size = 10; + +PacketClient *packetClient = nullptr; + +void PacketClient::init(void) +{ + // for now we hard-code (only) one client task, but in principle one could + // create as many PacketServer/PacketClient pairs as desired. + packetClient = new PacketClient(); + packetClient->connect(sharedQueue); +} + +PacketClient::PacketClient() : queue(nullptr) {} + +int PacketClient::connect(SharedQueue *_queue) +{ + if (!queue) { + queue = _queue; + } else if (_queue != queue) { + LOG_WARN("Client already connected."); + } + return queue->serverQueueSize(); +} + +Packet::PacketPtr PacketClient::receivePacket() +{ + assert(queue); + if (queue->serverQueueSize() == 0) + return {nullptr}; + return queue->clientReceive(); +} + +bool PacketClient::sendPacket(Packet &&p) +{ + assert(queue); + if (queue->clientQueueSize() >= max_packet_queue_size) + return false; + queue->clientSend(std::move(p)); + return true; +} + +bool PacketClient::hasData() const +{ + assert(queue); + return queue->serverQueueSize() > 0; +} + +bool PacketClient::available() const +{ + assert(queue); + return queue->clientQueueSize() < max_packet_queue_size; +} diff --git a/src/mesh/sharedMem/PacketClient.h b/src/mesh/sharedMem/PacketClient.h new file mode 100644 index 0000000000..4da3c34ec0 --- /dev/null +++ b/src/mesh/sharedMem/PacketClient.h @@ -0,0 +1,27 @@ +#pragma once + +#include "Packet.h" + +class SharedQueue; + +/** + * @brief Generic client implementation to receive from and + * send packets to the shared queue + * + */ +class PacketClient +{ + public: + PacketClient(); + static void init(void); + virtual int connect(SharedQueue *_queue); + virtual bool sendPacket(Packet &&p); + virtual Packet::PacketPtr receivePacket(); + virtual bool hasData() const; + virtual bool available() const; + + private: + SharedQueue *queue; +}; + +extern PacketClient *packetClient; diff --git a/src/mesh/sharedMem/PacketServer.cpp b/src/mesh/sharedMem/PacketServer.cpp new file mode 100644 index 0000000000..5c9d692ad2 --- /dev/null +++ b/src/mesh/sharedMem/PacketServer.cpp @@ -0,0 +1,51 @@ +#include "sharedMem/PacketServer.h" +#include "sharedMem/SharedQueue.h" +#include + +const uint32_t max_packet_queue_size = 50; + +PacketServer::PacketServer() : queue(nullptr) {} + +void PacketServer::begin(SharedQueue *_queue) +{ + queue = _queue; +} + +#if 1 +Packet::PacketPtr PacketServer::receivePacket(void) +{ + assert(queue); + if (queue->clientQueueSize() == 0) + return {nullptr}; + return queue->serverReceive(); +} +#else // template variant with typed return values +template <> Packet::PacketPtr PacketServer::receivePacket() +{ + assert(queue); + if (queue->clientQueueSize() == 0) + return {nullptr}; + return queue->serverReceive(); +} +#endif + +bool PacketServer::sendPacket(Packet &&p) +{ + assert(queue); + if (queue->serverQueueSize() >= max_packet_queue_size) + return false; + queue->serverSend(std::move(p)); + return true; +} + +bool PacketServer::hasData() const +{ + assert(queue); + return queue->clientQueueSize() > 0; +} + +bool PacketServer::available() const +{ + assert(queue); + return queue->serverQueueSize() < max_packet_queue_size; +} diff --git a/src/mesh/sharedMem/PacketServer.h b/src/mesh/sharedMem/PacketServer.h new file mode 100644 index 0000000000..34152ff14e --- /dev/null +++ b/src/mesh/sharedMem/PacketServer.h @@ -0,0 +1,25 @@ +#pragma once + +#include "concurrency/PacketQueue.h" +#include "sharedMem/Packet.h" + +class SharedQueue; + +/** + * Generic server implementation (base class) for bidirectional task communication + * Uses a queue that is shared with the + */ +class PacketServer +{ + public: + PacketServer(); + virtual void begin(SharedQueue *_queue); + virtual bool sendPacket(Packet &&p); + virtual Packet::PacketPtr receivePacket(); + // template T receivePacket(); + virtual bool hasData() const; + virtual bool available() const; + + private: + SharedQueue *queue; +}; diff --git a/src/mesh/sharedMem/SharedQueue.cpp b/src/mesh/sharedMem/SharedQueue.cpp new file mode 100644 index 0000000000..f1971c4b01 --- /dev/null +++ b/src/mesh/sharedMem/SharedQueue.cpp @@ -0,0 +1,37 @@ +#include "sharedMem/SharedQueue.h" + +SharedQueue::SharedQueue() {} + +SharedQueue::~SharedQueue() {} + +bool SharedQueue::serverSend(Packet &&p) +{ + serverQueue.push(std::move(p)); + return true; +} + +Packet::PacketPtr SharedQueue::serverReceive() +{ + return clientQueue.try_pop(); +} + +size_t SharedQueue::serverQueueSize() const +{ + return serverQueue.size(); +} + +bool SharedQueue::clientSend(Packet &&p) +{ + clientQueue.push(std::move(p)); + return true; +} + +Packet::PacketPtr SharedQueue::clientReceive() +{ + return serverQueue.try_pop(); +} + +size_t SharedQueue::clientQueueSize() const +{ + return clientQueue.size(); +} diff --git a/src/mesh/sharedMem/SharedQueue.h b/src/mesh/sharedMem/SharedQueue.h new file mode 100644 index 0000000000..9b5ea4ca0d --- /dev/null +++ b/src/mesh/sharedMem/SharedQueue.h @@ -0,0 +1,35 @@ +#pragma once + +#include "concurrency/PacketQueue.h" +#include "sharedMem/Packet.h" + +/** + * @brief Queue wrapper that aggregates two thread queues (namely client and server) + * for bidirectional packet transfer between two threads or processes. + * + * This queue may also be created in shared memory (e.g. in Linux for inter-process communication) + */ +class SharedQueue +{ + public: + SharedQueue(); + virtual ~SharedQueue(); + + // server methods + virtual bool serverSend(Packet &&p); + virtual Packet::PacketPtr serverReceive(); + virtual size_t serverQueueSize() const; + + // client methods + virtual bool clientSend(Packet &&p); + virtual Packet::PacketPtr clientReceive(); + virtual size_t clientQueueSize() const; + + private: + // the server pushes into serverQueue and the client pushes into clientQueue + // receiving is done from the opposite queue, respectively + PacketQueue serverQueue; + PacketQueue clientQueue; +}; + +extern SharedQueue *sharedQueue; \ No newline at end of file diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index d37c6be21f..957c20006c 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -1,6 +1,9 @@ [env:native] extends = portduino_base -build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino +build_flags = ${portduino_base.build_flags} -O0 + -I variants/portduino + -D USE_PACKET_API + -D DEBUG_HEAP board = cross_platform lib_deps = ${portduino_base.lib_deps} -build_src_filter = ${portduino_base.build_src_filter} \ No newline at end of file +build_src_filter = ${portduino_base.build_src_filter} + \ No newline at end of file diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index cb60333005..14ab09804d 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -5,6 +5,7 @@ board = t-deck upload_protocol = esptool #upload_port = COM29 +build_src_filter = ${esp32_base.build_src_filter} + build_flags = ${esp32_base.build_flags} -DT_DECK -DBOARD_HAS_PSRAM From fbdfa92d4b8c0d9c46c7d2714efeda87c911ea5d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 26 Feb 2024 12:23:51 +0100 Subject: [PATCH 002/322] start device-ui integration --- .gitmodules | 3 +++ lib/device-ui | 1 + src/ButtonThread.cpp | 1 - src/graphics/Screen.cpp | 2 +- src/main.cpp | 18 +++++++++++++-- src/mesh/sharedMem/PacketClient.cpp | 2 +- src/modules/CannedMessageModule.h | 2 +- src/modules/Modules.cpp | 2 +- variants/t-deck/platformio.ini | 36 +++++++++++++++++++---------- 9 files changed, 48 insertions(+), 19 deletions(-) create mode 160000 lib/device-ui diff --git a/.gitmodules b/.gitmodules index e6f376a0b3..eb08b22916 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "protobufs"] path = protobufs url = https://github.com/meshtastic/protobufs.git +[submodule "lib/device-ui"] + path = lib/device-ui + url = https://github.com/mverch67/device-ui.git diff --git a/lib/device-ui b/lib/device-ui new file mode 160000 index 0000000000..de3a8b6e25 --- /dev/null +++ b/lib/device-ui @@ -0,0 +1 @@ +Subproject commit de3a8b6e2503cdc199b6dde9a90c34ffbda72cb6 diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 84d4332852..b4cf46b998 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -3,7 +3,6 @@ #include "MeshService.h" #include "PowerFSM.h" #include "RadioLibInterface.h" -#include "buzz.h" #include "graphics/Screen.h" #include "main.h" #include "modules/ExternalNotificationModule.h" diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 33df78462a..286f57da5c 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -895,7 +895,7 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O #elif defined(USE_SSD1306) dispdev = new SSD1306Wire(address.address, -1, -1, geometry, (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); -#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014) +#elif (defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014)) && !HAS_TFT dispdev = new TFTDisplay(address.address, -1, -1, geometry, (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); #elif defined(USE_EINK) && !defined(USE_EINK_DYNAMICDISPLAY) diff --git a/src/main.cpp b/src/main.cpp index 92c651489b..3f3686374e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -94,6 +94,11 @@ AudioThread *audioThread; #include "sharedMem/PacketClient.h" #endif +#ifdef LGFX_TDECK +#include "DeviceScreen.h" +DeviceScreen *screen = nullptr; +#endif + using namespace concurrency; // We always create a screen object, but we only init it if we find the hardware @@ -352,13 +357,17 @@ void setup() #endif #endif -#ifdef T_DECK +#if defined(T_DECK) // enable keyboard pinMode(KB_POWERON, OUTPUT); digitalWrite(KB_POWERON, HIGH); // There needs to be a delay after power on, give LILYGO-KEYBOARD some startup time // otherwise keyboard and touch screen will not work - delay(800); + delay(200); +#ifdef LGFX_TDECK + screen = &DeviceScreen::create(); + screen->init(); +#endif #endif // Currently only the tbeam has a PMU @@ -888,6 +897,11 @@ void setup() PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS powerFSMthread = new PowerFSMThread(); setCPUFast(false); // 80MHz is fine for our slow peripherals + +#ifdef ARDUINO_ARCH_ESP32 + LOG_DEBUG("--- Free heap : %8d bytes ---\n", ESP.getFreeHeap()); + LOG_DEBUG("--- PSRAM : %8d bytes ---\n", ESP.getFreePsram()); +#endif } uint32_t rebootAtMsec; // If not zero we will reboot at this time (used to reboot shortly after the update completes) diff --git a/src/mesh/sharedMem/PacketClient.cpp b/src/mesh/sharedMem/PacketClient.cpp index 82eb4f67e8..4ef7b0c9dc 100644 --- a/src/mesh/sharedMem/PacketClient.cpp +++ b/src/mesh/sharedMem/PacketClient.cpp @@ -1,5 +1,5 @@ #include "sharedMem/PacketClient.h" -#include "DebugConfiguration.h" +#include "configuration.h" #include "sharedMem/SharedQueue.h" #include diff --git a/src/modules/CannedMessageModule.h b/src/modules/CannedMessageModule.h index 4802be0781..2f5b572411 100644 --- a/src/modules/CannedMessageModule.h +++ b/src/modules/CannedMessageModule.h @@ -1,5 +1,5 @@ #pragma once -#if HAS_SCREEN +#if HAS_SCREEN || HAS_TFT #include "ProtobufModule.h" #include "input/InputBroker.h" diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index 2d45868fd8..96e3ee30d0 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -94,7 +94,7 @@ void setupModules() trackballInterruptImpl1 = new TrackballInterruptImpl1(); trackballInterruptImpl1->init(); #endif -#if HAS_SCREEN +#if HAS_SCREEN || HAS_TFT cannedMessageModule = new CannedMessageModule(); #endif #if HAS_TELEMETRY diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 14ab09804d..6dca51279c 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -2,17 +2,29 @@ [env:t-deck] extends = esp32s3_base board = t-deck -upload_protocol = esptool -#upload_port = COM29 - +upload_protocol = esp-builtin +build_flags = ${esp32_base.build_flags} + -D T_DECK + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D GPS_POWER_TOGGLE + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D CALIBRATE_TOUCH + -D KB_POWERON=10 + -D LGFX_DRIVER=LGFX_TDECK + -D LGFX_DRIVER_INC=\"LGFX_T_DECK.h\" + -D VIEW_320x240 + -D VIEW_CLASS=TFTView_320x240 + -D VIEW_CLASS_INC=\"TFTView_320x240.h\" + -D USE_DOUBLE_BUFFER + -I lib/device-ui/generated/ui_320x240 + -I variants/t-deck build_src_filter = ${esp32_base.build_src_filter} + -build_flags = ${esp32_base.build_flags} - -DT_DECK - -DBOARD_HAS_PSRAM - -DGPS_POWER_TOGGLE - -Ivariants/t-deck - -lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.9 + +<../lib/device-ui/generated/ui_320x240> +libdeps = + ${esp32_base.lib_deps} + lovyan03/LovyanGFX@^1.1.12 earlephilhower/ESP8266Audio@^1.9.7 - earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file + earlephilhower/ESP8266SAM@^1.0.1 From cc359aaab9daeedb180b231d868de3950d258446 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 26 Feb 2024 12:33:23 +0100 Subject: [PATCH 003/322] fix libs --- variants/t-deck/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 6dca51279c..b727b29d49 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -23,7 +23,7 @@ build_flags = ${esp32_base.build_flags} -I variants/t-deck build_src_filter = ${esp32_base.build_src_filter} + +<../lib/device-ui/generated/ui_320x240> -libdeps = +lib_deps = ${esp32_base.lib_deps} lovyan03/LovyanGFX@^1.1.12 earlephilhower/ESP8266Audio@^1.9.7 From 125ecca85f075338a041cb4df1c2adf018075501 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 26 Feb 2024 13:34:56 +0100 Subject: [PATCH 004/322] fix compilation for native + t-deck --- arch/portduino/portduino.ini | 2 +- src/ButtonThread.cpp | 1 + src/graphics/Screen.cpp | 4 +-- src/graphics/TFTDisplay.cpp | 2 +- src/modules/CannedMessageModule.cpp | 4 ++- src/modules/CannedMessageModule.h | 2 ++ variants/portduino/platformio.ini | 38 +++++++++++++++++++++++++---- 7 files changed, 43 insertions(+), 10 deletions(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 0dcc9afc21..172157de10 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -23,7 +23,7 @@ lib_deps = ${env.lib_deps} ${networking_base.lib_deps} rweather/Crypto@^0.4.0 - lovyan03/LovyanGFX@^1.1.12 + ;lovyan03/LovyanGFX@^1.1.12 build_flags = ${arduino_base.build_flags} diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index b4cf46b998..84d4332852 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -3,6 +3,7 @@ #include "MeshService.h" #include "PowerFSM.h" #include "RadioLibInterface.h" +#include "buzz.h" #include "graphics/Screen.h" #include "main.h" #include "modules/ExternalNotificationModule.h" diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 286f57da5c..d7b5a29f60 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -907,7 +907,7 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O #elif defined(USE_ST7567) dispdev = new ST7567Wire(address.address, -1, -1, geometry, (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); -#elif ARCH_PORTDUINO +#elif ARCH_PORTDUINO && !HAS_TFT if (settingsMap[displayPanel] != no_screen) { LOG_DEBUG("Making TFTDisplay!\n"); dispdev = new TFTDisplay(address.address, -1, -1, geometry, @@ -1056,7 +1056,7 @@ void Screen::setup() #endif serialSinceMsec = millis(); -#if ARCH_PORTDUINO +#if ARCH_PORTDUINO && !HAS_TFT if (settingsMap[touchscreenModule]) { touchScreenImpl1 = new TouchScreenImpl1(dispdev->getWidth(), dispdev->getHeight(), static_cast(dispdev)->getTouch); diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 9475e0296d..22f51a74ae 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -333,7 +333,7 @@ static LGFX *tft = nullptr; #include // Graphics and font library for ILI9341 driver chip static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h -#elif ARCH_PORTDUINO +#elif ARCH_PORTDUINO && !HAS_TFT #include // Graphics and font library for ST7735 driver chip class LGFX : public lgfx::LGFX_Device diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index b2b52d1ab3..98a192be96 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -2,7 +2,7 @@ #if ARCH_PORTDUINO #include "PortduinoGlue.h" #endif -#if HAS_SCREEN +#if HAS_SCREEN || HAS_TFT #include "CannedMessageModule.h" #include "Channels.h" #include "FSCommon.h" @@ -497,6 +497,7 @@ int CannedMessageModule::getPrevIndex() } } +#if !HAS_TFT void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { char buffer[50]; @@ -594,6 +595,7 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st } } } +#endif ProcessMessage CannedMessageModule::handleReceived(const meshtastic_MeshPacket &mp) { diff --git a/src/modules/CannedMessageModule.h b/src/modules/CannedMessageModule.h index 2f5b572411..d240085698 100644 --- a/src/modules/CannedMessageModule.h +++ b/src/modules/CannedMessageModule.h @@ -79,7 +79,9 @@ class CannedMessageModule : public SinglePortModule, public ObservableshouldDraw(); } virtual Observable *getUIFrameObservable() override { return this; } +#if !HAS_TFT virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override; +#endif virtual AdminMessageHandleResult handleAdminMessageForModule(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *request, meshtastic_AdminMessage *response) override; diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 957c20006c..2c42b6ea1b 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -1,9 +1,37 @@ [env:native] +;extends = portduino_base +;build_flags = ${portduino_base.build_flags} -O0 +; -I variants/portduino +;board = cross_platform +;lib_deps = ${portduino_base.lib_deps} +; lovyan03/LovyanGFX@^1.1.12 +;build_src_filter = ${portduino_base.build_src_filter} + +;[env:native-x11-320x240] extends = portduino_base -build_flags = ${portduino_base.build_flags} -O0 - -I variants/portduino - -D USE_PACKET_API - -D DEBUG_HEAP +build_flags = ${portduino_base.build_flags} -O0 -lX11 + -I variants/portduino + -D DEBUG_HEAP + -D SIMULATOR=1 + -D HAS_TFT=1 + -D HAS_SCREEN=0 + -D USE_X11=1 + -D USE_PACKET_API + -D VIEW_320x240 + -D VIEW_CLASS=TFTView_320x240 + -D VIEW_CLASS_INC=\"TFTView_320x240.h\" + -D LV_BUILD_TEST=0 + -D DISP_HOR_RES=320 + -D DISP_VER_RES=240 + -DLV_LVGL_H_INCLUDE_SIMPLE + -DLV_CONF_INCLUDE_SIMPLE + -DLV_COMP_CONF_INCLUDE_SIMPLE + -I lib/device-ui/generated/ui_320x240 board = cross_platform lib_deps = ${portduino_base.lib_deps} -build_src_filter = ${portduino_base.build_src_filter} + \ No newline at end of file + https://github.com/lvgl/lv_drivers.git ; x11 is currently only supported in master branch, not in 8.3.0 +build_src_filter = ${portduino_base.build_src_filter} + - + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> + + From 1997b3df9cafd45151ce83d18dc1269eaad6377f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 26 Feb 2024 16:47:33 +0100 Subject: [PATCH 005/322] fix native/x11 target --- src/configuration.h | 3 +++ variants/portduino/platformio.ini | 28 ++++++++++++++-------------- variants/t-deck/platformio.ini | 1 + 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index d8b0dba5f4..0309dc9c67 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -182,6 +182,9 @@ along with this program. If not, see . #ifndef HAS_SCREEN #define HAS_SCREEN 0 #endif +#ifndef HAS_TFT +#define HAS_TFT 0 +#endif #ifndef HAS_WIRE #define HAS_WIRE 0 #endif diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 2c42b6ea1b..9e2e102331 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -1,31 +1,31 @@ [env:native] -;extends = portduino_base -;build_flags = ${portduino_base.build_flags} -O0 -; -I variants/portduino -;board = cross_platform -;lib_deps = ${portduino_base.lib_deps} -; lovyan03/LovyanGFX@^1.1.12 -;build_src_filter = ${portduino_base.build_src_filter} +extends = portduino_base +build_flags = ${portduino_base.build_flags} -O0 + -I variants/portduino +board = cross_platform +lib_deps = ${portduino_base.lib_deps} + lovyan03/LovyanGFX@^1.1.12 +build_src_filter = ${portduino_base.build_src_filter} + -;[env:native-x11-320x240] +[env:native-x11-320x240] extends = portduino_base build_flags = ${portduino_base.build_flags} -O0 -lX11 -I variants/portduino -D DEBUG_HEAP - -D SIMULATOR=1 + -D USE_X11=1 -D HAS_TFT=1 -D HAS_SCREEN=0 - -D USE_X11=1 -D USE_PACKET_API -D VIEW_320x240 -D VIEW_CLASS=TFTView_320x240 -D VIEW_CLASS_INC=\"TFTView_320x240.h\" - -D LV_BUILD_TEST=0 -D DISP_HOR_RES=320 -D DISP_VER_RES=240 - -DLV_LVGL_H_INCLUDE_SIMPLE - -DLV_CONF_INCLUDE_SIMPLE - -DLV_COMP_CONF_INCLUDE_SIMPLE + -D LV_BUILD_TEST=0 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE -I lib/device-ui/generated/ui_320x240 board = cross_platform lib_deps = ${portduino_base.lib_deps} diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index b727b29d49..f97675ff1f 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -19,6 +19,7 @@ build_flags = ${esp32_base.build_flags} -D VIEW_CLASS=TFTView_320x240 -D VIEW_CLASS_INC=\"TFTView_320x240.h\" -D USE_DOUBLE_BUFFER + -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 -I variants/t-deck build_src_filter = ${esp32_base.build_src_filter} + From ce39c5133a149a4509a81663138a90e61202f451 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 26 Feb 2024 17:11:40 +0100 Subject: [PATCH 006/322] fix TFT initialization --- src/main.cpp | 16 +++++++--------- variants/portduino/platformio.ini | 1 - variants/t-deck/platformio.ini | 1 - 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3f3686374e..a0a39ec0e0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -89,14 +89,12 @@ NRF52Bluetooth *nrf52Bluetooth; AudioThread *audioThread; #endif -#ifdef USE_PACKET_API +#ifdef HAS_TFT +#include "DeviceScreen.h" #include "sharedMem/MeshPacketServer.h" #include "sharedMem/PacketClient.h" -#endif -#ifdef LGFX_TDECK -#include "DeviceScreen.h" -DeviceScreen *screen = nullptr; +DeviceScreen *deviceScreen = nullptr; #endif using namespace concurrency; @@ -364,10 +362,10 @@ void setup() // There needs to be a delay after power on, give LILYGO-KEYBOARD some startup time // otherwise keyboard and touch screen will not work delay(200); -#ifdef LGFX_TDECK - screen = &DeviceScreen::create(); - screen->init(); #endif +#ifdef HAS_TFT + deviceScreen = &DeviceScreen::create(); + deviceScreen->init(); #endif // Currently only the tbeam has a PMU @@ -874,7 +872,7 @@ void setup() initApiServer(TCPPort); #endif -#ifdef USE_PACKET_API +#ifdef HAS_TFT MeshPacketServer::init(); PacketClient::init(); #endif diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 9e2e102331..c7ebe2b74d 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -16,7 +16,6 @@ build_flags = ${portduino_base.build_flags} -O0 -lX11 -D USE_X11=1 -D HAS_TFT=1 -D HAS_SCREEN=0 - -D USE_PACKET_API -D VIEW_320x240 -D VIEW_CLASS=TFTView_320x240 -D VIEW_CLASS_INC=\"TFTView_320x240.h\" diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index f97675ff1f..b727b29d49 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -19,7 +19,6 @@ build_flags = ${esp32_base.build_flags} -D VIEW_CLASS=TFTView_320x240 -D VIEW_CLASS_INC=\"TFTView_320x240.h\" -D USE_DOUBLE_BUFFER - -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 -I variants/t-deck build_src_filter = ${esp32_base.build_src_filter} + From d72cbd956662d54921b1706e1b317adca97e84fe Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 26 Feb 2024 18:12:42 +0100 Subject: [PATCH 007/322] add tft task loop to main() --- src/main.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index a0a39ec0e0..1291a73c65 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -969,4 +969,15 @@ void loop() mainDelay.delay(delayMsec); } // if (didWake) LOG_DEBUG("wake!\n"); -} \ No newline at end of file +} + +#if HAS_TFT +void tft_task_handler(void) +{ + while (true) { + if (deviceScreen) + deviceScreen->task_handler(); + delay(20); + } +} +#endif \ No newline at end of file From e8021269604d55ad4dcfc2f01db175d780b13adc Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 26 Feb 2024 19:04:38 +0100 Subject: [PATCH 008/322] add thread loop to portduino --- arch/portduino/portduino.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 172157de10..a38e87c369 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based sim environment on top of any host OS, all hardware will be simulated [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#a28dd5a9ccd5c48a9bede46037855ff83915d74b +platform = https://github.com/meshtastic/platform-native.git#748f8d0d0a222a3d9738d0337e781c527a543b1e framework = arduino build_src_filter = From 04848439b9d89f2cd63dcd5b9ff5d89a1b630e2d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 28 Feb 2024 20:47:55 +0100 Subject: [PATCH 009/322] implement IClientBase interface --- src/main.cpp | 5 ++-- src/mesh/sharedMem/MeshPacketClient.cpp | 39 +++++++++++++++++++++++++ src/mesh/sharedMem/MeshPacketClient.h | 22 ++++++++++++++ src/mesh/sharedMem/MeshPacketServer.h | 2 ++ src/mesh/sharedMem/PacketClient.cpp | 23 +++++++++++---- src/mesh/sharedMem/PacketClient.h | 19 ++++++++---- variants/t-deck/platformio.ini | 1 + 7 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 src/mesh/sharedMem/MeshPacketClient.cpp create mode 100644 src/mesh/sharedMem/MeshPacketClient.h diff --git a/src/main.cpp b/src/main.cpp index 1291a73c65..aa174ae052 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -91,8 +91,8 @@ AudioThread *audioThread; #ifdef HAS_TFT #include "DeviceScreen.h" +#include "sharedMem/MeshPacketClient.h" #include "sharedMem/MeshPacketServer.h" -#include "sharedMem/PacketClient.h" DeviceScreen *deviceScreen = nullptr; #endif @@ -365,7 +365,7 @@ void setup() #endif #ifdef HAS_TFT deviceScreen = &DeviceScreen::create(); - deviceScreen->init(); + deviceScreen->init(new MeshPacketClient); #endif // Currently only the tbeam has a PMU @@ -874,7 +874,6 @@ void setup() #ifdef HAS_TFT MeshPacketServer::init(); - PacketClient::init(); #endif // Start airtime logger thread. diff --git a/src/mesh/sharedMem/MeshPacketClient.cpp b/src/mesh/sharedMem/MeshPacketClient.cpp new file mode 100644 index 0000000000..7560a16041 --- /dev/null +++ b/src/mesh/sharedMem/MeshPacketClient.cpp @@ -0,0 +1,39 @@ +#include "MeshPacketClient.h" + +void MeshPacketClient::init(void) +{ + PacketClient::init(); +} + +MeshPacketClient::MeshPacketClient() {} + +bool MeshPacketClient::connect(void) +{ + PacketClient::connect(); +} + +bool MeshPacketClient::disconnect(void) +{ + PacketClient::disconnect(); +} + +bool MeshPacketClient::isConnected(void) +{ + return PacketClient::isConnected(); +} + +bool MeshPacketClient::send(meshtastic_ToRadio &&to) +{ + static uint32_t id = 0; + PacketClient::sendPacket(DataPacket(++id, to)); +} + +meshtastic_FromRadio MeshPacketClient::receive(void) +{ + auto p = receivePacket()->move(); + if (p) { + return static_cast *>(p.get())->getData(); + } else { + return meshtastic_FromRadio(); + } +} diff --git a/src/mesh/sharedMem/MeshPacketClient.h b/src/mesh/sharedMem/MeshPacketClient.h new file mode 100644 index 0000000000..48ef8cb1ee --- /dev/null +++ b/src/mesh/sharedMem/MeshPacketClient.h @@ -0,0 +1,22 @@ +#pragma once + +#include "mesh-pb-constants.h" +#include "sharedMem/PacketClient.h" + +/** + * @brief This is a wrapper class for the PaketClient to avoid dealing with DataPackets + * in the application code. + * + */ +class MeshPacketClient : public PacketClient +{ + public: + MeshPacketClient(); + virtual void init(void); + virtual bool connect(void); + virtual bool disconnect(void); + virtual bool isConnected(void); + + virtual bool send(meshtastic_ToRadio &&to); + virtual meshtastic_FromRadio receive(void); +}; diff --git a/src/mesh/sharedMem/MeshPacketServer.h b/src/mesh/sharedMem/MeshPacketServer.h index 858f968df9..2d29db503d 100644 --- a/src/mesh/sharedMem/MeshPacketServer.h +++ b/src/mesh/sharedMem/MeshPacketServer.h @@ -1,3 +1,5 @@ +#pragma once + #include "mesh-pb-constants.h" #include "sharedMem/PacketServer.h" diff --git a/src/mesh/sharedMem/PacketClient.cpp b/src/mesh/sharedMem/PacketClient.cpp index 4ef7b0c9dc..2a819d1554 100644 --- a/src/mesh/sharedMem/PacketClient.cpp +++ b/src/mesh/sharedMem/PacketClient.cpp @@ -5,18 +5,29 @@ const uint32_t max_packet_queue_size = 10; -PacketClient *packetClient = nullptr; - void PacketClient::init(void) { - // for now we hard-code (only) one client task, but in principle one could - // create as many PacketServer/PacketClient pairs as desired. - packetClient = new PacketClient(); - packetClient->connect(sharedQueue); + // sharedQueue is currently defined external, it is not shared between processes + connect(sharedQueue); } PacketClient::PacketClient() : queue(nullptr) {} +bool PacketClient::connect(void) +{ + is_connected = true; +} + +bool PacketClient::disconnect(void) +{ + is_connected = false; +} + +bool PacketClient::isConnected(void) +{ + return is_connected; +} + int PacketClient::connect(SharedQueue *_queue) { if (!queue) { diff --git a/src/mesh/sharedMem/PacketClient.h b/src/mesh/sharedMem/PacketClient.h index 4da3c34ec0..3a8654d03f 100644 --- a/src/mesh/sharedMem/PacketClient.h +++ b/src/mesh/sharedMem/PacketClient.h @@ -1,5 +1,6 @@ #pragma once +#include "IClientBase.h" #include "Packet.h" class SharedQueue; @@ -9,19 +10,27 @@ class SharedQueue; * send packets to the shared queue * */ -class PacketClient +class PacketClient : public IClientBase { public: PacketClient(); - static void init(void); - virtual int connect(SharedQueue *_queue); + virtual void init(void); + virtual bool connect(void); + virtual bool disconnect(void); + virtual bool isConnected(void); + virtual bool sendPacket(Packet &&p); virtual Packet::PacketPtr receivePacket(); + virtual bool hasData() const; virtual bool available() const; + virtual ~PacketClient() = default; + + protected: + virtual int connect(SharedQueue *_queue); + private: + bool is_connected = false; SharedQueue *queue; }; - -extern PacketClient *packetClient; diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index b727b29d49..21acca9f25 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -2,6 +2,7 @@ [env:t-deck] extends = esp32s3_base board = t-deck +board_build.partitions = default_16MB.csv ; just for test upload_protocol = esp-builtin build_flags = ${esp32_base.build_flags} -D T_DECK From 7dfeedc0f5028919dbb853a9719a1436c656f3ac Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 28 Feb 2024 21:01:22 +0100 Subject: [PATCH 010/322] implement IClientBase interface --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index de3a8b6e25..7a48bab4ae 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit de3a8b6e2503cdc199b6dde9a90c34ffbda72cb6 +Subproject commit 7a48bab4ae128d6c14380dc278cd1a3bd6a0cdf1 From 12c22c7cd24cd6217026710905e21b6e45e310f3 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 5 Mar 2024 09:10:13 +0100 Subject: [PATCH 011/322] update Packet classes --- src/concurrency/PacketQueue.h | 2 +- src/mesh/api/PacketAPI.cpp | 13 ++++++++----- src/mesh/sharedMem/MeshPacketClient.cpp | 17 +++++++++-------- src/mesh/sharedMem/PacketClient.cpp | 3 +++ src/mesh/sharedMem/PacketClient.h | 2 +- src/mesh/sharedMem/PacketServer.cpp | 13 ++----------- src/mesh/sharedMem/PacketServer.h | 4 +++- variants/portduino/platformio.ini | 2 +- variants/t-deck/platformio.ini | 4 ++-- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/concurrency/PacketQueue.h b/src/concurrency/PacketQueue.h index 312dac5e5a..7c909e6823 100644 --- a/src/concurrency/PacketQueue.h +++ b/src/concurrency/PacketQueue.h @@ -52,7 +52,7 @@ template class PacketQueue { std::lock_guard lock(mutex); if (queue.empty()) - return {nullptr}; // std::move(T()); + return {nullptr}; auto packet = queue.front()->move(); queue.pop(); return packet; diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp index d5507c98a5..9b38db7a6b 100644 --- a/src/mesh/api/PacketAPI.cpp +++ b/src/mesh/api/PacketAPI.cpp @@ -18,8 +18,10 @@ int32_t PacketAPI::runOnce() bool PacketAPI::receivePacket(void) { - if (server->hasData()) { + bool data_received = false; + while (server->hasData()) { isConnected = true; + data_received = true; // TODO: think about redesign or drop class MeshPacketServer meshtastic_ToRadio *mr; @@ -51,9 +53,8 @@ bool PacketAPI::receivePacket(void) LOG_ERROR("Error: unhandled meshtastic_ToRadio variant: %d\n", mr->which_payload_variant); break; } - return true; - } else - return false; + } + return data_received; } bool PacketAPI::sendPacket(void) @@ -61,11 +62,13 @@ bool PacketAPI::sendPacket(void) // fill dummy buffer; we don't use it, we directly send the fromRadio structure uint32_t len = getFromRadio(txBuf); if (len != 0) { + static uint32_t id = 0; + fromRadioScratch.id = ++id; // TODO: think about redesign or drop class MeshPacketServer // if (typeid(*server) == typeid(MeshPacketServer)) // return dynamic_cast(server)->sendPacket(fromRadioScratch); // else - return server->sendPacket(DataPacket(fromRadioScratch.id, fromRadioScratch)); + return server->sendPacket(DataPacket(id, fromRadioScratch)); } else return false; } diff --git a/src/mesh/sharedMem/MeshPacketClient.cpp b/src/mesh/sharedMem/MeshPacketClient.cpp index 7560a16041..67a5350d2d 100644 --- a/src/mesh/sharedMem/MeshPacketClient.cpp +++ b/src/mesh/sharedMem/MeshPacketClient.cpp @@ -9,12 +9,12 @@ MeshPacketClient::MeshPacketClient() {} bool MeshPacketClient::connect(void) { - PacketClient::connect(); + return PacketClient::connect(); } bool MeshPacketClient::disconnect(void) { - PacketClient::disconnect(); + return PacketClient::disconnect(); } bool MeshPacketClient::isConnected(void) @@ -25,15 +25,16 @@ bool MeshPacketClient::isConnected(void) bool MeshPacketClient::send(meshtastic_ToRadio &&to) { static uint32_t id = 0; - PacketClient::sendPacket(DataPacket(++id, to)); + return PacketClient::sendPacket(DataPacket(++id, to)); } meshtastic_FromRadio MeshPacketClient::receive(void) { - auto p = receivePacket()->move(); - if (p) { - return static_cast *>(p.get())->getData(); - } else { - return meshtastic_FromRadio(); + if (hasData()) { + auto p = receivePacket(); + if (p) { + return static_cast *>(p->move().get())->getData(); + } } + return meshtastic_FromRadio(); } diff --git a/src/mesh/sharedMem/PacketClient.cpp b/src/mesh/sharedMem/PacketClient.cpp index 2a819d1554..221345d949 100644 --- a/src/mesh/sharedMem/PacketClient.cpp +++ b/src/mesh/sharedMem/PacketClient.cpp @@ -16,11 +16,13 @@ PacketClient::PacketClient() : queue(nullptr) {} bool PacketClient::connect(void) { is_connected = true; + return is_connected; } bool PacketClient::disconnect(void) { is_connected = false; + return is_connected; } bool PacketClient::isConnected(void) @@ -35,6 +37,7 @@ int PacketClient::connect(SharedQueue *_queue) } else if (_queue != queue) { LOG_WARN("Client already connected."); } + is_connected = true; return queue->serverQueueSize(); } diff --git a/src/mesh/sharedMem/PacketClient.h b/src/mesh/sharedMem/PacketClient.h index 3a8654d03f..a930472d63 100644 --- a/src/mesh/sharedMem/PacketClient.h +++ b/src/mesh/sharedMem/PacketClient.h @@ -31,6 +31,6 @@ class PacketClient : public IClientBase virtual int connect(SharedQueue *_queue); private: - bool is_connected = false; + volatile bool is_connected = false; SharedQueue *queue; }; diff --git a/src/mesh/sharedMem/PacketServer.cpp b/src/mesh/sharedMem/PacketServer.cpp index 5c9d692ad2..628592cc7e 100644 --- a/src/mesh/sharedMem/PacketServer.cpp +++ b/src/mesh/sharedMem/PacketServer.cpp @@ -11,7 +11,6 @@ void PacketServer::begin(SharedQueue *_queue) queue = _queue; } -#if 1 Packet::PacketPtr PacketServer::receivePacket(void) { assert(queue); @@ -19,21 +18,13 @@ Packet::PacketPtr PacketServer::receivePacket(void) return {nullptr}; return queue->serverReceive(); } -#else // template variant with typed return values -template <> Packet::PacketPtr PacketServer::receivePacket() -{ - assert(queue); - if (queue->clientQueueSize() == 0) - return {nullptr}; - return queue->serverReceive(); -} -#endif bool PacketServer::sendPacket(Packet &&p) { assert(queue); - if (queue->serverQueueSize() >= max_packet_queue_size) + if (queue->serverQueueSize() >= max_packet_queue_size) { return false; + } queue->serverSend(std::move(p)); return true; } diff --git a/src/mesh/sharedMem/PacketServer.h b/src/mesh/sharedMem/PacketServer.h index 34152ff14e..44044aa915 100644 --- a/src/mesh/sharedMem/PacketServer.h +++ b/src/mesh/sharedMem/PacketServer.h @@ -15,7 +15,9 @@ class PacketServer PacketServer(); virtual void begin(SharedQueue *_queue); virtual bool sendPacket(Packet &&p); - virtual Packet::PacketPtr receivePacket(); + virtual Packet::PacketPtr receivePacket(void); + // template variant with typed return values + // template<> Packet::PacketPtr receivePacket() // template T receivePacket(); virtual bool hasData() const; virtual bool available() const; diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index c7ebe2b74d..9d970b7261 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -10,7 +10,7 @@ build_src_filter = ${portduino_base.build_src_filter} [env:native-x11-320x240] extends = portduino_base -build_flags = ${portduino_base.build_flags} -O0 -lX11 +build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsanitize=address -lX11 -I variants/portduino -D DEBUG_HEAP -D USE_X11=1 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 21acca9f25..c1157e78f9 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -4,7 +4,7 @@ extends = esp32s3_base board = t-deck board_build.partitions = default_16MB.csv ; just for test upload_protocol = esp-builtin -build_flags = ${esp32_base.build_flags} +build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D T_DECK -D HAS_SCREEN=0 -D HAS_TFT=1 @@ -19,7 +19,7 @@ build_flags = ${esp32_base.build_flags} -D VIEW_320x240 -D VIEW_CLASS=TFTView_320x240 -D VIEW_CLASS_INC=\"TFTView_320x240.h\" - -D USE_DOUBLE_BUFFER +; -D USE_DOUBLE_BUFFER -I lib/device-ui/generated/ui_320x240 -I variants/t-deck build_src_filter = ${esp32_base.build_src_filter} + From ab6b797bc2e226d2f27dfa1a751e8afb9f2650d1 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 5 Mar 2024 09:18:24 +0100 Subject: [PATCH 012/322] ViewController and View interface --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 7a48bab4ae..9f1fdf5069 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 7a48bab4ae128d6c14380dc278cd1a3bd6a0cdf1 +Subproject commit 9f1fdf5069cbba37323e97651fa7b97f29d89ac5 From e73706949fcb8256aae4527c9a6255a58cf57a57 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 5 Mar 2024 09:20:33 +0100 Subject: [PATCH 013/322] added freertos task_handler pinned task --- src/main.cpp | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index aa174ae052..dcb84d03ae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,7 @@ // #include #ifdef ARCH_ESP32 +#include "freertosinc.h" #include "mesh/http/WebServer.h" #include "nimble/NimbleBluetooth.h" NimbleBluetooth *nimbleBluetooth; @@ -89,11 +90,13 @@ NRF52Bluetooth *nrf52Bluetooth; AudioThread *audioThread; #endif -#ifdef HAS_TFT +#if HAS_TFT #include "DeviceScreen.h" #include "sharedMem/MeshPacketClient.h" #include "sharedMem/MeshPacketServer.h" +void tft_task_handler(void *); + DeviceScreen *deviceScreen = nullptr; #endif @@ -363,10 +366,6 @@ void setup() // otherwise keyboard and touch screen will not work delay(200); #endif -#ifdef HAS_TFT - deviceScreen = &DeviceScreen::create(); - deviceScreen->init(new MeshPacketClient); -#endif // Currently only the tbeam has a PMU // PMU initialization needs to be placed before i2c scanning @@ -637,6 +636,12 @@ void setup() SPI.setFrequency(4000000); #endif +#if HAS_TFT + MeshPacketServer::init(); + deviceScreen = &DeviceScreen::create(); + deviceScreen->init(new MeshPacketClient); +#endif + // Initialize the screen first so we can show the logo while we start up everything else. screen = new graphics::Screen(screen_found, screen_model, screen_geometry); @@ -872,10 +877,6 @@ void setup() initApiServer(TCPPort); #endif -#ifdef HAS_TFT - MeshPacketServer::init(); -#endif - // Start airtime logger thread. airTime = new AirTime(); @@ -893,11 +894,18 @@ void setup() // This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS powerFSMthread = new PowerFSMThread(); + +#if HAS_TFT +#ifdef HAS_FREE_RTOS + xTaskCreatePinnedToCore(tft_task_handler, "tft", 4096, NULL, 9, NULL, 0); +#endif +#else setCPUFast(false); // 80MHz is fine for our slow peripherals +#endif #ifdef ARDUINO_ARCH_ESP32 - LOG_DEBUG("--- Free heap : %8d bytes ---\n", ESP.getFreeHeap()); - LOG_DEBUG("--- PSRAM : %8d bytes ---\n", ESP.getFreePsram()); + LOG_DEBUG("Free heap : %7d bytes\n", ESP.getFreeHeap()); + LOG_DEBUG("Free PSRAM : %7d bytes\n", ESP.getFreePsram()); #endif } @@ -971,12 +979,16 @@ void loop() } #if HAS_TFT -void tft_task_handler(void) +void tft_task_handler(void *param = nullptr) { while (true) { if (deviceScreen) deviceScreen->task_handler(); - delay(20); +#ifdef HAS_FREE_RTOS + vTaskDelay((TickType_t)10); +#else + delay(10); +#endif } } #endif \ No newline at end of file From ca32eb4bd24504c51f3e6dfb252eaa8b620a3a4a Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 5 Mar 2024 09:58:22 +0100 Subject: [PATCH 014/322] update platform-native --- arch/portduino/portduino.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index a38e87c369..eeedae0282 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based sim environment on top of any host OS, all hardware will be simulated [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#748f8d0d0a222a3d9738d0337e781c527a543b1e +platform = https://github.com/meshtastic/platform-native.git#acf8303a10f05901cae701e6fea6b6c8e25349ff framework = arduino build_src_filter = From 4dcaeddb1fc954975b9f3a06ca4efb89cebd3f18 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 5 Mar 2024 16:14:52 +0100 Subject: [PATCH 015/322] fix build issues --- lib/device-ui | 2 +- src/main.cpp | 2 ++ variants/portduino/platformio.ini | 1 + variants/t-deck/platformio.ini | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index 9f1fdf5069..8ac671a871 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 9f1fdf5069cbba37323e97651fa7b97f29d89ac5 +Subproject commit 8ac671a871e991680a68ddc3f96527a8d227ddc6 diff --git a/src/main.cpp b/src/main.cpp index dcb84d03ae..f411427fc1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -152,6 +152,8 @@ std::pair nodeTelemetrySensorsMap[_meshtastic_TelemetrySenso Router *router = NULL; // Users of router don't care what sort of subclass implements that API +const char *firmware_version = optstr(APP_VERSION_SHORT); + const char *getDeviceName() { uint8_t dmac[6]; diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 9d970b7261..883fafb005 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -33,4 +33,5 @@ build_src_filter = ${portduino_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/resources> + +<../lib/device-ui/source> + diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index c1157e78f9..b1a5c0da90 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -22,8 +22,9 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer ; -D USE_DOUBLE_BUFFER -I lib/device-ui/generated/ui_320x240 -I variants/t-deck -build_src_filter = ${esp32_base.build_src_filter} + +build_src_filter = ${esp32_base.build_src_filter} +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/source> lib_deps = ${esp32_base.lib_deps} lovyan03/LovyanGFX@^1.1.12 From 5a98717326182ee988378f868f5c23a10c172e85 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 5 Mar 2024 16:42:52 +0100 Subject: [PATCH 016/322] fix nrf builds --- arch/nrf52/nrf52.ini | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index 04ca89a54d..cb6400ff46 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -11,10 +11,11 @@ build_flags = -Isrc/platform/nrf52 build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - - + ${arduino_base.build_src_filter} - - - - - - - - - - lib_deps= ${arduino_base.lib_deps} lib_ignore = - BluetoothOTA \ No newline at end of file + BluetoothOTA + lvgl \ No newline at end of file From 210f3eba161e785c173eb56680afe785a78bc50e Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 5 Mar 2024 18:02:08 +0100 Subject: [PATCH 017/322] fix rp2040 + monteops build --- arch/rp2040/rp2040.ini | 3 ++- variants/monteops_hw1/platformio.ini | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/rp2040/rp2040.ini b/arch/rp2040/rp2040.ini index 48fe0dae65..8bfe779fbc 100644 --- a/arch/rp2040/rp2040.ini +++ b/arch/rp2040/rp2040.ini @@ -12,10 +12,11 @@ build_flags = -D__PLAT_RP2040__ # -D _POSIX_THREADS build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - + ${arduino_base.build_src_filter} - - - - - - - - - - lib_ignore = BluetoothOTA + lvgl lib_deps = ${arduino_base.lib_deps} diff --git a/variants/monteops_hw1/platformio.ini b/variants/monteops_hw1/platformio.ini index f9d260e74f..b813e7bc31 100644 --- a/variants/monteops_hw1/platformio.ini +++ b/variants/monteops_hw1/platformio.ini @@ -4,7 +4,7 @@ extends = nrf52840_base board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/monteops_hw1 -D MONTEOPS_HW1 -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" -build_src_filter = ${nrf52_base.build_src_filter} +<../variants/monteops_hw1> + + + +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/monteops_hw1> + + + - lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} From 6582429c3d45207b2b31e26b699a44b9c5c7bf2d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 5 Mar 2024 18:25:12 +0100 Subject: [PATCH 018/322] fix rak build --- variants/rak10701/platformio.ini | 2 +- variants/rak4631/platformio.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/rak10701/platformio.ini b/variants/rak10701/platformio.ini index 37f785e849..8476b2517f 100644 --- a/variants/rak10701/platformio.ini +++ b/variants/rak10701/platformio.ini @@ -8,7 +8,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/rak10701 -D RAK_4631 -DEINK_DISPLAY_MODEL=GxEPD2_213_BN -DEINK_WIDTH=250 -DEINK_HEIGHT=122 -build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak10701> + + + +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak10701> + + + - lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} diff --git a/variants/rak4631/platformio.ini b/variants/rak4631/platformio.ini index b1bc2d9b55..69641d2512 100644 --- a/variants/rak4631/platformio.ini +++ b/variants/rak4631/platformio.ini @@ -8,7 +8,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631 -D RAK_4631 -DEINK_DISPLAY_MODEL=GxEPD2_213_BN -DEINK_WIDTH=250 -DEINK_HEIGHT=122 -build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631> + + + +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631> + + + - lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} From 37ea727021a0d1f1b4ff9dbd3640c1cfa4d9b231 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 5 Mar 2024 21:36:36 +0100 Subject: [PATCH 019/322] update lastHeard handling --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 8ac671a871..cfe808d308 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 8ac671a871e991680a68ddc3f96527a8d227ddc6 +Subproject commit cfe808d30815402bc4997fd233dd89fdcb83274a From 16856a1548f69304e1dd6e8c5a1805dddaa62c56 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 7 Mar 2024 14:28:36 +0100 Subject: [PATCH 020/322] bugfixes --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index cfe808d308..b942a1c3c7 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit cfe808d30815402bc4997fd233dd89fdcb83274a +Subproject commit b942a1c3c7a08c0bab7142563a7c940ef9ad10e6 From 9a6fa87d682841f3cb02a9e9ae65c03017625ef7 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 7 Mar 2024 16:21:56 +0100 Subject: [PATCH 021/322] trunk init --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index b942a1c3c7..18039b1e21 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit b942a1c3c7a08c0bab7142563a7c940ef9ad10e6 +Subproject commit 18039b1e212a74e0cdb2aa189e31dfe056a8a0c5 From f60c5b9e6da5f199d841f1fec0f39ae08b2593b6 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 8 Mar 2024 11:41:12 +0100 Subject: [PATCH 022/322] rudimentary messaging --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 18039b1e21..42f416253c 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 18039b1e212a74e0cdb2aa189e31dfe056a8a0c5 +Subproject commit 42f416253c2129c85d3154dfd65b49d026898618 From 7a3843c0ed267601467037da720a8c905512346b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 8 Mar 2024 11:46:11 +0100 Subject: [PATCH 023/322] proper trunk fmt --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 42f416253c..c79faaae2d 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 42f416253c2129c85d3154dfd65b49d026898618 +Subproject commit c79faaae2dbc4870e25c6ef55c62fad62737e90b From 0cb774014e6cebcecee6d6214ac0c60abed25eee Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 11 Mar 2024 20:58:55 +0100 Subject: [PATCH 024/322] text messaging support --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index c79faaae2d..b5c5e8f9ae 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit c79faaae2dbc4870e25c6ef55c62fad62737e90b +Subproject commit b5c5e8f9aed8ab88a2957659f59109c1cd4d6b31 From 4907a32373ec2c135fd2db5b543ab739bff21ebb Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 11 Mar 2024 22:45:05 +0100 Subject: [PATCH 025/322] update lib --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index b5c5e8f9ae..f94fe1f507 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit b5c5e8f9aed8ab88a2957659f59109c1cd4d6b31 +Subproject commit f94fe1f50758748311d7f0087e236e8688cbd5e2 From 2875e4f190e69231c13caaad365fb2e4ea0ca682 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 12 Mar 2024 00:24:30 +0100 Subject: [PATCH 026/322] group channel update --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index f94fe1f507..1cbd1f2b16 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit f94fe1f50758748311d7f0087e236e8688cbd5e2 +Subproject commit 1cbd1f2b16698b6d7289d5636145100cbd79f384 From 060285040b9e2722eabe868f10ff546689d4fe6d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 12 Mar 2024 12:58:53 +0100 Subject: [PATCH 027/322] device metrics --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 1cbd1f2b16..df36cd5425 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 1cbd1f2b16698b6d7289d5636145100cbd79f384 +Subproject commit df36cd54258fa779980d0d43cb95e69c68e92be0 From 27b48943292e52abe24ac1404b768d52d4ffb952 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 12 Mar 2024 16:17:11 +0100 Subject: [PATCH 028/322] improved node images --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index df36cd5425..55bed47c93 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit df36cd54258fa779980d0d43cb95e69c68e92be0 +Subproject commit 55bed47c9351204b8070d78cbba9e14a2bd08ac7 From 9f942511aec053575e54aa4e79fcbef3d4efe823 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 13 Mar 2024 01:26:50 +0100 Subject: [PATCH 029/322] added chats panel + del button --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 55bed47c93..a436fcbc6e 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 55bed47c9351204b8070d78cbba9e14a2bd08ac7 +Subproject commit a436fcbc6ed778e9d24bc58b3b76cee996b1e91b From 070b6df0f3af1fc522e4bb6db2f291cbc7636b8b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 14 Mar 2024 18:22:51 +0100 Subject: [PATCH 030/322] add generated fonts with latin-1 supplements --- variants/t-deck/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index b1a5c0da90..d7f55533c1 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -24,6 +24,7 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -I variants/t-deck build_src_filter = ${esp32_base.build_src_filter} +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> +<../lib/device-ui/source> lib_deps = ${esp32_base.lib_deps} From d0b1abf0ef4969b31d711a33290cc989fe509f20 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 14 Mar 2024 18:23:14 +0100 Subject: [PATCH 031/322] 5ms tick --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index ddd17db6bc..a5541cd41c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1005,7 +1005,7 @@ void tft_task_handler(void *param = nullptr) if (deviceScreen) deviceScreen->task_handler(); #ifdef HAS_FREE_RTOS - vTaskDelay((TickType_t)10); + vTaskDelay((TickType_t)5); #else delay(10); #endif From 42ea9ef0f9d755c059b726c405463caa7c47e494 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 14 Mar 2024 21:13:16 +0100 Subject: [PATCH 032/322] add fonts folder --- variants/portduino/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 447020ba70..f123b9f077 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -34,6 +34,7 @@ lib_deps = ${portduino_base.lib_deps} build_src_filter = ${portduino_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/generated/ui_320x240/fonts> +<../lib/device-ui/resources> +<../lib/device-ui/source> + From 0c6d70f2e716225498bea5f9900bacf4cf6bcf1e Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 15 Mar 2024 09:56:35 +0100 Subject: [PATCH 033/322] fix fonts --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index a436fcbc6e..890ff469b5 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit a436fcbc6ed778e9d24bc58b3b76cee996b1e91b +Subproject commit 890ff469b5fb9c71ab81976567c2db4d5dede7a5 From cc330eac7ff967a37d2aee776d150b41bfcf220f Mon Sep 17 00:00:00 2001 From: Manuel Date: Mon, 18 Mar 2024 23:26:52 +0100 Subject: [PATCH 034/322] increase TFT stack size --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index ddd17db6bc..667ae007f1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -917,7 +917,7 @@ void setup() #if HAS_TFT #ifdef HAS_FREE_RTOS - xTaskCreatePinnedToCore(tft_task_handler, "tft", 4096, NULL, 9, NULL, 0); + xTaskCreatePinnedToCore(tft_task_handler, "tft", 8192, NULL, 9, NULL, 0); #endif #else setCPUFast(false); // 80MHz is fine for our slow peripherals From 352ac209e514fe0ef21290aa5dd1d9b81e8d3c66 Mon Sep 17 00:00:00 2001 From: Manuel Date: Mon, 18 Mar 2024 23:58:21 +0100 Subject: [PATCH 035/322] Merge branch 'tft-gui-work' of https://github.com/meshtastic/firmware into tft-gui-work --- lib/device-ui | 2 +- protobufs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index 890ff469b5..a436fcbc6e 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 890ff469b5fb9c71ab81976567c2db4d5dede7a5 +Subproject commit a436fcbc6ed778e9d24bc58b3b76cee996b1e91b diff --git a/protobufs b/protobufs index 556e49ba61..7e3ee8cd96 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 556e49ba619e2f4d8fa3c2dee2a94129a43d5f08 +Subproject commit 7e3ee8cd96740910d0611433cb9a05a7a692568c From 5813ccf2e624bc68df8f9dcbd4af5c1685d14e27 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 19 Mar 2024 00:46:59 +0100 Subject: [PATCH 036/322] esp debug logs --- boards/t-deck.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/t-deck.json b/boards/t-deck.json index d62ec48e65..33a34b60dc 100644 --- a/boards/t-deck.json +++ b/boards/t-deck.json @@ -8,9 +8,9 @@ "extra_flags": [ "-DBOARD_HAS_PSRAM", "-DARDUINO_USB_CDC_ON_BOOT=1", - "-DARDUINO_USB_MODE=0", + "-DARDUINO_USB_MODE=1", "-DARDUINO_RUNNING_CORE=1", - "-DARDUINO_EVENT_RUNNING_CORE=0" + "-DARDUINO_EVENT_RUNNING_CORE=1" ], "f_cpu": "240000000L", "f_flash": "80000000L", From 3a8bb5b64bbeffcedea8348fc670a3c42649233d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 19 Mar 2024 00:47:29 +0100 Subject: [PATCH 037/322] fix gui freeze --- variants/t-deck/variant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index 62ac0a373f..513b2f50c2 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -1,5 +1,5 @@ // ST7789 TFT LCD -#define ST7789_CS 12 +// #define ST7789_CS 12 #define ST7789_RS 11 // DC #define ST7789_SDA 41 // MOSI #define ST7789_SCK 40 From 13a9c00c187b350851f48d32356e3bbaa1bdd219 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 19 Mar 2024 00:49:48 +0100 Subject: [PATCH 038/322] updated device-ui --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index a436fcbc6e..43a02f178a 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit a436fcbc6ed778e9d24bc58b3b76cee996b1e91b +Subproject commit 43a02f178a008209a77256c39c231b51056d6c04 From 140eb94d1c795a345052de9a8d2d9d9ae62c7a05 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 19 Mar 2024 10:03:58 +0100 Subject: [PATCH 039/322] try-fix acessing d172503 --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 43a02f178a..d1725036d8 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 43a02f178a008209a77256c39c231b51056d6c04 +Subproject commit d1725036d8a82d508b38d2720edc175201d62ac7 From 4d647ca4c34dfa0e72d7cdf2ecb98abbaed643af Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 19 Mar 2024 21:10:24 +0100 Subject: [PATCH 040/322] added device-ui logging --- variants/portduino/platformio.ini | 2 ++ variants/t-deck/platformio.ini | 2 ++ 2 files changed, 4 insertions(+) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index f123b9f077..29e3eb7bbf 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -27,6 +27,8 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -I lib/device-ui/generated/ui_320x240 board = cross_platform lib_deps = ${portduino_base.lib_deps} diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 770a398696..e7ac417fe1 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -13,6 +13,8 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D CALIBRATE_TOUCH -D KB_POWERON=10 -D LGFX_DRIVER=LGFX_TDECK From 6e61a9add9e894972b0b84a429461247fdd5a81a Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 19 Mar 2024 23:35:16 +0100 Subject: [PATCH 041/322] refactored receivePacket --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index d1725036d8..d4d9d193d6 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit d1725036d8a82d508b38d2720edc175201d62ac7 +Subproject commit d4d9d193d6c0401f909fede4a5004936efbdd475 From 662df5b179407b94931e3eee86a276c589996241 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Thu, 21 Mar 2024 20:35:17 +0100 Subject: [PATCH 042/322] Set default position precision of mapReport to 14 (#3456) --- src/mqtt/MQTT.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index dbc0c77b3e..41b1601e79 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -90,8 +90,8 @@ class MQTT : private concurrency::OSThread // For map reporting (only applies when enabled) uint32_t last_report_to_map = 0; - uint32_t map_position_precision = 32; // default to full precision - uint32_t map_publish_interval_secs = 60 * 15; // default to 15 minutes + uint32_t map_position_precision = 14; // defaults to max. offset of ~1459m + uint32_t map_publish_interval_secs = 60 * 15; // defaults to 15 minutes /** return true if we have a channel that wants uplink/downlink or map reporting is enabled */ From 391386517ab15b132e45917f6fa355d9683a69c4 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Thu, 21 Mar 2024 20:42:53 +0100 Subject: [PATCH 043/322] Let NeighborInfo Module ignore packets coming from MQTT (#3457) --- src/modules/NeighborInfoModule.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/NeighborInfoModule.h b/src/modules/NeighborInfoModule.h index df5c2c9489..820e2d0d45 100644 --- a/src/modules/NeighborInfoModule.h +++ b/src/modules/NeighborInfoModule.h @@ -75,8 +75,9 @@ class NeighborInfoModule : public ProtobufModule, priva /* Does our periodic broadcast */ int32_t runOnce() override; - // Override wantPacket to say we want to see all packets when enabled, not just those for our port number - virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return enabled; } + /* Override wantPacket to say we want to see all packets when enabled, not just those for our port number. + Exception is when the packet came via MQTT */ + virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return enabled && !p->via_mqtt; } /* These are for debugging only */ void printNeighborInfo(const char *header, const meshtastic_NeighborInfo *np); From 65e1993be84ba776270d2d3f8868f794d10ec681 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 21 Mar 2024 14:43:10 -0500 Subject: [PATCH 044/322] Clear local position on nodedb-reset (#3451) * Clear local position on nodedb-reset * NodeDB pointer now, yo --------- Co-authored-by: Jonathan Bennett --- src/mesh/NodeDB.cpp | 11 +++++++++++ src/mesh/NodeDB.h | 2 ++ src/modules/PositionModule.cpp | 14 ++------------ src/modules/PositionModule.h | 3 --- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6db8fc50b0..80b46a4268 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -434,6 +434,7 @@ void NodeDB::resetNodes() { numMeshNodes = 1; std::fill(devicestate.node_db_lite.begin() + 1, devicestate.node_db_lite.end(), meshtastic_NodeInfoLite()); + clearLocalPosition(); saveDeviceStateToDisk(); if (neighborInfoModule && moduleConfig.neighbor_info.enabled) neighborInfoModule->resetNeighbors(); @@ -455,6 +456,16 @@ void NodeDB::removeNodeByNum(uint nodeNum) saveDeviceStateToDisk(); } +void NodeDB::clearLocalPosition() +{ + meshtastic_NodeInfoLite *node = getMeshNode(nodeDB->getNodeNum()); + node->position.latitude_i = 0; + node->position.longitude_i = 0; + node->position.altitude = 0; + node->position.time = 0; + setLocalPosition(meshtastic_Position_init_default); +} + void NodeDB::cleanupMeshDB() { int newPos = 0, removed = 0; diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 23870db745..4d24d72257 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -131,6 +131,8 @@ class NodeDB meshtastic_NodeInfoLite *getMeshNode(NodeNum n); size_t getNumMeshNodes() { return numMeshNodes; } + void clearLocalPosition(); + void setLocalPosition(meshtastic_Position position, bool timeOnly = false) { if (timeOnly) { diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index 0bfc775da7..d22c6b6994 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -34,21 +34,11 @@ PositionModule::PositionModule() if ((config.device.role == meshtastic_Config_DeviceConfig_Role_TRACKER || config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) && config.power.is_power_saving) { - clearPosition(); + LOG_DEBUG("Clearing position on startup for sleepy tracker (ー。ー) zzz\n"); + nodeDB->clearLocalPosition(); } } -void PositionModule::clearPosition() -{ - LOG_DEBUG("Clearing position on startup for sleepy tracker (ー。ー) zzz\n"); - meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum()); - node->position.latitude_i = 0; - node->position.longitude_i = 0; - node->position.altitude = 0; - node->position.time = 0; - nodeDB->setLocalPosition(meshtastic_Position_init_default); -} - bool PositionModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Position *pptr) { auto p = *pptr; diff --git a/src/modules/PositionModule.h b/src/modules/PositionModule.h index fddafef6f7..68171ab0eb 100644 --- a/src/modules/PositionModule.h +++ b/src/modules/PositionModule.h @@ -51,9 +51,6 @@ class PositionModule : public ProtobufModule, private concu struct SmartPosition getDistanceTraveledSinceLastSend(meshtastic_PositionLite currentPosition); meshtastic_MeshPacket *allocAtakPli(); uint32_t precision; - - /** Only used in power saving trackers for now */ - void clearPosition(); void sendLostAndFoundText(); }; From 9ecd5a306f0cafba74e5bfc8a77404c51ab7d422 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 21 Mar 2024 15:24:57 -0500 Subject: [PATCH 045/322] Bump actions to node 20 (#3461) --- .github/actions/setup-base/action.yml | 6 +++--- .github/workflows/build_esp32.yml | 4 ++-- .github/workflows/build_esp32_c3.yml | 4 ++-- .github/workflows/build_esp32_s3.yml | 4 ++-- .github/workflows/build_nrf52.yml | 4 ++-- .github/workflows/build_raspbian.yml | 4 ++-- .github/workflows/build_rpi2040.yml | 4 ++-- .github/workflows/main_matrix.yml | 18 +++++++++--------- .github/workflows/nightly.yml | 2 +- .github/workflows/package_raspbian.yml | 4 ++-- .github/workflows/sec_sast_flawfinder.yml | 4 ++-- .github/workflows/sec_sast_semgrep_cron.yml | 4 ++-- .github/workflows/sec_sast_semgrep_pull.yml | 2 +- .github/workflows/trunk-check.yml | 2 +- .github/workflows/update_protobufs.yml | 2 +- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/actions/setup-base/action.yml b/.github/actions/setup-base/action.yml index 7b97e1753d..7e57f6a311 100644 --- a/.github/actions/setup-base/action.yml +++ b/.github/actions/setup-base/action.yml @@ -5,7 +5,7 @@ runs: using: "composite" steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" ref: ${{github.event.pull_request.head.ref}} @@ -30,12 +30,12 @@ runs: sudo apt-get install -y libyaml-cpp-dev - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.x - name: Cache python libs - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-pip # needed in if test with: path: ~/.cache/pip diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 31f0dd5a00..1a07d5f282 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -11,7 +11,7 @@ jobs: build-esp32: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -54,7 +54,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_esp32_c3.yml b/.github/workflows/build_esp32_c3.yml index a30cf33f10..cdb8427c10 100644 --- a/.github/workflows/build_esp32_c3.yml +++ b/.github/workflows/build_esp32_c3.yml @@ -13,7 +13,7 @@ jobs: build-esp32-c3: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -54,7 +54,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_esp32_s3.yml b/.github/workflows/build_esp32_s3.yml index f603a6a31a..502a319c5b 100644 --- a/.github/workflows/build_esp32_s3.yml +++ b/.github/workflows/build_esp32_s3.yml @@ -11,7 +11,7 @@ jobs: build-esp32-s3: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -52,7 +52,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_nrf52.yml b/.github/workflows/build_nrf52.yml index 33ee4d00c9..a375479731 100644 --- a/.github/workflows/build_nrf52.yml +++ b/.github/workflows/build_nrf52.yml @@ -11,7 +11,7 @@ jobs: build-nrf52: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -24,7 +24,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_raspbian.yml b/.github/workflows/build_raspbian.yml index 7a25892bc8..04aa2340bf 100644 --- a/.github/workflows/build_raspbian.yml +++ b/.github/workflows/build_raspbian.yml @@ -11,7 +11,7 @@ jobs: runs-on: [self-hosted, linux, ARM64] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} @@ -37,7 +37,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-raspbian-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_rpi2040.yml b/.github/workflows/build_rpi2040.yml index 76ca2c20e1..aac70610f4 100644 --- a/.github/workflows/build_rpi2040.yml +++ b/.github/workflows/build_rpi2040.yml @@ -11,7 +11,7 @@ jobs: build-rpi2040: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -24,7 +24,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 03d47f18e6..d1c01a3662 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -157,7 +157,7 @@ jobs: build-native: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build base id: base uses: ./.github/actions/setup-base @@ -180,7 +180,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-native-${{ steps.version.outputs.version }}.zip path: | @@ -221,7 +221,7 @@ jobs: needs: [check] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -244,7 +244,7 @@ jobs: ] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -264,7 +264,7 @@ jobs: run: mv -b -t ./ ./*tbeam-2*/littlefs*.bin ./*tbeam-2*/bleota.bin ./*tbeam-s3*/bleota-s3.bin ./*esp32c3*/bleota-c3.bin ./**/firmware*.bin ./*t-echo*/Meshtastic_nRF52_factory_erase_v2.uf2 ./**/firmware-*.uf2 ./**/firmware-*-ota.zip ./**/*.elf ./*native*/*device-*.sh ./*native*/*device-*.bat ./firmware-raspbian-*/release/meshtasticd_linux_aarch64 ./firmware-raspbian-*/bin/config-dist.yaml - name: Repackage in single firmware zip - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firmware-${{ steps.version.outputs.version }} path: | @@ -295,7 +295,7 @@ jobs: run: zip -j -9 -r ./firmware-${{ steps.version.outputs.version }}.zip ./output - name: Repackage in single elfs zip - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: debug-elfs-${{ steps.version.outputs.version }}.zip path: ./*.elf @@ -319,10 +319,10 @@ jobs: needs: [gather-artifacts, after-checks] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.x diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index da59bc0fd3..e249823a77 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Trunk Check uses: trunk-io/trunk-action@782e83f803ca6e369f035d64c6ba2768174ba61b diff --git a/.github/workflows/package_raspbian.yml b/.github/workflows/package_raspbian.yml index 377074e95f..6c1ae5d609 100644 --- a/.github/workflows/package_raspbian.yml +++ b/.github/workflows/package_raspbian.yml @@ -17,7 +17,7 @@ jobs: needs: build-raspbian steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} @@ -66,7 +66,7 @@ jobs: depends: libyaml-cpp0.7, openssl desc: Native Linux Meshtastic binary. - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: artifact-deb path: | diff --git a/.github/workflows/sec_sast_flawfinder.yml b/.github/workflows/sec_sast_flawfinder.yml index 2c7e751af4..59ff994caf 100644 --- a/.github/workflows/sec_sast_flawfinder.yml +++ b/.github/workflows/sec_sast_flawfinder.yml @@ -16,7 +16,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # step 2 - name: flawfinder_scan @@ -27,7 +27,7 @@ jobs: # step 3 - name: save report as pipeline artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: flawfinder_report.sarif path: flawfinder_report.sarif diff --git a/.github/workflows/sec_sast_semgrep_cron.yml b/.github/workflows/sec_sast_semgrep_cron.yml index cdd2c3c374..a29e6ca023 100644 --- a/.github/workflows/sec_sast_semgrep_cron.yml +++ b/.github/workflows/sec_sast_semgrep_cron.yml @@ -17,7 +17,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # step 2 - name: full scan @@ -29,7 +29,7 @@ jobs: # step 3 - name: save report as pipeline artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: report.sarif path: report.sarif diff --git a/.github/workflows/sec_sast_semgrep_pull.yml b/.github/workflows/sec_sast_semgrep_pull.yml index 1697ffb1b8..b6c2884947 100644 --- a/.github/workflows/sec_sast_semgrep_pull.yml +++ b/.github/workflows/sec_sast_semgrep_pull.yml @@ -11,7 +11,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/trunk-check.yml b/.github/workflows/trunk-check.yml index e35b91cb91..6ed905bc85 100644 --- a/.github/workflows/trunk-check.yml +++ b/.github/workflows/trunk-check.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Trunk Check uses: trunk-io/trunk-action@v1 diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index 6944d827ec..4c51c35c7a 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true From b5b9f34e117e1315b0af6d858bb4a53a3f1b0798 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 21 Mar 2024 16:14:45 -0500 Subject: [PATCH 046/322] Remove double run of build-raspbian --- .github/workflows/main_matrix.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index d1c01a3662..c145feca26 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -145,11 +145,11 @@ jobs: with: board: ${{ matrix.board }} - build-raspbian: - strategy: - fail-fast: false - max-parallel: 1 - uses: ./.github/workflows/build_raspbian.yml + #build-raspbian: + # strategy: + # fail-fast: false + # max-parallel: 1 + # uses: ./.github/workflows/build_raspbian.yml package-raspbian: uses: ./.github/workflows/package_raspbian.yml From d6945255474c6b8a8b1e832ed405d990df28b07a Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 21 Mar 2024 16:17:13 -0500 Subject: [PATCH 047/322] Revert previous attempt --- .github/workflows/main_matrix.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index c145feca26..d1c01a3662 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -145,11 +145,11 @@ jobs: with: board: ${{ matrix.board }} - #build-raspbian: - # strategy: - # fail-fast: false - # max-parallel: 1 - # uses: ./.github/workflows/build_raspbian.yml + build-raspbian: + strategy: + fail-fast: false + max-parallel: 1 + uses: ./.github/workflows/build_raspbian.yml package-raspbian: uses: ./.github/workflows/package_raspbian.yml From 3db09e2fedab4020b1ed4f7045611d3a83c317d8 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:20:20 +0100 Subject: [PATCH 048/322] Add sanity check for map report interval and position precision (#3459) * Add sanity check for map report interval and position precision * Use new `Default::` methods --- src/mqtt/MQTT.cpp | 8 +++++--- src/mqtt/MQTT.h | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index e29786dcb4..390d0e2064 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -195,8 +195,10 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE) } if (moduleConfig.mqtt.map_reporting_enabled && moduleConfig.mqtt.has_map_report_settings) { - map_position_precision = moduleConfig.mqtt.map_report_settings.position_precision; - map_publish_interval_secs = moduleConfig.mqtt.map_report_settings.publish_interval_secs; + map_position_precision = Default::getConfiguredOrDefault(moduleConfig.mqtt.map_report_settings.position_precision, + default_map_position_precision); + map_publish_interval_msecs = Default::getConfiguredOrDefaultMs( + moduleConfig.mqtt.map_report_settings.publish_interval_secs, default_map_publish_interval_secs); } #ifdef HAS_NETWORKING @@ -540,7 +542,7 @@ void MQTT::perhapsReportToMap() if (!moduleConfig.mqtt.map_reporting_enabled || !(moduleConfig.mqtt.proxy_to_client_enabled || isConnectedDirectly())) return; - if (millis() - last_report_to_map < map_publish_interval_secs * 1000) { + if (millis() - last_report_to_map < map_publish_interval_msecs) { return; } else { if (map_position_precision == 0 || (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)) { diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index 41b1601e79..f2eb6b1204 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -89,9 +89,11 @@ class MQTT : private concurrency::OSThread std::string mapTopic = "/2/map/"; // For protobuf-encoded MapReport messages // For map reporting (only applies when enabled) + const uint32_t default_map_position_precision = 14; // defaults to max. offset of ~1459m + const uint32_t default_map_publish_interval_secs = 60 * 15; // defaults to 15 minutes uint32_t last_report_to_map = 0; - uint32_t map_position_precision = 14; // defaults to max. offset of ~1459m - uint32_t map_publish_interval_secs = 60 * 15; // defaults to 15 minutes + uint32_t map_position_precision = default_map_position_precision; + uint32_t map_publish_interval_msecs = default_map_publish_interval_secs * 1000; /** return true if we have a channel that wants uplink/downlink or map reporting is enabled */ From 8f2f2221d11c6e229fad5a8bf271f5dcc4d93a3b Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 21 Mar 2024 16:50:44 -0500 Subject: [PATCH 049/322] Revert "Bump actions to node 20 (#3461)" (#3462) This reverts commit defeb8e52bab51eff5ab990119a0976f43730482. As per https://github.com/actions/upload-artifact/issues/478 the new version of upload-artifact includes a breaking change. --- .github/actions/setup-base/action.yml | 6 +++--- .github/workflows/build_esp32.yml | 4 ++-- .github/workflows/build_esp32_c3.yml | 4 ++-- .github/workflows/build_esp32_s3.yml | 4 ++-- .github/workflows/build_nrf52.yml | 4 ++-- .github/workflows/build_raspbian.yml | 4 ++-- .github/workflows/build_rpi2040.yml | 4 ++-- .github/workflows/main_matrix.yml | 18 +++++++++--------- .github/workflows/nightly.yml | 2 +- .github/workflows/package_raspbian.yml | 4 ++-- .github/workflows/sec_sast_flawfinder.yml | 4 ++-- .github/workflows/sec_sast_semgrep_cron.yml | 4 ++-- .github/workflows/sec_sast_semgrep_pull.yml | 2 +- .github/workflows/trunk-check.yml | 2 +- .github/workflows/update_protobufs.yml | 2 +- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/actions/setup-base/action.yml b/.github/actions/setup-base/action.yml index 7e57f6a311..7b97e1753d 100644 --- a/.github/actions/setup-base/action.yml +++ b/.github/actions/setup-base/action.yml @@ -5,7 +5,7 @@ runs: using: "composite" steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: submodules: "recursive" ref: ${{github.event.pull_request.head.ref}} @@ -30,12 +30,12 @@ runs: sudo apt-get install -y libyaml-cpp-dev - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v4 with: python-version: 3.x - name: Cache python libs - uses: actions/cache@v4 + uses: actions/cache@v3 id: cache-pip # needed in if test with: path: ~/.cache/pip diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 1a07d5f282..31f0dd5a00 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -11,7 +11,7 @@ jobs: build-esp32: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -54,7 +54,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_esp32_c3.yml b/.github/workflows/build_esp32_c3.yml index cdb8427c10..a30cf33f10 100644 --- a/.github/workflows/build_esp32_c3.yml +++ b/.github/workflows/build_esp32_c3.yml @@ -13,7 +13,7 @@ jobs: build-esp32-c3: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -54,7 +54,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_esp32_s3.yml b/.github/workflows/build_esp32_s3.yml index 502a319c5b..f603a6a31a 100644 --- a/.github/workflows/build_esp32_s3.yml +++ b/.github/workflows/build_esp32_s3.yml @@ -11,7 +11,7 @@ jobs: build-esp32-s3: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -52,7 +52,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_nrf52.yml b/.github/workflows/build_nrf52.yml index a375479731..33ee4d00c9 100644 --- a/.github/workflows/build_nrf52.yml +++ b/.github/workflows/build_nrf52.yml @@ -11,7 +11,7 @@ jobs: build-nrf52: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -24,7 +24,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_raspbian.yml b/.github/workflows/build_raspbian.yml index 04aa2340bf..7a25892bc8 100644 --- a/.github/workflows/build_raspbian.yml +++ b/.github/workflows/build_raspbian.yml @@ -11,7 +11,7 @@ jobs: runs-on: [self-hosted, linux, ARM64] steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} @@ -37,7 +37,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-raspbian-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/build_rpi2040.yml b/.github/workflows/build_rpi2040.yml index aac70610f4..76ca2c20e1 100644 --- a/.github/workflows/build_rpi2040.yml +++ b/.github/workflows/build_rpi2040.yml @@ -11,7 +11,7 @@ jobs: build-rpi2040: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -24,7 +24,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index d1c01a3662..03d47f18e6 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -157,7 +157,7 @@ jobs: build-native: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/actions/setup-base @@ -180,7 +180,7 @@ jobs: id: version - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-native-${{ steps.version.outputs.version }}.zip path: | @@ -221,7 +221,7 @@ jobs: needs: [check] steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -244,7 +244,7 @@ jobs: ] steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -264,7 +264,7 @@ jobs: run: mv -b -t ./ ./*tbeam-2*/littlefs*.bin ./*tbeam-2*/bleota.bin ./*tbeam-s3*/bleota-s3.bin ./*esp32c3*/bleota-c3.bin ./**/firmware*.bin ./*t-echo*/Meshtastic_nRF52_factory_erase_v2.uf2 ./**/firmware-*.uf2 ./**/firmware-*-ota.zip ./**/*.elf ./*native*/*device-*.sh ./*native*/*device-*.bat ./firmware-raspbian-*/release/meshtasticd_linux_aarch64 ./firmware-raspbian-*/bin/config-dist.yaml - name: Repackage in single firmware zip - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: firmware-${{ steps.version.outputs.version }} path: | @@ -295,7 +295,7 @@ jobs: run: zip -j -9 -r ./firmware-${{ steps.version.outputs.version }}.zip ./output - name: Repackage in single elfs zip - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: debug-elfs-${{ steps.version.outputs.version }}.zip path: ./*.elf @@ -319,10 +319,10 @@ jobs: needs: [gather-artifacts, after-checks] steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v4 with: python-version: 3.x diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e249823a77..da59bc0fd3 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Trunk Check uses: trunk-io/trunk-action@782e83f803ca6e369f035d64c6ba2768174ba61b diff --git a/.github/workflows/package_raspbian.yml b/.github/workflows/package_raspbian.yml index 6c1ae5d609..377074e95f 100644 --- a/.github/workflows/package_raspbian.yml +++ b/.github/workflows/package_raspbian.yml @@ -17,7 +17,7 @@ jobs: needs: build-raspbian steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} @@ -66,7 +66,7 @@ jobs: depends: libyaml-cpp0.7, openssl desc: Native Linux Meshtastic binary. - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v3 with: name: artifact-deb path: | diff --git a/.github/workflows/sec_sast_flawfinder.yml b/.github/workflows/sec_sast_flawfinder.yml index 59ff994caf..2c7e751af4 100644 --- a/.github/workflows/sec_sast_flawfinder.yml +++ b/.github/workflows/sec_sast_flawfinder.yml @@ -16,7 +16,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v4 + uses: actions/checkout@v3 # step 2 - name: flawfinder_scan @@ -27,7 +27,7 @@ jobs: # step 3 - name: save report as pipeline artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: flawfinder_report.sarif path: flawfinder_report.sarif diff --git a/.github/workflows/sec_sast_semgrep_cron.yml b/.github/workflows/sec_sast_semgrep_cron.yml index a29e6ca023..cdd2c3c374 100644 --- a/.github/workflows/sec_sast_semgrep_cron.yml +++ b/.github/workflows/sec_sast_semgrep_cron.yml @@ -17,7 +17,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v4 + uses: actions/checkout@v3 # step 2 - name: full scan @@ -29,7 +29,7 @@ jobs: # step 3 - name: save report as pipeline artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: report.sarif path: report.sarif diff --git a/.github/workflows/sec_sast_semgrep_pull.yml b/.github/workflows/sec_sast_semgrep_pull.yml index b6c2884947..1697ffb1b8 100644 --- a/.github/workflows/sec_sast_semgrep_pull.yml +++ b/.github/workflows/sec_sast_semgrep_pull.yml @@ -11,7 +11,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/trunk-check.yml b/.github/workflows/trunk-check.yml index 6ed905bc85..e35b91cb91 100644 --- a/.github/workflows/trunk-check.yml +++ b/.github/workflows/trunk-check.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Trunk Check uses: trunk-io/trunk-action@v1 diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index 4c51c35c7a..6944d827ec 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: submodules: true From 326e0a588e1d164334c5fc2d014026af69663ead Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 21 Mar 2024 18:26:37 -0500 Subject: [PATCH 050/322] Make MAX_NUM_NODES configurable in variant.h (#3453) Co-authored-by: Ben Meadors --- src/mesh/mesh-pb-constants.h | 4 +--- variants/portduino/variant.h | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mesh/mesh-pb-constants.h b/src/mesh/mesh-pb-constants.h index 9e747db1d6..b8ef236c99 100644 --- a/src/mesh/mesh-pb-constants.h +++ b/src/mesh/mesh-pb-constants.h @@ -17,9 +17,7 @@ #define MAX_RX_TOPHONE 32 /// max number of nodes allowed in the mesh -#if ARCH_PORTDUINO -#define MAX_NUM_NODES settingsMap[maxnodes] -#else +#ifndef MAX_NUM_NODES #define MAX_NUM_NODES 100 #endif diff --git a/variants/portduino/variant.h b/variants/portduino/variant.h index f47b58afc2..5aad8dbfcc 100644 --- a/variants/portduino/variant.h +++ b/variants/portduino/variant.h @@ -1,3 +1,4 @@ #define HAS_SCREEN 1 #define CANNED_MESSAGE_MODULE_ENABLE 1 #define HAS_GPS 1 +#define MAX_NUM_NODES settingsMap[maxnodes] From 753fc78d5cf5da4aede59281bb1a5ebd1a5b30d5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:55:50 -0500 Subject: [PATCH 051/322] [create-pull-request] automated change (#3463) Co-authored-by: thebentern --- protobufs | 2 +- src/mesh/generated/meshtastic/deviceonly.pb.h | 13 +++++++++---- src/mesh/generated/meshtastic/mesh.pb.h | 13 +++++++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/protobufs b/protobufs index 7e3ee8cd96..0fe69d73e6 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 7e3ee8cd96740910d0611433cb9a05a7a692568c +Subproject commit 0fe69d73e639372128d9480ec8cf65b182d36d30 diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index c286bd4716..c65a5764f0 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -70,6 +70,9 @@ typedef struct _meshtastic_NodeInfoLite { bool via_mqtt; /* Number of hops away from us this node is (0 if adjacent) */ uint8_t hops_away; + /* True if node is in our favorites list + Persists between NodeDB internal clean ups */ + bool is_favorite; } meshtastic_NodeInfoLite; /* The on-disk saved channels */ @@ -180,13 +183,13 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0, false, meshtastic_MeshPacket_init_default, 0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}, {{NULL}, NULL}} -#define meshtastic_NodeInfoLite_init_default {0, false, meshtastic_User_init_default, false, meshtastic_PositionLite_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, 0} +#define meshtastic_NodeInfoLite_init_default {0, false, meshtastic_User_init_default, false, meshtastic_PositionLite_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, 0, 0} #define meshtastic_PositionLite_init_default {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN} #define meshtastic_ChannelFile_init_default {0, {meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default}, 0} #define meshtastic_OEMStore_init_default {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}, false, meshtastic_LocalConfig_init_default, false, meshtastic_LocalModuleConfig_init_default} #define meshtastic_NodeRemoteHardwarePin_init_default {0, false, meshtastic_RemoteHardwarePin_init_default} #define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0, false, meshtastic_MeshPacket_init_zero, 0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}, {{NULL}, NULL}} -#define meshtastic_NodeInfoLite_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_PositionLite_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, 0} +#define meshtastic_NodeInfoLite_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_PositionLite_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, 0, 0} #define meshtastic_PositionLite_init_zero {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN} #define meshtastic_ChannelFile_init_zero {0, {meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero}, 0} #define meshtastic_OEMStore_init_zero {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}, false, meshtastic_LocalConfig_init_zero, false, meshtastic_LocalModuleConfig_init_zero} @@ -207,6 +210,7 @@ extern "C" { #define meshtastic_NodeInfoLite_channel_tag 7 #define meshtastic_NodeInfoLite_via_mqtt_tag 8 #define meshtastic_NodeInfoLite_hops_away_tag 9 +#define meshtastic_NodeInfoLite_is_favorite_tag 10 #define meshtastic_ChannelFile_channels_tag 1 #define meshtastic_ChannelFile_version_tag 2 #define meshtastic_OEMStore_oem_icon_width_tag 1 @@ -262,7 +266,8 @@ X(a, STATIC, SINGULAR, FIXED32, last_heard, 5) \ X(a, STATIC, OPTIONAL, MESSAGE, device_metrics, 6) \ X(a, STATIC, SINGULAR, UINT32, channel, 7) \ X(a, STATIC, SINGULAR, BOOL, via_mqtt, 8) \ -X(a, STATIC, SINGULAR, UINT32, hops_away, 9) +X(a, STATIC, SINGULAR, UINT32, hops_away, 9) \ +X(a, STATIC, SINGULAR, BOOL, is_favorite, 10) #define meshtastic_NodeInfoLite_CALLBACK NULL #define meshtastic_NodeInfoLite_DEFAULT NULL #define meshtastic_NodeInfoLite_user_MSGTYPE meshtastic_User @@ -324,7 +329,7 @@ extern const pb_msgdesc_t meshtastic_NodeRemoteHardwarePin_msg; /* Maximum encoded size of messages (where known) */ /* meshtastic_DeviceState_size depends on runtime parameters */ #define meshtastic_ChannelFile_size 702 -#define meshtastic_NodeInfoLite_size 158 +#define meshtastic_NodeInfoLite_size 160 #define meshtastic_NodeRemoteHardwarePin_size 29 #define meshtastic_OEMStore_size 3278 #define meshtastic_PositionLite_size 28 diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 2f57f1ae2a..5804dd42a0 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -638,6 +638,9 @@ typedef struct _meshtastic_NodeInfo { bool via_mqtt; /* Number of hops away from us this node is (0 if adjacent) */ uint8_t hops_away; + /* True if node is in our favorites list + Persists between NodeDB internal clean ups */ + bool is_favorite; } meshtastic_NodeInfo; /* Unique local debugging info for this node @@ -906,7 +909,7 @@ extern "C" { #define meshtastic_Waypoint_init_default {0, 0, 0, 0, 0, "", "", 0} #define meshtastic_MqttClientProxyMessage_init_default {"", 0, {{0, {0}}}, 0} #define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0} -#define meshtastic_NodeInfo_init_default {0, false, meshtastic_User_init_default, false, meshtastic_Position_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, 0} +#define meshtastic_NodeInfo_init_default {0, false, meshtastic_User_init_default, false, meshtastic_Position_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, 0, 0} #define meshtastic_MyNodeInfo_init_default {0, 0, 0} #define meshtastic_LogRecord_init_default {"", 0, "", _meshtastic_LogRecord_Level_MIN} #define meshtastic_QueueStatus_init_default {0, 0, 0, 0} @@ -925,7 +928,7 @@ extern "C" { #define meshtastic_Waypoint_init_zero {0, 0, 0, 0, 0, "", "", 0} #define meshtastic_MqttClientProxyMessage_init_zero {"", 0, {{0, {0}}}, 0} #define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0} -#define meshtastic_NodeInfo_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_Position_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, 0} +#define meshtastic_NodeInfo_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_Position_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, 0, 0} #define meshtastic_MyNodeInfo_init_zero {0, 0, 0} #define meshtastic_LogRecord_init_zero {"", 0, "", _meshtastic_LogRecord_Level_MIN} #define meshtastic_QueueStatus_init_zero {0, 0, 0, 0} @@ -1016,6 +1019,7 @@ extern "C" { #define meshtastic_NodeInfo_channel_tag 7 #define meshtastic_NodeInfo_via_mqtt_tag 8 #define meshtastic_NodeInfo_hops_away_tag 9 +#define meshtastic_NodeInfo_is_favorite_tag 10 #define meshtastic_MyNodeInfo_my_node_num_tag 1 #define meshtastic_MyNodeInfo_reboot_count_tag 8 #define meshtastic_MyNodeInfo_min_app_version_tag 11 @@ -1182,7 +1186,8 @@ X(a, STATIC, SINGULAR, FIXED32, last_heard, 5) \ X(a, STATIC, OPTIONAL, MESSAGE, device_metrics, 6) \ X(a, STATIC, SINGULAR, UINT32, channel, 7) \ X(a, STATIC, SINGULAR, BOOL, via_mqtt, 8) \ -X(a, STATIC, SINGULAR, UINT32, hops_away, 9) +X(a, STATIC, SINGULAR, UINT32, hops_away, 9) \ +X(a, STATIC, SINGULAR, BOOL, is_favorite, 10) #define meshtastic_NodeInfo_CALLBACK NULL #define meshtastic_NodeInfo_DEFAULT NULL #define meshtastic_NodeInfo_user_MSGTYPE meshtastic_User @@ -1350,7 +1355,7 @@ extern const pb_msgdesc_t meshtastic_Heartbeat_msg; #define meshtastic_MyNodeInfo_size 18 #define meshtastic_NeighborInfo_size 258 #define meshtastic_Neighbor_size 22 -#define meshtastic_NodeInfo_size 275 +#define meshtastic_NodeInfo_size 277 #define meshtastic_Position_size 144 #define meshtastic_QueueStatus_size 23 #define meshtastic_RouteDiscovery_size 40 From ae32c24c06a3198b4edd5df583a8e759b25ec69a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 21 Mar 2024 19:51:02 -0500 Subject: [PATCH 052/322] Skip favorite nodes when clearing out oldest in NodeDB (#3464) * Skip favorite nodes when clearing out oldest in NodeDB * We should actually map between the types --- src/mesh/NodeDB.cpp | 2 +- src/mesh/TypeConversions.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 80b46a4268..f65fe0da35 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -939,7 +939,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n) uint32_t oldest = UINT32_MAX; int oldestIndex = -1; for (int i = 1; i < numMeshNodes; i++) { - if (meshNodes->at(i).last_heard < oldest) { + if (!meshNodes->at(i).is_favorite && meshNodes->at(i).last_heard < oldest) { oldest = meshNodes->at(i).last_heard; oldestIndex = i; } diff --git a/src/mesh/TypeConversions.cpp b/src/mesh/TypeConversions.cpp index 20b1cb31ef..bcd600f242 100644 --- a/src/mesh/TypeConversions.cpp +++ b/src/mesh/TypeConversions.cpp @@ -12,6 +12,7 @@ meshtastic_NodeInfo TypeConversions::ConvertToNodeInfo(const meshtastic_NodeInfo info.channel = lite->channel; info.via_mqtt = lite->via_mqtt; info.hops_away = lite->hops_away; + info.is_favorite = lite->is_favorite; if (lite->has_position) { info.has_position = true; From e7738facca95cc12b36099deddcbd9870c1124be Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 21 Mar 2024 20:45:48 -0500 Subject: [PATCH 053/322] Log warning cleanup and truth (#3466) --- src/gps/GPS.cpp | 2 +- src/main.cpp | 2 +- src/mesh/MeshService.cpp | 2 +- src/mesh/NodeDB.cpp | 6 +++--- src/mesh/RF95Interface.cpp | 2 +- src/mesh/SX126xInterface.cpp | 2 +- src/mesh/SX128xInterface.cpp | 2 +- src/platform/esp32/SimpleAllocator.cpp | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 7d4f41a55e..df1d40fdf9 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -1278,7 +1278,7 @@ bool GPS::lookForLocation() #ifndef TINYGPS_OPTION_NO_STATISTICS if (reader.failedChecksum() > lastChecksumFailCount) { - LOG_WARN("Warning, %u new GPS checksum failures, for a total of %u.\n", reader.failedChecksum() - lastChecksumFailCount, + LOG_WARN("%u new GPS checksum failures, for a total of %u.\n", reader.failedChecksum() - lastChecksumFailCount, reader.failedChecksum()); lastChecksumFailCount = reader.failedChecksum(); } diff --git a/src/main.cpp b/src/main.cpp index fcd8d7f014..86e682abb0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -644,7 +644,7 @@ void setup() #else // ESP32 SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); - LOG_WARN("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)\n", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); + LOG_DEBUG("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)\n", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); SPI.setFrequency(4000000); #endif diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index 31eb082ec4..2df5d57976 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -359,7 +359,7 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus) LOG_DEBUG("onGPSchanged() - lost validLocation\n"); #endif } - // Used fixed position if configured regalrdless of GPS lock + // Used fixed position if configured regardless of GPS lock if (config.position.fixed_position) { LOG_WARN("Using fixed position\n"); pos = TypeConversions::ConvertToPosition(node->position); diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index f65fe0da35..3734309be5 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -195,7 +195,7 @@ bool NodeDB::factoryReset() // first, remove the "/prefs" (this removes most prefs) rmDir("/prefs"); if (FSCom.exists("/static/rangetest.csv") && !FSCom.remove("/static/rangetest.csv")) { - LOG_WARN("Could not remove rangetest.csv file\n"); + LOG_ERROR("Could not remove rangetest.csv file\n"); } // second, install default state (this will deal with the duplicate mac address issue) installDefaultDeviceState(); @@ -527,7 +527,7 @@ void NodeDB::pickNewNodeNum() LOG_WARN("NOTE! Our desired nodenum 0x%x is invalid or in use, so trying for 0x%x\n", nodeNum, candidate); nodeNum = candidate; } - LOG_WARN("Using nodenum 0x%x \n", nodeNum); + LOG_DEBUG("Using nodenum 0x%x \n", nodeNum); myNodeInfo.my_node_num = nodeNum; } @@ -934,7 +934,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n) if ((numMeshNodes >= MAX_NUM_NODES) || (memGet.getFreeHeap() < meshtastic_NodeInfoLite_size * 3)) { if (screen) screen->print("Warn: node database full!\nErasing oldest entry\n"); - LOG_INFO("Warn: node database full!\nErasing oldest entry\n"); + LOG_WARN("Node database full! Erasing oldest entry\n"); // look for oldest node and erase it uint32_t oldest = UINT32_MAX; int oldestIndex = -1; diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index 72e0f823f9..adc512ae2c 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -19,7 +19,7 @@ RF95Interface::RF95Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIO RADIOLIB_PIN_TYPE busy) : RadioLibInterface(hal, cs, irq, rst, busy) { - LOG_WARN("RF95Interface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); + LOG_DEBUG("RF95Interface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); } /** Some boards require GPIO control of tx vs rx paths */ diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index 7220dd3e5c..104d0a5edc 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -17,7 +17,7 @@ SX126xInterface::SX126xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs RADIOLIB_PIN_TYPE busy) : RadioLibInterface(hal, cs, irq, rst, busy, &lora), lora(&module) { - LOG_WARN("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); + LOG_DEBUG("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); } /// Initialise the Driver transport hardware and software. diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index f2220dbcf1..45325f3397 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -17,7 +17,7 @@ SX128xInterface::SX128xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs RADIOLIB_PIN_TYPE busy) : RadioLibInterface(hal, cs, irq, rst, busy, &lora), lora(&module) { - LOG_WARN("SX128xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); + LOG_DEBUG("SX128xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); } /// Initialise the Driver transport hardware and software. diff --git a/src/platform/esp32/SimpleAllocator.cpp b/src/platform/esp32/SimpleAllocator.cpp index ed44722c5b..63f3b02de0 100644 --- a/src/platform/esp32/SimpleAllocator.cpp +++ b/src/platform/esp32/SimpleAllocator.cpp @@ -58,7 +58,7 @@ void *operator new(size_t sz) throw(std::bad_alloc) void operator delete(void *ptr) throw() { if (activeAllocator) - LOG_DEBUG("Warning: leaking an active allocator object\n"); // We don't properly handle this yet + LOG_WARN("Leaking an active allocator object\n"); // We don't properly handle this yet else free(ptr); } From 9a8be51d7f907195d3b6cb55fab91ce4dccf3d61 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 22 Mar 2024 07:24:10 -0500 Subject: [PATCH 054/322] [create-pull-request] automated change (#3470) Co-authored-by: thebentern --- src/mesh/generated/meshtastic/admin.pb.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mesh/generated/meshtastic/admin.pb.h b/src/mesh/generated/meshtastic/admin.pb.h index 28bda429d5..d2f40c7f03 100644 --- a/src/mesh/generated/meshtastic/admin.pb.h +++ b/src/mesh/generated/meshtastic/admin.pb.h @@ -154,6 +154,10 @@ typedef struct _meshtastic_AdminMessage { char set_ringtone_message[231]; /* Remove the node by the specified node-num from the NodeDB on the device */ uint32_t remove_by_nodenum; + /* Set specified node-num to be favorited on the NodeDB on the device */ + uint32_t set_favorite_node; + /* Set specified node-num to be un-favorited on the NodeDB on the device */ + uint32_t remove_favorite_node; /* Begins an edit transaction for config, module config, owner, and channel settings changes This will delay the standard *implicit* save to the file system and subsequent reboot behavior until committed (commit_edit_settings) */ bool begin_edit_settings; @@ -238,6 +242,8 @@ extern "C" { #define meshtastic_AdminMessage_set_canned_message_module_messages_tag 36 #define meshtastic_AdminMessage_set_ringtone_message_tag 37 #define meshtastic_AdminMessage_remove_by_nodenum_tag 38 +#define meshtastic_AdminMessage_set_favorite_node_tag 39 +#define meshtastic_AdminMessage_remove_favorite_node_tag 40 #define meshtastic_AdminMessage_begin_edit_settings_tag 64 #define meshtastic_AdminMessage_commit_edit_settings_tag 65 #define meshtastic_AdminMessage_reboot_ota_seconds_tag 95 @@ -277,6 +283,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_module_config,set_module X(a, STATIC, ONEOF, STRING, (payload_variant,set_canned_message_module_messages,set_canned_message_module_messages), 36) \ X(a, STATIC, ONEOF, STRING, (payload_variant,set_ringtone_message,set_ringtone_message), 37) \ X(a, STATIC, ONEOF, UINT32, (payload_variant,remove_by_nodenum,remove_by_nodenum), 38) \ +X(a, STATIC, ONEOF, UINT32, (payload_variant,set_favorite_node,set_favorite_node), 39) \ +X(a, STATIC, ONEOF, UINT32, (payload_variant,remove_favorite_node,remove_favorite_node), 40) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,begin_edit_settings,begin_edit_settings), 64) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,commit_edit_settings,commit_edit_settings), 65) \ X(a, STATIC, ONEOF, INT32, (payload_variant,reboot_ota_seconds,reboot_ota_seconds), 95) \ From 37ae3cce4fdda81bfe04ff927487c15bdc86502a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 22 Mar 2024 07:25:00 -0500 Subject: [PATCH 055/322] Enforce consistent polite channel utilization limits except for Sensor role (#3467) --- src/modules/Telemetry/AirQualityTelemetry.cpp | 1 + src/modules/Telemetry/DeviceTelemetry.cpp | 4 ++-- src/modules/Telemetry/EnvironmentTelemetry.cpp | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/Telemetry/AirQualityTelemetry.cpp b/src/modules/Telemetry/AirQualityTelemetry.cpp index 3e9b069c4b..a51a7cea97 100644 --- a/src/modules/Telemetry/AirQualityTelemetry.cpp +++ b/src/modules/Telemetry/AirQualityTelemetry.cpp @@ -45,6 +45,7 @@ int32_t AirQualityTelemetryModule::runOnce() uint32_t now = millis(); if (((lastSentToMesh == 0) || ((now - lastSentToMesh) >= Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.air_quality_interval))) && + airTime->isTxAllowedChannelUtil(config.device.role != meshtastic_Config_DeviceConfig_Role_SENSOR) && airTime->isTxAllowedAirUtil()) { sendTelemetry(); lastSentToMesh = now; diff --git a/src/modules/Telemetry/DeviceTelemetry.cpp b/src/modules/Telemetry/DeviceTelemetry.cpp index 7c02b57b4b..2ae904b89a 100644 --- a/src/modules/Telemetry/DeviceTelemetry.cpp +++ b/src/modules/Telemetry/DeviceTelemetry.cpp @@ -18,8 +18,8 @@ int32_t DeviceTelemetryModule::runOnce() uint32_t now = millis(); if (((lastSentToMesh == 0) || ((now - lastSentToMesh) >= Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.device_update_interval))) && - airTime->isTxAllowedChannelUtil() && airTime->isTxAllowedAirUtil() && - config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER && + airTime->isTxAllowedChannelUtil(config.device.role != meshtastic_Config_DeviceConfig_Role_SENSOR) && + airTime->isTxAllowedAirUtil() && config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER && config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_HIDDEN) { sendTelemetry(); lastSentToMesh = now; diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 203b632a75..908062a5b1 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -104,6 +104,7 @@ int32_t EnvironmentTelemetryModule::runOnce() uint32_t now = millis(); if (((lastSentToMesh == 0) || ((now - lastSentToMesh) >= Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval))) && + airTime->isTxAllowedChannelUtil(config.device.role != meshtastic_Config_DeviceConfig_Role_SENSOR) && airTime->isTxAllowedAirUtil()) { sendTelemetry(); lastSentToMesh = now; From 771b181218f2695f58b1553f8c1aaa712ed92916 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 22 Mar 2024 10:53:18 -0500 Subject: [PATCH 056/322] Add set and remove favorite nodes admin commands (#3471) --- src/modules/AdminModule.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 6d420ddb8a..ae0dac9ff6 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -189,6 +189,22 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta nodeDB->removeNodeByNum(r->remove_by_nodenum); break; } + case meshtastic_AdminMessage_set_favorite_node_tag: { + LOG_INFO("Client is receiving a set_favorite_node command.\n"); + meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node); + if (node != NULL) { + node->is_favorite = true; + } + break; + } + case meshtastic_AdminMessage_remove_favorite_node_tag: { + LOG_INFO("Client is receiving a remove_favorite_node command.\n"); + meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node); + if (node != NULL) { + node->is_favorite = false; + } + break; + } case meshtastic_AdminMessage_enter_dfu_mode_request_tag: { LOG_INFO("Client is requesting to enter DFU mode.\n"); #if defined(ARCH_NRF52) || defined(ARCH_RP2040) From fcbdd6988519db9f6cad69804b4d195ee4de16f5 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 23 Mar 2024 13:31:58 +0100 Subject: [PATCH 057/322] Fix #3452: only alter received packet if port number matches (#3474) * Use `alterReceivedProtobuf()` for NeighborInfo and Traceroute `alterReceived()` should never return NULL Traceroute should be promiscuous * Remove extensive logging from NeighborInfo module --- src/mesh/FloodingRouter.cpp | 9 ---- src/mesh/FloodingRouter.h | 2 - src/mesh/ProtobufModule.h | 4 +- src/modules/NeighborInfoModule.cpp | 72 +++--------------------------- src/modules/NeighborInfoModule.h | 9 +--- src/modules/TraceRouteModule.cpp | 24 ++++------ src/modules/TraceRouteModule.h | 7 +-- 7 files changed, 22 insertions(+), 105 deletions(-) diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp index db3f3f35e6..4cfe982d8b 100644 --- a/src/mesh/FloodingRouter.cpp +++ b/src/mesh/FloodingRouter.cpp @@ -49,15 +49,6 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas tosend->hop_limit--; // bump down the hop count - if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { - // If it is a traceRoute request, update the route that it went via me - if (traceRouteModule && traceRouteModule->wantPacket(p)) - traceRouteModule->updateRoute(tosend); - // If it is a neighborInfo packet, update last_sent_by_id - if (neighborInfoModule && neighborInfoModule->wantPacket(p)) - neighborInfoModule->updateLastSentById(tosend); - } - LOG_INFO("Rebroadcasting received floodmsg to neighbors\n"); // Note: we are careful to resend using the original senders node id // We are careful not to call our hooked version of send() - because we don't want to check this again diff --git a/src/mesh/FloodingRouter.h b/src/mesh/FloodingRouter.h index 309035cb30..a3adfe70c9 100644 --- a/src/mesh/FloodingRouter.h +++ b/src/mesh/FloodingRouter.h @@ -2,8 +2,6 @@ #include "PacketHistory.h" #include "Router.h" -#include "modules/NeighborInfoModule.h" -#include "modules/TraceRouteModule.h" /** * This is a mixin that extends Router with the ability to do Naive Flooding (in the standard mesh protocol sense) diff --git a/src/mesh/ProtobufModule.h b/src/mesh/ProtobufModule.h index 1067ee01e9..a2e89e98ac 100644 --- a/src/mesh/ProtobufModule.h +++ b/src/mesh/ProtobufModule.h @@ -108,8 +108,8 @@ template class ProtobufModule : protected SinglePortModule // if we can't decode it, nobody can process it! return; } - } - return alterReceivedProtobuf(mp, decoded); + return alterReceivedProtobuf(mp, decoded); + } } }; \ No newline at end of file diff --git a/src/modules/NeighborInfoModule.cpp b/src/modules/NeighborInfoModule.cpp index 4d68b4a162..1e96524695 100644 --- a/src/modules/NeighborInfoModule.cpp +++ b/src/modules/NeighborInfoModule.cpp @@ -18,73 +18,24 @@ void NeighborInfoModule::printNeighborInfo(const char *header, const meshtastic_ { LOG_DEBUG("%s NEIGHBORINFO PACKET from Node 0x%x to Node 0x%x (last sent by 0x%x)\n", header, np->node_id, nodeDB->getNodeNum(), np->last_sent_by_id); - LOG_DEBUG("----------------\n"); LOG_DEBUG("Packet contains %d neighbors\n", np->neighbors_count); for (int i = 0; i < np->neighbors_count; i++) { LOG_DEBUG("Neighbor %d: node_id=0x%x, snr=%.2f\n", i, np->neighbors[i].node_id, np->neighbors[i].snr); } - LOG_DEBUG("----------------\n"); -} -/* -Prints the nodeDB nodes so we can see whose nodeInfo we have -NOTE: for debugging only -*/ -void NeighborInfoModule::printNodeDBNodes(const char *header) -{ - int num_nodes = nodeDB->getNumMeshNodes(); - LOG_DEBUG("%s NODEDB SELECTION from Node 0x%x:\n", header, nodeDB->getNodeNum()); - LOG_DEBUG("----------------\n"); - LOG_DEBUG("DB contains %d nodes\n", num_nodes); - for (int i = 0; i < num_nodes; i++) { - const meshtastic_NodeInfoLite *dbEntry = nodeDB->getMeshNodeByIndex(i); - LOG_DEBUG(" Node %d: node_id=0x%x, snr=%.2f\n", i, dbEntry->num, dbEntry->snr); - } - LOG_DEBUG("----------------\n"); } /* Prints the nodeDB neighbors NOTE: for debugging only */ -void NeighborInfoModule::printNodeDBNeighbors(const char *header) +void NeighborInfoModule::printNodeDBNeighbors() { int num_neighbors = getNumNeighbors(); - LOG_DEBUG("%s NODEDB SELECTION from Node 0x%x:\n", header, nodeDB->getNodeNum()); - LOG_DEBUG("----------------\n"); - LOG_DEBUG("DB contains %d neighbors\n", num_neighbors); + LOG_DEBUG("Our NodeDB contains %d neighbors\n", num_neighbors); for (int i = 0; i < num_neighbors; i++) { const meshtastic_Neighbor *dbEntry = getNeighborByIndex(i); LOG_DEBUG(" Node %d: node_id=0x%x, snr=%.2f\n", i, dbEntry->node_id, dbEntry->snr); } - LOG_DEBUG("----------------\n"); -} - -/* -Prints the nodeDB with selectors for the neighbors we've chosen to send (inefficiently) -Uses LOG_DEBUG, which equates to Console.log -NOTE: For debugging only -*/ -void NeighborInfoModule::printNodeDBSelection(const char *header, const meshtastic_NeighborInfo *np) -{ - int num_neighbors = getNumNeighbors(); - LOG_DEBUG("%s NODEDB SELECTION from Node 0x%x:\n", header, nodeDB->getNodeNum()); - LOG_DEBUG("----------------\n"); - LOG_DEBUG("Selected %d neighbors of %d DB neighbors\n", np->neighbors_count, num_neighbors); - for (int i = 0; i < num_neighbors; i++) { - meshtastic_Neighbor *dbEntry = getNeighborByIndex(i); - bool chosen = false; - for (int j = 0; j < np->neighbors_count; j++) { - if (np->neighbors[j].node_id == dbEntry->node_id) { - chosen = true; - } - } - if (!chosen) { - LOG_DEBUG(" Node %d: neighbor=0x%x, snr=%.2f\n", i, dbEntry->node_id, dbEntry->snr); - } else { - LOG_DEBUG("---> Node %d: neighbor=0x%x, snr=%.2f\n", i, dbEntry->node_id, dbEntry->snr); - } - } - LOG_DEBUG("----------------\n"); } /* Send our initial owner announcement 35 seconds after we start (to give network time to setup) */ @@ -129,9 +80,7 @@ uint32_t NeighborInfoModule::collectNeighborInfo(meshtastic_NeighborInfo *neighb neighborInfo->neighbors_count++; } } - printNodeDBNodes("DBSTATE"); - printNodeDBNeighbors("NEIGHBORS"); - printNodeDBSelection("COLLECTED", neighborInfo); + printNodeDBNeighbors(); return neighborInfo->neighbors_count; } @@ -218,20 +167,13 @@ bool NeighborInfoModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, /* Copy the content of a current NeighborInfo packet into a new one and update the last_sent_by_id to our NodeNum */ -void NeighborInfoModule::updateLastSentById(meshtastic_MeshPacket *p) +void NeighborInfoModule::alterReceivedProtobuf(meshtastic_MeshPacket &p, meshtastic_NeighborInfo *n) { - auto &incoming = p->decoded; - meshtastic_NeighborInfo scratch; - meshtastic_NeighborInfo *updated = NULL; - memset(&scratch, 0, sizeof(scratch)); - pb_decode_from_bytes(incoming.payload.bytes, incoming.payload.size, &meshtastic_NeighborInfo_msg, &scratch); - updated = &scratch; - - updated->last_sent_by_id = nodeDB->getNodeNum(); + n->last_sent_by_id = nodeDB->getNodeNum(); // Set updated last_sent_by_id to the payload of the to be flooded packet - p->decoded.payload.size = - pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_NeighborInfo_msg, updated); + p.decoded.payload.size = + pb_encode_to_bytes(p.decoded.payload.bytes, sizeof(p.decoded.payload.bytes), &meshtastic_NeighborInfo_msg, n); } void NeighborInfoModule::resetNeighbors() diff --git a/src/modules/NeighborInfoModule.h b/src/modules/NeighborInfoModule.h index 820e2d0d45..b4acb0f666 100644 --- a/src/modules/NeighborInfoModule.h +++ b/src/modules/NeighborInfoModule.h @@ -20,9 +20,6 @@ class NeighborInfoModule : public ProtobufModule, priva bool saveProtoForModule(); - // Let FloodingRouter call updateLastSentById upon rebroadcasting a NeighborInfo packet - friend class FloodingRouter; - protected: // Note: this holds our local info. meshtastic_NeighborInfo neighborState; @@ -68,7 +65,7 @@ class NeighborInfoModule : public ProtobufModule, priva void updateNeighbors(const meshtastic_MeshPacket &mp, const meshtastic_NeighborInfo *np); /* update a NeighborInfo packet with our NodeNum as last_sent_by_id */ - void updateLastSentById(meshtastic_MeshPacket *p); + void alterReceivedProtobuf(meshtastic_MeshPacket &p, meshtastic_NeighborInfo *n) override; void loadProtoForModule(); @@ -81,8 +78,6 @@ class NeighborInfoModule : public ProtobufModule, priva /* These are for debugging only */ void printNeighborInfo(const char *header, const meshtastic_NeighborInfo *np); - void printNodeDBNodes(const char *header); - void printNodeDBNeighbors(const char *header); - void printNodeDBSelection(const char *header, const meshtastic_NeighborInfo *np); + void printNodeDBNeighbors(); }; extern NeighborInfoModule *neighborInfoModule; \ No newline at end of file diff --git a/src/modules/TraceRouteModule.cpp b/src/modules/TraceRouteModule.cpp index 311e211f3c..aa0b6a1ebd 100644 --- a/src/modules/TraceRouteModule.cpp +++ b/src/modules/TraceRouteModule.cpp @@ -1,5 +1,4 @@ #include "TraceRouteModule.h" -#include "FloodingRouter.h" #include "MeshService.h" TraceRouteModule *traceRouteModule; @@ -14,23 +13,17 @@ bool TraceRouteModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, m return false; // let it be handled by RoutingModule } -void TraceRouteModule::updateRoute(meshtastic_MeshPacket *p) +void TraceRouteModule::alterReceivedProtobuf(meshtastic_MeshPacket &p, meshtastic_RouteDiscovery *r) { - auto &incoming = p->decoded; - // Only append an ID for the request (one way) - if (!incoming.request_id) { - meshtastic_RouteDiscovery scratch; - meshtastic_RouteDiscovery *updated = NULL; - memset(&scratch, 0, sizeof(scratch)); - pb_decode_from_bytes(incoming.payload.bytes, incoming.payload.size, &meshtastic_RouteDiscovery_msg, &scratch); - updated = &scratch; - - appendMyID(updated); - printRoute(updated, p->from, NODENUM_BROADCAST); + auto &incoming = p.decoded; + // Only append an ID for the request (one way) and if we are not the destination (the reply will have our NodeNum already) + if (!incoming.request_id && p.to != nodeDB->getNodeNum()) { + appendMyID(r); + printRoute(r, p.from, NODENUM_BROADCAST); // Set updated route to the payload of the to be flooded packet - p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), - &meshtastic_RouteDiscovery_msg, updated); + p.decoded.payload.size = + pb_encode_to_bytes(p.decoded.payload.bytes, sizeof(p.decoded.payload.bytes), &meshtastic_RouteDiscovery_msg, r); } } @@ -85,4 +78,5 @@ TraceRouteModule::TraceRouteModule() : ProtobufModule("traceroute", meshtastic_PortNum_TRACEROUTE_APP, &meshtastic_RouteDiscovery_msg) { ourPortNum = meshtastic_PortNum_TRACEROUTE_APP; + isPromiscuous = true; // We need to update the route even if it is not destined to us } \ No newline at end of file diff --git a/src/modules/TraceRouteModule.h b/src/modules/TraceRouteModule.h index 674846ef16..15e01debd8 100644 --- a/src/modules/TraceRouteModule.h +++ b/src/modules/TraceRouteModule.h @@ -9,17 +9,14 @@ class TraceRouteModule : public ProtobufModule public: TraceRouteModule(); - // Let FloodingRouter call updateRoute upon rebroadcasting a TraceRoute request - friend class FloodingRouter; - protected: bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_RouteDiscovery *r) override; virtual meshtastic_MeshPacket *allocReply() override; - /* Call before rebroadcasting a RouteDiscovery payload in order to update + /* Called before rebroadcasting a RouteDiscovery payload in order to update the route array containing the IDs of nodes this packet went through */ - void updateRoute(meshtastic_MeshPacket *p); + void alterReceivedProtobuf(meshtastic_MeshPacket &p, meshtastic_RouteDiscovery *r) override; private: // Call to add your ID to the route array of a RouteDiscovery message From 87acb4c68312ad1ae8647ae8457bac62ed2463a2 Mon Sep 17 00:00:00 2001 From: GUVWAF Date: Sat, 23 Mar 2024 19:35:12 +0100 Subject: [PATCH 058/322] Actually update last_report_to_map --- src/mqtt/MQTT.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 390d0e2064..8e7c8f2cc1 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -546,6 +546,7 @@ void MQTT::perhapsReportToMap() return; } else { if (map_position_precision == 0 || (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)) { + last_report_to_map = millis(); LOG_WARN("MQTT Map reporting is enabled, but precision is 0 or no position available.\n"); return; } From f2e68afcf4bfc36cc0d9053f3cbad918071f24aa Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sat, 23 Mar 2024 12:29:05 -0500 Subject: [PATCH 059/322] Crash fix and remove hard-coded path from PiWebServer (#3478) * Remove hard-coded path from PiWebServer * Bump portduino to pick up crash fix * Remove PiWebServer non-ASCII debug output * Trunk formatting --- arch/portduino/portduino.ini | 2 +- src/mesh/raspihttp/PiWebServer.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index b1ff763ca2..1e8694bbbc 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based sim environment on top of any host OS, all hardware will be simulated [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#acf8303a10f05901cae701e6fea6b6c8e25349ff +platform = https://github.com/meshtastic/platform-native.git#1b8a32c60ab7495026033858d53c737f7d1cb34a framework = arduino build_src_filter = diff --git a/src/mesh/raspihttp/PiWebServer.cpp b/src/mesh/raspihttp/PiWebServer.cpp index 41f6727a4b..bffd6c340c 100644 --- a/src/mesh/raspihttp/PiWebServer.cpp +++ b/src/mesh/raspihttp/PiWebServer.cpp @@ -244,7 +244,7 @@ int handleAPIv1ToRadio(const struct _u_request *req, struct _u_response *res, vo // FIXME* Problem with portdunio loosing mountpoint maybe because of running in a real sep. thread - portduinoVFS->mountpoint("/home/marc/.portduino/default"); + portduinoVFS->mountpoint(configWeb.rootPath); LOG_DEBUG("Received %d bytes from PUT request\n", s); webAPI.handleToRadio(buffer, s); @@ -279,8 +279,8 @@ int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res, const char *tmpa = (const char *)txBuf; ulfius_set_string_body_response(res, 200, tmpa); // LOG_DEBUG("\n----webAPI response all:----\n"); - LOG_DEBUG(tmpa); - LOG_DEBUG("\n"); + // LOG_DEBUG(tmpa); + // LOG_DEBUG("\n"); } // Otherwise, just return one protobuf } else { @@ -288,8 +288,8 @@ int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res, const char *tmpa = (const char *)txBuf; ulfius_set_binary_body_response(res, 200, tmpa, len); // LOG_DEBUG("\n----webAPI response:\n"); - LOG_DEBUG(tmpa); - LOG_DEBUG("\n"); + // LOG_DEBUG(tmpa); + // LOG_DEBUG("\n"); } // LOG_DEBUG("end radio->web\n", len); @@ -508,7 +508,7 @@ PiWebServerThread::PiWebServerThread() LOG_INFO("Web Server framework started on port: %i \n", webservport); LOG_INFO("Web Server root %s\n", (char *)webrootpath.c_str()); } else { - LOG_ERROR("Error starting Web Server framework\n"); + LOG_ERROR("Error starting Web Server framework, error number: %d\n", retssl); } } } From 2ae09efc788a986505e4973e6ab8245fa0d8bb72 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 23 Mar 2024 18:38:29 +0100 Subject: [PATCH 060/322] Set unused header bytes to zero for future use (#3479) --- src/mesh/RadioInterface.cpp | 2 ++ src/mesh/RadioInterface.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 859e7bea41..3aac9dfcec 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -564,6 +564,8 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p) h->to = p->to; h->id = p->id; h->channel = p->channel; + h->next_hop = 0; // *** For future use *** + h->relay_node = 0; // *** For future use *** if (p->hop_limit > HOP_MAX) { LOG_WARN("hop limit %d is too high, setting to %d\n", p->hop_limit, HOP_RELIABLE); p->hop_limit = HOP_RELIABLE; diff --git a/src/mesh/RadioInterface.h b/src/mesh/RadioInterface.h index ee4726d745..b965328e46 100644 --- a/src/mesh/RadioInterface.h +++ b/src/mesh/RadioInterface.h @@ -34,6 +34,12 @@ typedef struct { /** The channel hash - used as a hint for the decoder to limit which channels we consider */ uint8_t channel; + + // ***For future use*** Last byte of the NodeNum of the next-hop for this packet + uint8_t next_hop; + + // ***For future use*** Last byte of the NodeNum of the node that will relay/relayed this packet + uint8_t relay_node; } PacketHeader; /** From 92d0d89cc705d42790fc85364da3618e8104dc08 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 23 Mar 2024 19:47:43 -0500 Subject: [PATCH 061/322] [create-pull-request] automated change (#3483) Co-authored-by: thebentern --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 12603eda77..58a6c19d7f 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 3 -build = 2 +build = 3 From 4c1625b95435ae1dd2bf6f5b0d599b4891fe9839 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 27 Mar 2024 07:35:43 +0100 Subject: [PATCH 062/322] configurable RAM usage --- variants/portduino/platformio.ini | 1 + variants/t-deck/platformio.ini | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 29e3eb7bbf..1d9211984f 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -15,6 +15,7 @@ extends = portduino_base build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsanitize=address -lX11 -I variants/portduino -D DEBUG_HEAP + -D RAM_SIZE=4096 -D USE_X11=1 -D HAS_TFT=1 -D HAS_SCREEN=0 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index e7ac417fe1..29a3ee51ac 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -9,13 +9,14 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 + -D RAM_SIZE=512 -D GPS_POWER_TOGGLE -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" - -D CALIBRATE_TOUCH + -D CALIBRATE_TOUCH=0 -D KB_POWERON=10 -D LGFX_DRIVER=LGFX_TDECK -D LGFX_DRIVER_INC=\"LGFX_T_DECK.h\" From 3f7f92c4dbcf8ca2ed5034d3d3c27e4a6e1ae54c Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 29 Mar 2024 14:41:26 +0100 Subject: [PATCH 063/322] I2C keyboard crash workaround --- src/detect/ScanI2CTwoWire.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 146daa3dcf..d87e906826 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -226,7 +226,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port) } break; - SCAN_SIMPLE_CASE(TDECK_KB_ADDR, TDECKKB, "T-Deck keyboard found\n"); + // SCAN_SIMPLE_CASE(TDECK_KB_ADDR, TDECKKB, "T-Deck keyboard found\n"); SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10 keyboard found\n"); SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found\n"); #ifdef HAS_NCP5623 From 5a7ea9d7d6580ed84fd92131026689c6be3c897c Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 29 Mar 2024 14:47:04 +0100 Subject: [PATCH 064/322] trunk fmt --- src/graphics/TFTDisplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 48ed615ec3..93352c6b08 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -333,7 +333,7 @@ static LGFX *tft = nullptr; #include // Graphics and font library for ILI9341 driver chip static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h -#elif ARCH_PORTDUINO && HAS_SCREEN != 0 && !HAS_TFT +#elif ARCH_PORTDUINO && HAS_SCREEN != 0 && !HAS_TFT #include // Graphics and font library for ST7735 driver chip class LGFX : public lgfx::LGFX_Device From 25d8be327d243dae7bd1c9631b2d134b0a64d2bb Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 6 Apr 2024 13:27:22 +0200 Subject: [PATCH 065/322] refactoring part 1: remove MeshPacketClient/Server layer --- src/main.cpp | 8 ++--- src/mesh/api/PacketAPI.cpp | 8 ----- src/mesh/sharedMem/MeshPacketClient.cpp | 40 ---------------------- src/mesh/sharedMem/MeshPacketClient.h | 22 ------------- src/mesh/sharedMem/MeshPacketServer.cpp | 44 ------------------------- src/mesh/sharedMem/MeshPacketServer.h | 22 ------------- src/mesh/sharedMem/PacketClient.cpp | 26 ++++++++------- src/mesh/sharedMem/PacketClient.h | 15 ++++----- src/mesh/sharedMem/PacketServer.cpp | 13 ++++++++ src/mesh/sharedMem/PacketServer.h | 3 +- 10 files changed, 41 insertions(+), 160 deletions(-) delete mode 100644 src/mesh/sharedMem/MeshPacketClient.cpp delete mode 100644 src/mesh/sharedMem/MeshPacketClient.h delete mode 100644 src/mesh/sharedMem/MeshPacketServer.cpp delete mode 100644 src/mesh/sharedMem/MeshPacketServer.h diff --git a/src/main.cpp b/src/main.cpp index 1c3c23727d..556025ea68 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,8 +106,8 @@ AudioThread *audioThread; #if HAS_TFT #include "DeviceScreen.h" -#include "sharedMem/MeshPacketClient.h" -#include "sharedMem/MeshPacketServer.h" +#include "sharedMem/PacketClient.h" +#include "sharedMem/PacketServer.h" void tft_task_handler(void *); @@ -674,9 +674,9 @@ void setup() #endif #if HAS_TFT - MeshPacketServer::init(); + PacketServer::init(); deviceScreen = &DeviceScreen::create(); - deviceScreen->init(new MeshPacketClient); + deviceScreen->init(new PacketClient); #endif // Initialize the screen first so we can show the logo while we start up everything else. diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp index 9b38db7a6b..4942fa2ff6 100644 --- a/src/mesh/api/PacketAPI.cpp +++ b/src/mesh/api/PacketAPI.cpp @@ -1,7 +1,6 @@ #include "api/PacketAPI.h" #include "MeshService.h" #include "RadioInterface.h" -#include "sharedMem/MeshPacketServer.h" PacketAPI *packetAPI = nullptr; @@ -23,18 +22,11 @@ bool PacketAPI::receivePacket(void) isConnected = true; data_received = true; - // TODO: think about redesign or drop class MeshPacketServer meshtastic_ToRadio *mr; - // if (typeid(*server) == typeid(MeshPacketServer)) { - // dynamic_cast(server)->receivePacket(*mr); - // } - // else { auto p = server->receivePacket()->move(); int id = p->getPacketId(); LOG_DEBUG("Received packet id=%u\n", id); - // mr = (meshtastic_ToRadio*)&dynamic_cast*>(p.get())->getData(); mr = (meshtastic_ToRadio *)&static_cast *>(p.get())->getData(); - //} switch (mr->which_payload_variant) { case meshtastic_ToRadio_packet_tag: { diff --git a/src/mesh/sharedMem/MeshPacketClient.cpp b/src/mesh/sharedMem/MeshPacketClient.cpp deleted file mode 100644 index 67a5350d2d..0000000000 --- a/src/mesh/sharedMem/MeshPacketClient.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "MeshPacketClient.h" - -void MeshPacketClient::init(void) -{ - PacketClient::init(); -} - -MeshPacketClient::MeshPacketClient() {} - -bool MeshPacketClient::connect(void) -{ - return PacketClient::connect(); -} - -bool MeshPacketClient::disconnect(void) -{ - return PacketClient::disconnect(); -} - -bool MeshPacketClient::isConnected(void) -{ - return PacketClient::isConnected(); -} - -bool MeshPacketClient::send(meshtastic_ToRadio &&to) -{ - static uint32_t id = 0; - return PacketClient::sendPacket(DataPacket(++id, to)); -} - -meshtastic_FromRadio MeshPacketClient::receive(void) -{ - if (hasData()) { - auto p = receivePacket(); - if (p) { - return static_cast *>(p->move().get())->getData(); - } - } - return meshtastic_FromRadio(); -} diff --git a/src/mesh/sharedMem/MeshPacketClient.h b/src/mesh/sharedMem/MeshPacketClient.h deleted file mode 100644 index 48ef8cb1ee..0000000000 --- a/src/mesh/sharedMem/MeshPacketClient.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "mesh-pb-constants.h" -#include "sharedMem/PacketClient.h" - -/** - * @brief This is a wrapper class for the PaketClient to avoid dealing with DataPackets - * in the application code. - * - */ -class MeshPacketClient : public PacketClient -{ - public: - MeshPacketClient(); - virtual void init(void); - virtual bool connect(void); - virtual bool disconnect(void); - virtual bool isConnected(void); - - virtual bool send(meshtastic_ToRadio &&to); - virtual meshtastic_FromRadio receive(void); -}; diff --git a/src/mesh/sharedMem/MeshPacketServer.cpp b/src/mesh/sharedMem/MeshPacketServer.cpp deleted file mode 100644 index 8df56ab4a8..0000000000 --- a/src/mesh/sharedMem/MeshPacketServer.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "sharedMem/MeshPacketServer.h" -#include "api/PacketAPI.h" -#include "sharedMem/SharedQueue.h" - -SharedQueue *sharedQueue = nullptr; - -MeshPacketServer *meshPacketServer = nullptr; - -void MeshPacketServer::init(void) -{ - meshPacketServer = new MeshPacketServer; - packetAPI = new PacketAPI(meshPacketServer); - meshPacketServer->begin(); -} - -MeshPacketServer::MeshPacketServer() {} - -void MeshPacketServer::begin(void) -{ - sharedQueue = new SharedQueue; - PacketServer::begin(sharedQueue); -} - -bool MeshPacketServer::receivePacket(meshtastic_ToRadio &to) -{ - // auto p = PacketServer::receivePacket()->move(); - auto p = PacketServer::receivePacket()->move(); - if (p) { - // TODO: avoid data copy :( - // to = dynamic_cast*>(p.get())->getData(); - to = static_cast *>(p.get())->getData(); - } - return p != nullptr; -} - -bool MeshPacketServer::sendPacket(meshtastic_FromRadio &from) -{ - return PacketServer::sendPacket(DataPacket(from.id, from)); -} - -bool MeshPacketServer::sendPacket(meshtastic_FromRadio &&from) -{ - return PacketServer::sendPacket(DataPacket(from.id, from)); -} diff --git a/src/mesh/sharedMem/MeshPacketServer.h b/src/mesh/sharedMem/MeshPacketServer.h deleted file mode 100644 index 2d29db503d..0000000000 --- a/src/mesh/sharedMem/MeshPacketServer.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "mesh-pb-constants.h" -#include "sharedMem/PacketServer.h" - -/** - * @brief This is a wrapper class for the PaketServer to avoid dealing with DataPackets - * in the application code. - * - */ -class MeshPacketServer : public PacketServer -{ - public: - MeshPacketServer(); - static void init(void); - virtual void begin(void); - virtual bool receivePacket(meshtastic_ToRadio &to); - virtual bool sendPacket(meshtastic_FromRadio &from); - virtual bool sendPacket(meshtastic_FromRadio &&from); -}; - -extern MeshPacketServer *meshPacketServer; \ No newline at end of file diff --git a/src/mesh/sharedMem/PacketClient.cpp b/src/mesh/sharedMem/PacketClient.cpp index 221345d949..bb523f8d27 100644 --- a/src/mesh/sharedMem/PacketClient.cpp +++ b/src/mesh/sharedMem/PacketClient.cpp @@ -41,21 +41,25 @@ int PacketClient::connect(SharedQueue *_queue) return queue->serverQueueSize(); } -Packet::PacketPtr PacketClient::receivePacket() +bool PacketClient::send(meshtastic_ToRadio &&to) { - assert(queue); - if (queue->serverQueueSize() == 0) - return {nullptr}; - return queue->clientReceive(); + if (available()) { + static uint32_t id = 0; + return queue->clientSend(DataPacket(++id, to)); + } else { + return false; + } } -bool PacketClient::sendPacket(Packet &&p) +meshtastic_FromRadio PacketClient::receive(void) { - assert(queue); - if (queue->clientQueueSize() >= max_packet_queue_size) - return false; - queue->clientSend(std::move(p)); - return true; + if (hasData()) { + auto p = queue->clientReceive(); + if (p) { + return static_cast *>(p->move().get())->getData(); + } + } + return meshtastic_FromRadio(); } bool PacketClient::hasData() const diff --git a/src/mesh/sharedMem/PacketClient.h b/src/mesh/sharedMem/PacketClient.h index a930472d63..1fe57ba896 100644 --- a/src/mesh/sharedMem/PacketClient.h +++ b/src/mesh/sharedMem/PacketClient.h @@ -6,7 +6,7 @@ class SharedQueue; /** - * @brief Generic client implementation to receive from and + * @brief Client implementation to receive packets from and * send packets to the shared queue * */ @@ -14,13 +14,12 @@ class PacketClient : public IClientBase { public: PacketClient(); - virtual void init(void); - virtual bool connect(void); - virtual bool disconnect(void); - virtual bool isConnected(void); - - virtual bool sendPacket(Packet &&p); - virtual Packet::PacketPtr receivePacket(); + void init(void) override; + bool connect(void) override; + bool disconnect(void) override; + bool isConnected(void) override; + bool send(meshtastic_ToRadio &&to) override; + meshtastic_FromRadio receive(void) override; virtual bool hasData() const; virtual bool available() const; diff --git a/src/mesh/sharedMem/PacketServer.cpp b/src/mesh/sharedMem/PacketServer.cpp index 628592cc7e..ce2b96e6c6 100644 --- a/src/mesh/sharedMem/PacketServer.cpp +++ b/src/mesh/sharedMem/PacketServer.cpp @@ -1,11 +1,24 @@ #include "sharedMem/PacketServer.h" +#include "api/PacketAPI.h" #include "sharedMem/SharedQueue.h" #include const uint32_t max_packet_queue_size = 50; +SharedQueue *sharedQueue = nullptr; + +PacketServer *packetServer = nullptr; + PacketServer::PacketServer() : queue(nullptr) {} +void PacketServer::init(void) +{ + packetServer = new PacketServer; + packetAPI = new PacketAPI(packetServer); + sharedQueue = new SharedQueue; + packetServer->begin(sharedQueue); +} + void PacketServer::begin(SharedQueue *_queue) { queue = _queue; diff --git a/src/mesh/sharedMem/PacketServer.h b/src/mesh/sharedMem/PacketServer.h index 44044aa915..fa65afe610 100644 --- a/src/mesh/sharedMem/PacketServer.h +++ b/src/mesh/sharedMem/PacketServer.h @@ -7,12 +7,13 @@ class SharedQueue; /** * Generic server implementation (base class) for bidirectional task communication - * Uses a queue that is shared with the + * Uses a queue that is shared with the client */ class PacketServer { public: PacketServer(); + static void init(void); virtual void begin(SharedQueue *_queue); virtual bool sendPacket(Packet &&p); virtual Packet::PacketPtr receivePacket(void); From 9e6766b081fefd44dc9fcb7cd1bfadb84d369587 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 6 Apr 2024 13:53:08 +0200 Subject: [PATCH 066/322] refactoring part 2: move queue stuff into library --- src/concurrency/PacketQueue.h | 73 ----------------------------- src/mesh/sharedMem/Packet.h | 62 ------------------------ src/mesh/sharedMem/PacketClient.cpp | 3 +- src/mesh/sharedMem/PacketClient.h | 1 - src/mesh/sharedMem/PacketServer.cpp | 2 +- src/mesh/sharedMem/PacketServer.h | 4 +- src/mesh/sharedMem/SharedQueue.cpp | 37 --------------- src/mesh/sharedMem/SharedQueue.h | 35 -------------- 8 files changed, 5 insertions(+), 212 deletions(-) delete mode 100644 src/concurrency/PacketQueue.h delete mode 100644 src/mesh/sharedMem/Packet.h delete mode 100644 src/mesh/sharedMem/SharedQueue.cpp delete mode 100644 src/mesh/sharedMem/SharedQueue.h diff --git a/src/concurrency/PacketQueue.h b/src/concurrency/PacketQueue.h deleted file mode 100644 index 7c909e6823..0000000000 --- a/src/concurrency/PacketQueue.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once - -#include -#include -#include - -#ifdef BLOCKING_PACKET_QUEUE -#include -#endif - -/** - * Generic platform independent and re-entrant queue wrapper that can be used to - * safely pass (generic) movable objects between threads. - */ -template class PacketQueue -{ - public: - PacketQueue() {} - - PacketQueue(PacketQueue const &other) = delete; - - /** - * Push movable object into queue - */ - void push(T &&packet) - { - std::lock_guard lock(mutex); - queue.push(packet.move()); -#ifdef BLOCKING_PACKET_QUEUE - cond.notify_one(); -#endif - } - -#ifdef BLOCKING_PACKET_QUEUE - /** - * Pop movable object from queue (blocking) - */ - std::unique_ptr pop(void) - { - std::unique_lock lock(mutex); - cond.wait(lock, [this] { return !queue.empty(); }); - T packet = queue.front()->move(); - queue.pop(); - return packet; - } -#endif - - /** - * Pop movable object from queue (non-blocking) - */ - std::unique_ptr try_pop() - { - std::lock_guard lock(mutex); - if (queue.empty()) - return {nullptr}; - auto packet = queue.front()->move(); - queue.pop(); - return packet; - } - - uint32_t size() const - { - std::lock_guard lock(mutex); - return queue.size(); - } - - private: - mutable std::mutex mutex; - std::queue> queue; -#ifdef BLOCKING_PACKET_QUEUE - std::condition_variable cond; -#endif -}; \ No newline at end of file diff --git a/src/mesh/sharedMem/Packet.h b/src/mesh/sharedMem/Packet.h deleted file mode 100644 index 5ddff3f8ec..0000000000 --- a/src/mesh/sharedMem/Packet.h +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once - -#include - -/** - * Polymorphic packets that can be moved into and out of packet queues. - */ -class Packet -{ - public: - using PacketPtr = std::unique_ptr; - - Packet(int packetId) : id(packetId) {} - - // virtual move constructor - virtual PacketPtr move() { return PacketPtr(new Packet(std::move(*this))); } - - // Disable copying - Packet(const Packet &) = delete; - Packet &operator=(const Packet &) = delete; - - virtual ~Packet() {} - - int getPacketId() const { return id; } - - protected: - // Enable moving - Packet(Packet &&) = default; - Packet &operator=(Packet &&) = default; - - private: - int id; -}; - -/** - * generic packet type class - */ -template class DataPacket : public Packet -{ - public: - template DataPacket(int id, Args &&...args) : Packet(id), data(new PacketType(std::forward(args)...)) - { - } - - PacketPtr move() override { return PacketPtr(new DataPacket(std::move(*this))); } - - // Disable copying - DataPacket(const DataPacket &) = delete; - DataPacket &operator=(const DataPacket &) = delete; - - virtual ~DataPacket() {} - - const PacketType &getData() const { return *data; } - - protected: - // Enable moving - DataPacket(DataPacket &&) = default; - DataPacket &operator=(DataPacket &&) = default; - - private: - std::unique_ptr data; -}; diff --git a/src/mesh/sharedMem/PacketClient.cpp b/src/mesh/sharedMem/PacketClient.cpp index bb523f8d27..d0656cfd86 100644 --- a/src/mesh/sharedMem/PacketClient.cpp +++ b/src/mesh/sharedMem/PacketClient.cpp @@ -1,6 +1,7 @@ #include "sharedMem/PacketClient.h" +#include "Packet.h" +#include "SharedQueue.h" #include "configuration.h" -#include "sharedMem/SharedQueue.h" #include const uint32_t max_packet_queue_size = 10; diff --git a/src/mesh/sharedMem/PacketClient.h b/src/mesh/sharedMem/PacketClient.h index 1fe57ba896..d4830ee661 100644 --- a/src/mesh/sharedMem/PacketClient.h +++ b/src/mesh/sharedMem/PacketClient.h @@ -1,7 +1,6 @@ #pragma once #include "IClientBase.h" -#include "Packet.h" class SharedQueue; diff --git a/src/mesh/sharedMem/PacketServer.cpp b/src/mesh/sharedMem/PacketServer.cpp index ce2b96e6c6..4112eb6f91 100644 --- a/src/mesh/sharedMem/PacketServer.cpp +++ b/src/mesh/sharedMem/PacketServer.cpp @@ -1,6 +1,6 @@ #include "sharedMem/PacketServer.h" +#include "SharedQueue.h" #include "api/PacketAPI.h" -#include "sharedMem/SharedQueue.h" #include const uint32_t max_packet_queue_size = 50; diff --git a/src/mesh/sharedMem/PacketServer.h b/src/mesh/sharedMem/PacketServer.h index fa65afe610..1adeea0ede 100644 --- a/src/mesh/sharedMem/PacketServer.h +++ b/src/mesh/sharedMem/PacketServer.h @@ -1,7 +1,7 @@ #pragma once -#include "concurrency/PacketQueue.h" -#include "sharedMem/Packet.h" +#include "Packet.h" +#include "PacketQueue.h" class SharedQueue; diff --git a/src/mesh/sharedMem/SharedQueue.cpp b/src/mesh/sharedMem/SharedQueue.cpp deleted file mode 100644 index f1971c4b01..0000000000 --- a/src/mesh/sharedMem/SharedQueue.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "sharedMem/SharedQueue.h" - -SharedQueue::SharedQueue() {} - -SharedQueue::~SharedQueue() {} - -bool SharedQueue::serverSend(Packet &&p) -{ - serverQueue.push(std::move(p)); - return true; -} - -Packet::PacketPtr SharedQueue::serverReceive() -{ - return clientQueue.try_pop(); -} - -size_t SharedQueue::serverQueueSize() const -{ - return serverQueue.size(); -} - -bool SharedQueue::clientSend(Packet &&p) -{ - clientQueue.push(std::move(p)); - return true; -} - -Packet::PacketPtr SharedQueue::clientReceive() -{ - return serverQueue.try_pop(); -} - -size_t SharedQueue::clientQueueSize() const -{ - return clientQueue.size(); -} diff --git a/src/mesh/sharedMem/SharedQueue.h b/src/mesh/sharedMem/SharedQueue.h deleted file mode 100644 index 9b5ea4ca0d..0000000000 --- a/src/mesh/sharedMem/SharedQueue.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include "concurrency/PacketQueue.h" -#include "sharedMem/Packet.h" - -/** - * @brief Queue wrapper that aggregates two thread queues (namely client and server) - * for bidirectional packet transfer between two threads or processes. - * - * This queue may also be created in shared memory (e.g. in Linux for inter-process communication) - */ -class SharedQueue -{ - public: - SharedQueue(); - virtual ~SharedQueue(); - - // server methods - virtual bool serverSend(Packet &&p); - virtual Packet::PacketPtr serverReceive(); - virtual size_t serverQueueSize() const; - - // client methods - virtual bool clientSend(Packet &&p); - virtual Packet::PacketPtr clientReceive(); - virtual size_t clientQueueSize() const; - - private: - // the server pushes into serverQueue and the client pushes into clientQueue - // receiving is done from the opposite queue, respectively - PacketQueue serverQueue; - PacketQueue clientQueue; -}; - -extern SharedQueue *sharedQueue; \ No newline at end of file From d369c5b89e9e98127ba7914b281a9d92cbfb8054 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 7 Apr 2024 12:44:49 +0200 Subject: [PATCH 067/322] USE_PACKET_API compiler switch --- arch/rp2040/rp2040.ini | 2 +- src/mesh/api/PacketAPI.cpp | 4 ++++ variants/monteops_hw1/platformio.ini | 2 +- variants/portduino/platformio.ini | 36 +++++++++++++++++++++++++++- variants/rak10701/platformio.ini | 2 +- variants/rak4631/platformio.ini | 2 +- variants/t-deck/platformio.ini | 1 + 7 files changed, 44 insertions(+), 5 deletions(-) diff --git a/arch/rp2040/rp2040.ini b/arch/rp2040/rp2040.ini index 984d98bea3..0add7de5d9 100644 --- a/arch/rp2040/rp2040.ini +++ b/arch/rp2040/rp2040.ini @@ -12,7 +12,7 @@ build_flags = -D__PLAT_RP2040__ # -D _POSIX_THREADS build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - - - - + ${arduino_base.build_src_filter} - - - - - - - - - - lib_ignore = BluetoothOTA diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp index 4942fa2ff6..ac99d027f0 100644 --- a/src/mesh/api/PacketAPI.cpp +++ b/src/mesh/api/PacketAPI.cpp @@ -1,3 +1,5 @@ +#ifdef USE_PACKET_API + #include "api/PacketAPI.h" #include "MeshService.h" #include "RadioInterface.h" @@ -73,3 +75,5 @@ bool PacketAPI::checkIsConnected() isConnected |= server->hasData(); return isConnected && server->available(); } + +#endif \ No newline at end of file diff --git a/variants/monteops_hw1/platformio.ini b/variants/monteops_hw1/platformio.ini index b813e7bc31..f9d260e74f 100644 --- a/variants/monteops_hw1/platformio.ini +++ b/variants/monteops_hw1/platformio.ini @@ -4,7 +4,7 @@ extends = nrf52840_base board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/monteops_hw1 -D MONTEOPS_HW1 -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" -build_src_filter = ${nrf52_base.build_src_filter} +<../variants/monteops_hw1> + + + - +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/monteops_hw1> + + + lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 1d9211984f..a54bdb59f6 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -10,6 +10,38 @@ lib_deps = ${portduino_base.lib_deps} lovyan03/LovyanGFX@^1.1.12 build_src_filter = ${portduino_base.build_src_filter} +[env:native-tft-320x240] +extends = portduino_base +build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsanitize=address + -I variants/portduino + -I /usr/include + -D DEBUG_HEAP + -D RAM_SIZE=4096 + -D HAS_TFT=1 + -D HAS_SCREEN=0 + -D LV_BUILD_TEST=0 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 +; The pkg-config commands below optionally add link flags. +; the || : is just a "or run the null command" to avoid returning an error code + !pkg-config --libs libulfius --silence-errors || : + !pkg-config --libs openssl --silence-errors || : +board = cross_platform +lib_deps = ${portduino_base.lib_deps} + lovyan03/LovyanGFX@^1.1.12 +build_src_filter = ${portduino_base.build_src_filter} + - + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/generated/ui_320x240/fonts> + +<../lib/device-ui/resources> + +<../lib/device-ui/source> + + + [env:native-x11-320x240] extends = portduino_base build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsanitize=address -lX11 @@ -30,10 +62,12 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti -D LV_COMP_CONF_INCLUDE_SIMPLE -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 board = cross_platform lib_deps = ${portduino_base.lib_deps} - https://github.com/lvgl/lv_drivers.git ; x11 is currently only supported in master branch, not in 8.3.0 + ; x11 is currently only supported in master branch, not in 6.1.1 + https://github.com/lvgl/lv_drivers.git#110089d7f4be4df34aa7efc17c8cdd911e562846 build_src_filter = ${portduino_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> diff --git a/variants/rak10701/platformio.ini b/variants/rak10701/platformio.ini index 8476b2517f..37f785e849 100644 --- a/variants/rak10701/platformio.ini +++ b/variants/rak10701/platformio.ini @@ -8,7 +8,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/rak10701 -D RAK_4631 -DEINK_DISPLAY_MODEL=GxEPD2_213_BN -DEINK_WIDTH=250 -DEINK_HEIGHT=122 -build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak10701> + + + - +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak10701> + + + lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} diff --git a/variants/rak4631/platformio.ini b/variants/rak4631/platformio.ini index 69641d2512..b1bc2d9b55 100644 --- a/variants/rak4631/platformio.ini +++ b/variants/rak4631/platformio.ini @@ -8,7 +8,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631 -D RAK_4631 -DEINK_DISPLAY_MODEL=GxEPD2_213_BN -DEINK_WIDTH=250 -DEINK_HEIGHT=122 -build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631> + + + - +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631> + + + lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 29a3ee51ac..7f571adb30 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -24,6 +24,7 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D VIEW_CLASS=TFTView_320x240 -D VIEW_CLASS_INC=\"TFTView_320x240.h\" ; -D USE_DOUBLE_BUFFER + -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 -I variants/t-deck build_src_filter = ${esp32_base.build_src_filter} From c0a5304ed7b1e47d54fdae38e2294f98dd476a0c Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 7 Apr 2024 15:22:06 +0200 Subject: [PATCH 068/322] refactoring part 3: move PacketClient/Server into lib --- arch/nrf52/nrf52.ini | 2 +- arch/rp2040/rp2040.ini | 2 +- src/main.cpp | 4 +- src/mesh/api/PacketAPI.h | 2 +- src/mesh/sharedMem/PacketClient.cpp | 76 ----------------------------- src/mesh/sharedMem/PacketClient.h | 34 ------------- src/mesh/sharedMem/PacketServer.cpp | 55 --------------------- src/mesh/sharedMem/PacketServer.h | 28 ----------- variants/portduino/platformio.ini | 2 - 9 files changed, 5 insertions(+), 200 deletions(-) delete mode 100644 src/mesh/sharedMem/PacketClient.cpp delete mode 100644 src/mesh/sharedMem/PacketClient.h delete mode 100644 src/mesh/sharedMem/PacketServer.cpp delete mode 100644 src/mesh/sharedMem/PacketServer.h diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index 294cc62384..6f58b44dd6 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -11,7 +11,7 @@ build_flags = -Isrc/platform/nrf52 build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - - - - + ${arduino_base.build_src_filter} - - - - - - - - - - lib_deps= ${arduino_base.lib_deps} diff --git a/arch/rp2040/rp2040.ini b/arch/rp2040/rp2040.ini index 0add7de5d9..4dc89c04b5 100644 --- a/arch/rp2040/rp2040.ini +++ b/arch/rp2040/rp2040.ini @@ -12,7 +12,7 @@ build_flags = -D__PLAT_RP2040__ # -D _POSIX_THREADS build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - - - + ${arduino_base.build_src_filter} - - - - - - - - - lib_ignore = BluetoothOTA diff --git a/src/main.cpp b/src/main.cpp index 556025ea68..c2630c88fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,8 +106,8 @@ AudioThread *audioThread; #if HAS_TFT #include "DeviceScreen.h" -#include "sharedMem/PacketClient.h" -#include "sharedMem/PacketServer.h" +#include "PacketClient.h" +#include "PacketServer.h" void tft_task_handler(void *); diff --git a/src/mesh/api/PacketAPI.h b/src/mesh/api/PacketAPI.h index 015bec2247..d4aaadad8b 100644 --- a/src/mesh/api/PacketAPI.h +++ b/src/mesh/api/PacketAPI.h @@ -1,8 +1,8 @@ #pragma once +#include "PacketServer.h" #include "PhoneAPI.h" #include "concurrency/OSThread.h" -#include "sharedMem/PacketServer.h" /** * A version of the phone API used for inter task communication based on protobuf packets, e.g. diff --git a/src/mesh/sharedMem/PacketClient.cpp b/src/mesh/sharedMem/PacketClient.cpp deleted file mode 100644 index d0656cfd86..0000000000 --- a/src/mesh/sharedMem/PacketClient.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "sharedMem/PacketClient.h" -#include "Packet.h" -#include "SharedQueue.h" -#include "configuration.h" -#include - -const uint32_t max_packet_queue_size = 10; - -void PacketClient::init(void) -{ - // sharedQueue is currently defined external, it is not shared between processes - connect(sharedQueue); -} - -PacketClient::PacketClient() : queue(nullptr) {} - -bool PacketClient::connect(void) -{ - is_connected = true; - return is_connected; -} - -bool PacketClient::disconnect(void) -{ - is_connected = false; - return is_connected; -} - -bool PacketClient::isConnected(void) -{ - return is_connected; -} - -int PacketClient::connect(SharedQueue *_queue) -{ - if (!queue) { - queue = _queue; - } else if (_queue != queue) { - LOG_WARN("Client already connected."); - } - is_connected = true; - return queue->serverQueueSize(); -} - -bool PacketClient::send(meshtastic_ToRadio &&to) -{ - if (available()) { - static uint32_t id = 0; - return queue->clientSend(DataPacket(++id, to)); - } else { - return false; - } -} - -meshtastic_FromRadio PacketClient::receive(void) -{ - if (hasData()) { - auto p = queue->clientReceive(); - if (p) { - return static_cast *>(p->move().get())->getData(); - } - } - return meshtastic_FromRadio(); -} - -bool PacketClient::hasData() const -{ - assert(queue); - return queue->serverQueueSize() > 0; -} - -bool PacketClient::available() const -{ - assert(queue); - return queue->clientQueueSize() < max_packet_queue_size; -} diff --git a/src/mesh/sharedMem/PacketClient.h b/src/mesh/sharedMem/PacketClient.h deleted file mode 100644 index d4830ee661..0000000000 --- a/src/mesh/sharedMem/PacketClient.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include "IClientBase.h" - -class SharedQueue; - -/** - * @brief Client implementation to receive packets from and - * send packets to the shared queue - * - */ -class PacketClient : public IClientBase -{ - public: - PacketClient(); - void init(void) override; - bool connect(void) override; - bool disconnect(void) override; - bool isConnected(void) override; - bool send(meshtastic_ToRadio &&to) override; - meshtastic_FromRadio receive(void) override; - - virtual bool hasData() const; - virtual bool available() const; - - virtual ~PacketClient() = default; - - protected: - virtual int connect(SharedQueue *_queue); - - private: - volatile bool is_connected = false; - SharedQueue *queue; -}; diff --git a/src/mesh/sharedMem/PacketServer.cpp b/src/mesh/sharedMem/PacketServer.cpp deleted file mode 100644 index 4112eb6f91..0000000000 --- a/src/mesh/sharedMem/PacketServer.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "sharedMem/PacketServer.h" -#include "SharedQueue.h" -#include "api/PacketAPI.h" -#include - -const uint32_t max_packet_queue_size = 50; - -SharedQueue *sharedQueue = nullptr; - -PacketServer *packetServer = nullptr; - -PacketServer::PacketServer() : queue(nullptr) {} - -void PacketServer::init(void) -{ - packetServer = new PacketServer; - packetAPI = new PacketAPI(packetServer); - sharedQueue = new SharedQueue; - packetServer->begin(sharedQueue); -} - -void PacketServer::begin(SharedQueue *_queue) -{ - queue = _queue; -} - -Packet::PacketPtr PacketServer::receivePacket(void) -{ - assert(queue); - if (queue->clientQueueSize() == 0) - return {nullptr}; - return queue->serverReceive(); -} - -bool PacketServer::sendPacket(Packet &&p) -{ - assert(queue); - if (queue->serverQueueSize() >= max_packet_queue_size) { - return false; - } - queue->serverSend(std::move(p)); - return true; -} - -bool PacketServer::hasData() const -{ - assert(queue); - return queue->clientQueueSize() > 0; -} - -bool PacketServer::available() const -{ - assert(queue); - return queue->serverQueueSize() < max_packet_queue_size; -} diff --git a/src/mesh/sharedMem/PacketServer.h b/src/mesh/sharedMem/PacketServer.h deleted file mode 100644 index 1adeea0ede..0000000000 --- a/src/mesh/sharedMem/PacketServer.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include "Packet.h" -#include "PacketQueue.h" - -class SharedQueue; - -/** - * Generic server implementation (base class) for bidirectional task communication - * Uses a queue that is shared with the client - */ -class PacketServer -{ - public: - PacketServer(); - static void init(void); - virtual void begin(SharedQueue *_queue); - virtual bool sendPacket(Packet &&p); - virtual Packet::PacketPtr receivePacket(void); - // template variant with typed return values - // template<> Packet::PacketPtr receivePacket() - // template T receivePacket(); - virtual bool hasData() const; - virtual bool available() const; - - private: - SharedQueue *queue; -}; diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index a54bdb59f6..c2d171561a 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -40,7 +40,6 @@ build_src_filter = ${portduino_base.build_src_filter} +<../lib/device-ui/generated/ui_320x240/fonts> +<../lib/device-ui/resources> +<../lib/device-ui/source> - + [env:native-x11-320x240] extends = portduino_base @@ -74,4 +73,3 @@ build_src_filter = ${portduino_base.build_src_filter} +<../lib/device-ui/generated/ui_320x240/fonts> +<../lib/device-ui/resources> +<../lib/device-ui/source> - + From 8dcc42cfb07d7f6835f30f803c9990d92f577110 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 9 Apr 2024 09:04:10 +0200 Subject: [PATCH 069/322] device-ui checkout master --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index d4d9d193d6..1e390665bd 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit d4d9d193d6c0401f909fede4a5004936efbdd475 +Subproject commit 1e390665bdbf1ac85505ad385cbbc24ee4735161 From d83838d7d714fd8a406ea8ba6798698063acf9f0 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 15 Apr 2024 14:59:12 +0200 Subject: [PATCH 070/322] update platform definitions to refactored lib --- variants/portduino/platformio.ini | 10 ++++++---- variants/t-deck/platformio.ini | 3 --- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index c2d171561a..3e96f41c77 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -7,7 +7,8 @@ build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino -I /usr/in !pkg-config --libs openssl --silence-errors || : board = cross_platform lib_deps = ${portduino_base.lib_deps} - lovyan03/LovyanGFX@^1.1.12 +; lovyan03/LovyanGFX@^1.1.12 + https://github.com/lovyan03/LovyanGFX.git#a0e0d14df3f6d24e589b77adb524cc3a75dbf8fa build_src_filter = ${portduino_base.build_src_filter} [env:native-tft-320x240] @@ -33,7 +34,8 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti !pkg-config --libs openssl --silence-errors || : board = cross_platform lib_deps = ${portduino_base.lib_deps} - lovyan03/LovyanGFX@^1.1.12 +; lovyan03/LovyanGFX@^1.1.12 + https://github.com/lovyan03/LovyanGFX.git#a0e0d14df3f6d24e589b77adb524cc3a75dbf8fa build_src_filter = ${portduino_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> @@ -51,8 +53,6 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti -D HAS_TFT=1 -D HAS_SCREEN=0 -D VIEW_320x240 - -D VIEW_CLASS=TFTView_320x240 - -D VIEW_CLASS_INC=\"TFTView_320x240.h\" -D DISP_HOR_RES=320 -D DISP_VER_RES=240 -D LV_BUILD_TEST=0 @@ -67,9 +67,11 @@ board = cross_platform lib_deps = ${portduino_base.lib_deps} ; x11 is currently only supported in master branch, not in 6.1.1 https://github.com/lvgl/lv_drivers.git#110089d7f4be4df34aa7efc17c8cdd911e562846 + https://github.com/lovyan03/LovyanGFX.git#a0e0d14df3f6d24e589b77adb524cc3a75dbf8fa build_src_filter = ${portduino_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/generated/ui_320x240/fonts> +<../lib/device-ui/resources> +<../lib/device-ui/source> + + diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 7f571adb30..b58cccb472 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -19,10 +19,7 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D CALIBRATE_TOUCH=0 -D KB_POWERON=10 -D LGFX_DRIVER=LGFX_TDECK - -D LGFX_DRIVER_INC=\"LGFX_T_DECK.h\" -D VIEW_320x240 - -D VIEW_CLASS=TFTView_320x240 - -D VIEW_CLASS_INC=\"TFTView_320x240.h\" ; -D USE_DOUBLE_BUFFER -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 From a98394327fdffcb318cb3f76e703bb78f3d614fc Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 17 Apr 2024 14:11:33 +0100 Subject: [PATCH 071/322] add portduino seetingsMap configuration --- arch/portduino/portduino.ini | 2 +- lib/device-ui | 2 +- src/main.cpp | 62 +++++++++++++++++++++++++++++-- variants/portduino/platformio.ini | 17 ++++++--- variants/portduino/variant.h | 2 + 5 files changed, 74 insertions(+), 11 deletions(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 6358b8e96d..550e5c4903 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -24,7 +24,7 @@ lib_deps = ${env.lib_deps} ${networking_base.lib_deps} rweather/Crypto@^0.4.0 - ;lovyan03/LovyanGFX@^1.1.12 + https://github.com/lovyan03/LovyanGFX.git#a0e0d14df3f6d24e589b77adb524cc3a75dbf8fa ; contains SDL2 fix build_flags = ${arduino_base.build_flags} diff --git a/lib/device-ui b/lib/device-ui index 1e390665bd..6382b3f57c 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 1e390665bdbf1ac85505ad385cbbc24ee4735161 +Subproject commit 6382b3f57c9350361b0faa6185244ea9f5375bd4 diff --git a/src/main.cpp b/src/main.cpp index 2abd3497bc..9281193083 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -107,6 +107,7 @@ AudioThread *audioThread; #if HAS_TFT #include "DeviceScreen.h" +#include "DisplayDriverConfig.h" #include "PacketClient.h" #include "PacketServer.h" @@ -675,14 +676,69 @@ void setup() #endif #if HAS_TFT - PacketServer::init(); +#ifdef PORTDUINO + if (settingsMap[displayPanel] != no_screen) { + DisplayDriverConfig displayConfig; + char *panels[] = {"NOSCREEN", "ST7789", "ST7735", "ST7735S", "ILI9341", "HX8357D"}; + char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"}; + if (settingsMap[displayPanel] == no_screen /* x11 */) { // TODO: add x11 enum + displayConfig.device(DisplayDriverConfig::device_t::X11); + } else { + displayConfig.device(DisplayDriverConfig::device_t::CUSTOM_TFT) + .panel(DisplayDriverConfig::panel_config_t{ + .type = panels[settingsMap[displayPanel]], + .panel_width = (uint16_t)settingsMap[displayWidth], + .panel_height = (uint16_t)settingsMap[displayHeight], + .rotation = (bool)settingsMap[displayRotate], + .pin_cs = (int16_t)settingsMap[displayCS], + .pin_rst = (int16_t)settingsMap[displayReset], + .offset_x = (uint16_t)settingsMap[displayOffsetX], + .offset_y = (uint16_t)settingsMap[displayOffsetY], + .offset_rotation = 1, // TODO: + .invert = settingsMap[displayInvert] ? true : false, + .rgb_order = false // TODO: + }) + .bus(DisplayDriverConfig::bus_config_t{.freq_write = 40000000, + .freq_read = 16000000, + .spi{ + // .pin_sclk = 11, + // .pin_miso = 9, + // .pin_mosi = 10, + .pin_dc = (int8_t)settingsMap[displayDC], + .use_lock = true, + // .spi_host = 0 // TODO: + }}) + .touch(DisplayDriverConfig::touch_config_t{.type = touch[settingsMap[touchscreenModule]], + //.freq = 2500000, + .pin_int = (int16_t)settingsMap[touchscreenIRQ], + .spi{ + .spi_host = 0, // TODO: + // .pin_sclk = 11, + // .pin_mosi = 10, + // .pin_miso = 9, + }, + .pin_cs = (int16_t)settingsMap[touchscreenCS]}) + .light(DisplayDriverConfig::light_config_t{ + .pin_bl = (int16_t)settingsMap[displayBacklight], + .pwm_channel = -1, // TODO: + .invert = false // TODO: + }); + } + deviceScreen = &DeviceScreen::create(&displayConfig); + PacketServer::init(); + deviceScreen->init(new PacketClient); + } +#else deviceScreen = &DeviceScreen::create(); + PacketServer::init(); deviceScreen->init(new PacketClient); +#endif #endif // Initialize the screen first so we can show the logo while we start up everything else. +#if HAS_SCREEN screen = new graphics::Screen(screen_found, screen_model, screen_geometry); - +#endif // setup TZ prior to time actions. if (*config.device.tzdef) { setenv("TZ", config.device.tzdef, 1); @@ -1059,7 +1115,7 @@ void tft_task_handler(void *param = nullptr) #ifdef HAS_FREE_RTOS vTaskDelay((TickType_t)5); #else - delay(10); + delay(5); #endif } } diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 3e96f41c77..736e70bfd4 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -7,20 +7,22 @@ build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino -I /usr/in !pkg-config --libs openssl --silence-errors || : board = cross_platform lib_deps = ${portduino_base.lib_deps} -; lovyan03/LovyanGFX@^1.1.12 - https://github.com/lovyan03/LovyanGFX.git#a0e0d14df3f6d24e589b77adb524cc3a75dbf8fa build_src_filter = ${portduino_base.build_src_filter} [env:native-tft-320x240] extends = portduino_base -build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsanitize=address +build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsanitize=address -lX11 -I variants/portduino -I /usr/include -D DEBUG_HEAP -D RAM_SIZE=4096 + -D USE_X11=1 ; enables usage of X11 -D HAS_TFT=1 -D HAS_SCREEN=0 + -D DISP_HOR_RES=320 + -D DISP_VER_RES=240 -D LV_BUILD_TEST=0 + -D CALIBRATE_TOUCH=0 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE @@ -28,19 +30,21 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 +; -I lib/device-ui/portduino ; The pkg-config commands below optionally add link flags. ; the || : is just a "or run the null command" to avoid returning an error code !pkg-config --libs libulfius --silence-errors || : !pkg-config --libs openssl --silence-errors || : board = cross_platform lib_deps = ${portduino_base.lib_deps} -; lovyan03/LovyanGFX@^1.1.12 - https://github.com/lovyan03/LovyanGFX.git#a0e0d14df3f6d24e589b77adb524cc3a75dbf8fa + ; x11 is currently only supported in master branch, not in 6.1.1 + https://github.com/lvgl/lv_drivers.git#110089d7f4be4df34aa7efc17c8cdd911e562846 build_src_filter = ${portduino_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/generated/ui_320x240/fonts> +<../lib/device-ui/resources> + +<../lib/device-ui/portduino> +<../lib/device-ui/source> [env:native-x11-320x240] @@ -63,15 +67,16 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 +; -I lib/device-ui/portduino board = cross_platform lib_deps = ${portduino_base.lib_deps} ; x11 is currently only supported in master branch, not in 6.1.1 https://github.com/lvgl/lv_drivers.git#110089d7f4be4df34aa7efc17c8cdd911e562846 - https://github.com/lovyan03/LovyanGFX.git#a0e0d14df3f6d24e589b77adb524cc3a75dbf8fa build_src_filter = ${portduino_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/generated/ui_320x240/fonts> +<../lib/device-ui/resources> + +<../lib/device-ui/portduino> +<../lib/device-ui/source> + diff --git a/variants/portduino/variant.h b/variants/portduino/variant.h index 414a3fa566..e114fac589 100644 --- a/variants/portduino/variant.h +++ b/variants/portduino/variant.h @@ -1,4 +1,6 @@ +#ifndef HAS_SCREEN #define HAS_SCREEN 1 +#endif #define CANNED_MESSAGE_MODULE_ENABLE 1 #define HAS_GPS 1 #define MAX_NUM_NODES settingsMap[maxnodes] From 0840f07e1a2e5db4f8129bed7a85d88232afec3e Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 17 Apr 2024 20:32:11 +0100 Subject: [PATCH 072/322] remove PacketServer -> PacketAPI dependency --- src/main.cpp | 7 +++++-- src/mesh/api/PacketAPI.cpp | 8 +++++++- src/mesh/api/PacketAPI.h | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9281193083..3052c1e588 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -110,6 +110,7 @@ AudioThread *audioThread; #include "DisplayDriverConfig.h" #include "PacketClient.h" #include "PacketServer.h" +#include "api/PacketAPI.h" void tft_task_handler(void *); @@ -725,12 +726,14 @@ void setup() }); } deviceScreen = &DeviceScreen::create(&displayConfig); - PacketServer::init(); + PacketAPI::create(PacketServer::init()); deviceScreen->init(new PacketClient); + } else { + LOG_INFO("Running without TFT display!\n"); } #else deviceScreen = &DeviceScreen::create(); - PacketServer::init(); + PacketAPI::create(PacketServer::init()); deviceScreen->init(new PacketClient); #endif #endif diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp index ac99d027f0..a025ca7f49 100644 --- a/src/mesh/api/PacketAPI.cpp +++ b/src/mesh/api/PacketAPI.cpp @@ -6,7 +6,13 @@ PacketAPI *packetAPI = nullptr; -void PacketAPI::init(void) {} +PacketAPI *PacketAPI::create(PacketServer *_server) +{ + if (!packetAPI) { + packetAPI = new PacketAPI(_server); + } + return packetAPI; +} PacketAPI::PacketAPI(PacketServer *_server) : concurrency::OSThread("PacketAPI"), isConnected(false), server(_server) {} diff --git a/src/mesh/api/PacketAPI.h b/src/mesh/api/PacketAPI.h index d4aaadad8b..f9ae0812a6 100644 --- a/src/mesh/api/PacketAPI.h +++ b/src/mesh/api/PacketAPI.h @@ -12,12 +12,12 @@ class PacketAPI : public PhoneAPI, public concurrency::OSThread { public: - PacketAPI(PacketServer *_server); - static void init(void); + static PacketAPI *create(PacketServer *_server); virtual ~PacketAPI(){}; virtual int32_t runOnce(); protected: + PacketAPI(PacketServer *_server); // Check the current underlying physical queue to see if the client is fetching packets bool checkIsConnected() override; From fbc0c8bae4c7840dc2c5f3a6908e4834ed1b7b61 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 17 Apr 2024 20:35:32 +0100 Subject: [PATCH 073/322] platformio.ini updates --- variants/portduino/platformio.ini | 3 --- variants/t-deck/platformio.ini | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 736e70bfd4..05fc01f9aa 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -30,7 +30,6 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 -; -I lib/device-ui/portduino ; The pkg-config commands below optionally add link flags. ; the || : is just a "or run the null command" to avoid returning an error code !pkg-config --libs libulfius --silence-errors || : @@ -67,7 +66,6 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 -; -I lib/device-ui/portduino board = cross_platform lib_deps = ${portduino_base.lib_deps} ; x11 is currently only supported in master branch, not in 6.1.1 @@ -79,4 +77,3 @@ build_src_filter = ${portduino_base.build_src_filter} +<../lib/device-ui/resources> +<../lib/device-ui/portduino> +<../lib/device-ui/source> - + diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index b58cccb472..3b5a7516eb 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -3,7 +3,7 @@ extends = esp32s3_base board = t-deck board_build.partitions = default_16MB.csv ; just for test -upload_protocol = esp-builtin +upload_protocol = esptool build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D T_DECK -D MAX_THREADS=40 From 99f0deaa91de70411711ec822e3aa2b980e69c65 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 17 Apr 2024 20:37:26 +0100 Subject: [PATCH 074/322] refactoring PacketServer/API device-ui update --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 6382b3f57c..90c8f295f8 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 6382b3f57c9350361b0faa6185244ea9f5375bd4 +Subproject commit 90c8f295f805e5c6483c3d011c0d0d7bd6cd86d8 From ab277ee2d40f8abd9389da0cdd796ff08318a606 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 17 Apr 2024 20:38:51 +0100 Subject: [PATCH 075/322] fix linker error --- arch/portduino/portduino.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 550e5c4903..6531d89427 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -35,3 +35,4 @@ build_flags = -lbluetooth -lgpiod -lyaml-cpp + -lulfius From 774002d7bd5ccbf9581246cb15d304cf9a7e425f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 17 Apr 2024 20:49:58 +0100 Subject: [PATCH 076/322] protobufs update --- protobufs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protobufs b/protobufs index f92900c5f8..ecf105f66d 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit f92900c5f884b04388fb7abf61d4df66783015e4 +Subproject commit ecf105f66d182531423b73f4408c53701313c4eb From 29bd1346281cf04f94cec30f459a6b2a016e9bba Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 17 Apr 2024 21:07:44 +0100 Subject: [PATCH 077/322] revert ulfius --- arch/portduino/portduino.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 36bd6e6101..952555df69 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -35,4 +35,3 @@ build_flags = -lbluetooth -lgpiod -lyaml-cpp - -lulfius From dd4bd9856c20ceac698c81d7cf647b68abdab510 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 18 Apr 2024 14:43:58 +0100 Subject: [PATCH 078/322] fix X11 usage --- src/main.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 51e0279167..11ae05ca9f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -666,9 +666,12 @@ void setup() DisplayDriverConfig displayConfig; char *panels[] = {"NOSCREEN", "ST7789", "ST7735", "ST7735S", "ILI9341", "HX8357D"}; char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"}; +#ifdef USE_X11 if (settingsMap[displayPanel] == no_screen /* x11 */) { // TODO: add x11 enum displayConfig.device(DisplayDriverConfig::device_t::X11); - } else { + } else +#endif + { displayConfig.device(DisplayDriverConfig::device_t::CUSTOM_TFT) .panel(DisplayDriverConfig::panel_config_t{ .type = panels[settingsMap[displayPanel]], @@ -686,21 +689,15 @@ void setup() .bus(DisplayDriverConfig::bus_config_t{.freq_write = 40000000, .freq_read = 16000000, .spi{ - // .pin_sclk = 11, - // .pin_miso = 9, - // .pin_mosi = 10, - .pin_dc = (int8_t)settingsMap[displayDC], - .use_lock = true, + .pin_dc = (int8_t)settingsMap[displayDC], .use_lock = true, // .spi_host = 0 // TODO: }}) .touch(DisplayDriverConfig::touch_config_t{.type = touch[settingsMap[touchscreenModule]], //.freq = 2500000, .pin_int = (int16_t)settingsMap[touchscreenIRQ], + .offset_rotation = 0, // TODO: .spi{ .spi_host = 0, // TODO: - // .pin_sclk = 11, - // .pin_mosi = 10, - // .pin_miso = 9, }, .pin_cs = (int16_t)settingsMap[touchscreenCS]}) .light(DisplayDriverConfig::light_config_t{ From b56fec95de2b7c0b1e84a89f7f27f1a8a6a2337b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 18 Apr 2024 15:16:09 +0100 Subject: [PATCH 079/322] added release build for performance --- variants/portduino/platformio.ini | 49 ++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 05fc01f9aa..a2beeb019f 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -9,8 +9,9 @@ board = cross_platform lib_deps = ${portduino_base.lib_deps} build_src_filter = ${portduino_base.build_src_filter} -[env:native-tft-320x240] +[env:native-tft-320x240-debug] extends = portduino_base +build_type = debug build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsanitize=address -lX11 -I variants/portduino -I /usr/include @@ -23,6 +24,48 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti -D DISP_VER_RES=240 -D LV_BUILD_TEST=0 -D CALIBRATE_TOUCH=0 + -D LV_USE_PERF_MONITOR=1 + -D LV_USE_MEM_MONITOR=1 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 +; The pkg-config commands below optionally add link flags. +; the || : is just a "or run the null command" to avoid returning an error code + !pkg-config --libs libulfius --silence-errors || : + !pkg-config --libs openssl --silence-errors || : +board = cross_platform +lib_deps = ${portduino_base.lib_deps} + ; x11 is currently only supported in master branch, not in 6.1.1 + https://github.com/lvgl/lv_drivers.git#110089d7f4be4df34aa7efc17c8cdd911e562846 +build_src_filter = ${portduino_base.build_src_filter} + - + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/generated/ui_320x240/fonts> + +<../lib/device-ui/resources> + +<../lib/device-ui/portduino> + +<../lib/device-ui/source> + + +[env:native-tft-320x240-release] +extends = portduino_base +build_type = release +build_flags = ${portduino_base.build_flags} -Ofast -lX11 + -I variants/portduino + -I /usr/include + -D RAM_SIZE=4096 + -D USE_X11=1 ; enables usage of X11 + -D HAS_TFT=1 + -D HAS_SCREEN=0 + -D DISP_HOR_RES=320 + -D DISP_VER_RES=240 + -D LV_BUILD_TEST=0 + -D CALIBRATE_TOUCH=0 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE @@ -66,6 +109,10 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 +; The pkg-config commands below optionally add link flags. +; the || : is just a "or run the null command" to avoid returning an error code + !pkg-config --libs libulfius --silence-errors || : + !pkg-config --libs openssl --silence-errors || : board = cross_platform lib_deps = ${portduino_base.lib_deps} ; x11 is currently only supported in master branch, not in 6.1.1 From 695568ee4dffbed8d5ab0cf7487f7f21559907f7 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 18 Apr 2024 15:36:47 +0100 Subject: [PATCH 080/322] added release build + tryfix touch crash --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 90c8f295f8..f101f99c03 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 90c8f295f805e5c6483c3d011c0d0d7bd6cd86d8 +Subproject commit f101f99c0304ba2dbf717ee2259bc3c5770c90f5 From 6652683a5ed09373bbf0a07646f9fc40a800a012 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 18 Apr 2024 15:59:47 +0100 Subject: [PATCH 081/322] added ILI9488+ST7796 --- lib/device-ui | 2 +- src/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index f101f99c03..29894f8abb 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit f101f99c0304ba2dbf717ee2259bc3c5770c90f5 +Subproject commit 29894f8abb8fff763105fff42182411040723d30 diff --git a/src/main.cpp b/src/main.cpp index 11ae05ca9f..f466f2f68f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -664,7 +664,7 @@ void setup() #ifdef PORTDUINO if (settingsMap[displayPanel] != no_screen) { DisplayDriverConfig displayConfig; - char *panels[] = {"NOSCREEN", "ST7789", "ST7735", "ST7735S", "ILI9341", "HX8357D"}; + char *panels[] = {"NOSCREEN", "ST7789", "ST7735", "ST7735S", "ILI9341", "ILI9488", "ST7796", "HX8357D"}; char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"}; #ifdef USE_X11 if (settingsMap[displayPanel] == no_screen /* x11 */) { // TODO: add x11 enum From a3f867724d00d41863bc2b401158e4372549f258 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 19 Apr 2024 21:39:15 +0200 Subject: [PATCH 082/322] update repository links --- .gitmodules | 2 +- lib/device-ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index eb08b22916..8dcefcc6b8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = https://github.com/meshtastic/protobufs.git [submodule "lib/device-ui"] path = lib/device-ui - url = https://github.com/mverch67/device-ui.git + url = https://github.com/meshtastic/device-ui.git diff --git a/lib/device-ui b/lib/device-ui index 29894f8abb..c22269fee6 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 29894f8abb8fff763105fff42182411040723d30 +Subproject commit c22269fee6bcba11eb66111a519bd6506460f811 From 0c291665d8a46507690836aff19bb04c639385f4 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 20 Apr 2024 13:06:09 +0200 Subject: [PATCH 083/322] add X11 panel setting (among others) --- src/main.cpp | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f466f2f68f..19331f8c0e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -664,47 +664,43 @@ void setup() #ifdef PORTDUINO if (settingsMap[displayPanel] != no_screen) { DisplayDriverConfig displayConfig; - char *panels[] = {"NOSCREEN", "ST7789", "ST7735", "ST7735S", "ILI9341", "ILI9488", "ST7796", "HX8357D"}; + char *panels[] = {"NOSCREEN", "X11", "ST7789", "ST7735", "ST7735S", "ST7796", "ILI9341", "ILI9488", "HX8357D"}; char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"}; #ifdef USE_X11 - if (settingsMap[displayPanel] == no_screen /* x11 */) { // TODO: add x11 enum + if (settingsMap[displayPanel] == x11) { displayConfig.device(DisplayDriverConfig::device_t::X11); } else #endif { displayConfig.device(DisplayDriverConfig::device_t::CUSTOM_TFT) - .panel(DisplayDriverConfig::panel_config_t{ - .type = panels[settingsMap[displayPanel]], - .panel_width = (uint16_t)settingsMap[displayWidth], - .panel_height = (uint16_t)settingsMap[displayHeight], - .rotation = (bool)settingsMap[displayRotate], - .pin_cs = (int16_t)settingsMap[displayCS], - .pin_rst = (int16_t)settingsMap[displayReset], - .offset_x = (uint16_t)settingsMap[displayOffsetX], - .offset_y = (uint16_t)settingsMap[displayOffsetY], - .offset_rotation = 1, // TODO: - .invert = settingsMap[displayInvert] ? true : false, - .rgb_order = false // TODO: - }) - .bus(DisplayDriverConfig::bus_config_t{.freq_write = 40000000, + .panel(DisplayDriverConfig::panel_config_t{.type = panels[settingsMap[displayPanel]], + .panel_width = (uint16_t)settingsMap[displayWidth], + .panel_height = (uint16_t)settingsMap[displayHeight], + .rotation = (bool)settingsMap[displayRotate], + .pin_cs = (int16_t)settingsMap[displayCS], + .pin_rst = (int16_t)settingsMap[displayReset], + .offset_x = (uint16_t)settingsMap[displayOffsetX], + .offset_y = (uint16_t)settingsMap[displayOffsetY], + .offset_rotation = (uint8_t)settingsMap[displayOffsetRotate], + .invert = settingsMap[displayInvert] ? true : false, + .rgb_order = (bool)settingsMap[displayRGBOrder]}) + .bus(DisplayDriverConfig::bus_config_t{.freq_write = (uint32_t)settingsMap[displayBusFrequency], .freq_read = 16000000, .spi{ .pin_dc = (int8_t)settingsMap[displayDC], .use_lock = true, // .spi_host = 0 // TODO: }}) .touch(DisplayDriverConfig::touch_config_t{.type = touch[settingsMap[touchscreenModule]], - //.freq = 2500000, + .freq = (uint32_t)settingsMap[touchscreenBusFrequency], .pin_int = (int16_t)settingsMap[touchscreenIRQ], - .offset_rotation = 0, // TODO: + .offset_rotation = (uint8_t)settingsMap[touchscreenRotate], .spi{ .spi_host = 0, // TODO: }, .pin_cs = (int16_t)settingsMap[touchscreenCS]}) - .light(DisplayDriverConfig::light_config_t{ - .pin_bl = (int16_t)settingsMap[displayBacklight], - .pwm_channel = -1, // TODO: - .invert = false // TODO: - }); + .light(DisplayDriverConfig::light_config_t{.pin_bl = (int16_t)settingsMap[displayBacklight], + .pwm_channel = (int8_t)settingsMap[displayBacklightPWMChannel], + .invert = (bool)settingsMap[displayBacklightInvert]}); } deviceScreen = &DeviceScreen::create(&displayConfig); PacketAPI::create(PacketServer::init()); From e9b7502013b92b71799c84e5861309187d93feb9 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 20 Apr 2024 15:27:34 +0200 Subject: [PATCH 084/322] remove x11 target --- variants/portduino/platformio.ini | 36 ------------------------------- 1 file changed, 36 deletions(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index a2beeb019f..974733f321 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -88,39 +88,3 @@ build_src_filter = ${portduino_base.build_src_filter} +<../lib/device-ui/resources> +<../lib/device-ui/portduino> +<../lib/device-ui/source> - -[env:native-x11-320x240] -extends = portduino_base -build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsanitize=address -lX11 - -I variants/portduino - -D DEBUG_HEAP - -D RAM_SIZE=4096 - -D USE_X11=1 - -D HAS_TFT=1 - -D HAS_SCREEN=0 - -D VIEW_320x240 - -D DISP_HOR_RES=320 - -D DISP_VER_RES=240 - -D LV_BUILD_TEST=0 - -D LV_LVGL_H_INCLUDE_SIMPLE - -D LV_CONF_INCLUDE_SIMPLE - -D LV_COMP_CONF_INCLUDE_SIMPLE - -D USE_LOG_DEBUG - -D LOG_DEBUG_INC=\"DebugConfiguration.h\" - -D USE_PACKET_API - -I lib/device-ui/generated/ui_320x240 -; The pkg-config commands below optionally add link flags. -; the || : is just a "or run the null command" to avoid returning an error code - !pkg-config --libs libulfius --silence-errors || : - !pkg-config --libs openssl --silence-errors || : -board = cross_platform -lib_deps = ${portduino_base.lib_deps} - ; x11 is currently only supported in master branch, not in 6.1.1 - https://github.com/lvgl/lv_drivers.git#110089d7f4be4df34aa7efc17c8cdd911e562846 -build_src_filter = ${portduino_base.build_src_filter} - - - +<../lib/device-ui/generated/ui_320x240> - +<../lib/device-ui/generated/ui_320x240/fonts> - +<../lib/device-ui/resources> - +<../lib/device-ui/portduino> - +<../lib/device-ui/source> From 8e66cbfd4645870965fc96d63a2e8d69bf516ea6 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 20 Apr 2024 17:51:49 +0200 Subject: [PATCH 085/322] update want_ack / hop_limit --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index c22269fee6..9ed83b26b8 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit c22269fee6bcba11eb66111a519bd6506460f811 +Subproject commit 9ed83b26b800bec3a8a22da9d55c5acbf967699c From 548b57c2e2de7288045b90630a1c91d2be534388 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 20 Apr 2024 22:10:48 +0200 Subject: [PATCH 086/322] update lib --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 9ed83b26b8..20cf509b30 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 9ed83b26b800bec3a8a22da9d55c5acbf967699c +Subproject commit 20cf509b309d1c186851c806daee1f655a65ff5f From 6d945e06c1c4855ddc64baf88fa5236574770035 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 20 Apr 2024 23:31:00 +0100 Subject: [PATCH 087/322] added heartbeat --- src/mesh/api/PacketAPI.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp index a025ca7f49..f8393fda04 100644 --- a/src/mesh/api/PacketAPI.cpp +++ b/src/mesh/api/PacketAPI.cpp @@ -2,6 +2,7 @@ #include "api/PacketAPI.h" #include "MeshService.h" +#include "PowerFSM.h" #include "RadioInterface.h" PacketAPI *packetAPI = nullptr; @@ -30,6 +31,9 @@ bool PacketAPI::receivePacket(void) isConnected = true; data_received = true; + powerFSM.trigger(EVENT_CONTACT_FROM_PHONE); + lastContactMsec = millis(); + meshtastic_ToRadio *mr; auto p = server->receivePacket()->move(); int id = p->getPacketId(); @@ -49,6 +53,9 @@ bool PacketAPI::receivePacket(void) handleStartConfig(); break; } + case meshtastic_ToRadio_heartbeat_tag: + LOG_DEBUG("Got client heartbeat\n"); + break; default: LOG_ERROR("Error: unhandled meshtastic_ToRadio variant: %d\n", mr->which_payload_variant); break; From a24def610581dd30c4a45064cf3ef4cb29bbe294 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 20 Apr 2024 23:32:01 +0100 Subject: [PATCH 088/322] lib update (heartbeat) --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 20cf509b30..c6f3ee6d68 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 20cf509b309d1c186851c806daee1f655a65ff5f +Subproject commit c6f3ee6d68e8ce9acd36d95f6e810423986c7c56 From ae82c32c29ff09d7ff072fcf170afbcf3b18f85b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 29 Apr 2024 20:47:28 +0200 Subject: [PATCH 089/322] add spi_host support --- arch/portduino/portduino.ini | 2 +- lib/device-ui | 2 +- src/main.cpp | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 4857933ecd..db68bd2f39 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based sim environment on top of any host OS, all hardware will be simulated [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#659e49346aa33008b150dfb206b1817ddabc7132 +platform = https://github.com/meshtastic/platform-native.git#2ef818943157a3ebea7cbbc283d124fb67c0ffc1 framework = arduino build_src_filter = diff --git a/lib/device-ui b/lib/device-ui index c6f3ee6d68..7a39caafd4 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit c6f3ee6d68e8ce9acd36d95f6e810423986c7c56 +Subproject commit 7a39caafd43bf2c149d9e61f2a6935b31d242044 diff --git a/src/main.cpp b/src/main.cpp index e7c24a6e3f..1f926c2cda 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -679,6 +679,9 @@ void setup() } else #endif { + auto spiHost = [](const std::string &spidev) { + return spidev.empty() ? 0 : (spidev[11] - '0') | (spidev[13] - '0') << 4; + }; displayConfig.device(DisplayDriverConfig::device_t::CUSTOM_TFT) .panel(DisplayDriverConfig::panel_config_t{.type = panels[settingsMap[displayPanel]], .panel_width = (uint16_t)settingsMap[displayWidth], @@ -693,16 +696,15 @@ void setup() .rgb_order = (bool)settingsMap[displayRGBOrder]}) .bus(DisplayDriverConfig::bus_config_t{.freq_write = (uint32_t)settingsMap[displayBusFrequency], .freq_read = 16000000, - .spi{ - .pin_dc = (int8_t)settingsMap[displayDC], .use_lock = true, - // .spi_host = 0 // TODO: - }}) + .spi{.pin_dc = (int8_t)settingsMap[displayDC], + .use_lock = true, + .spi_host = (uint16_t)spiHost(settingsStrings[displayspidev])}}) .touch(DisplayDriverConfig::touch_config_t{.type = touch[settingsMap[touchscreenModule]], .freq = (uint32_t)settingsMap[touchscreenBusFrequency], .pin_int = (int16_t)settingsMap[touchscreenIRQ], .offset_rotation = (uint8_t)settingsMap[touchscreenRotate], .spi{ - .spi_host = 0, // TODO: + .spi_host = (int8_t)spiHost(settingsStrings[touchscreenspidev]), }, .pin_cs = (int16_t)settingsMap[touchscreenCS]}) .light(DisplayDriverConfig::light_config_t{.pin_bl = (int16_t)settingsMap[displayBacklight], From fab3028465d9a302305c341a1550267c4a79db1f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 1 May 2024 11:47:03 +0200 Subject: [PATCH 090/322] spi_host support --- arch/portduino/portduino.ini | 4 ++-- lib/device-ui | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index db68bd2f39..b0f0b8a116 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based sim environment on top of any host OS, all hardware will be simulated [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#2ef818943157a3ebea7cbbc283d124fb67c0ffc1 +platform = https://github.com/meshtastic/platform-native.git#784007630ca43b4811c6637606440588bb5acf39 framework = arduino build_src_filter = @@ -24,7 +24,7 @@ lib_deps = ${env.lib_deps} ${networking_base.lib_deps} rweather/Crypto@^0.4.0 - https://github.com/lovyan03/LovyanGFX.git#d35e60f269dfecbb18a8cb0fd07d594c2fb7e7a8 + https://github.com/lovyan03/LovyanGFX.git#5a39989aa2c9492572255b22f033843ec8900233 ; contains spi_host fix build_flags = ${arduino_base.build_flags} diff --git a/lib/device-ui b/lib/device-ui index 7a39caafd4..710a8a2984 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 7a39caafd43bf2c149d9e61f2a6935b31d242044 +Subproject commit 710a8a29847e68c07f98d489abe21fe514254301 From 5ec8e0204470ec46098df7c2cc58c096ceb619a1 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 1 May 2024 22:13:19 +0200 Subject: [PATCH 091/322] add spi_host + missing rotation --- src/graphics/TFTDisplay.cpp | 27 +++++++++++++++++++-------- src/main.cpp | 7 ++----- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 725041bb20..fac38bf9ff 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -338,7 +338,7 @@ static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h class LGFX : public lgfx::LGFX_Device { - lgfx::Panel_LCD *_panel_instance; + lgfx::Panel_Device *_panel_instance; lgfx::Bus_SPI _bus_instance; lgfx::ITouch *_touch_instance; @@ -352,8 +352,19 @@ class LGFX : public lgfx::LGFX_Device _panel_instance = new lgfx::Panel_ST7735; else if (settingsMap[displayPanel] == st7735s) _panel_instance = new lgfx::Panel_ST7735S; + else if (settingsMap[displayPanel] == st7796) + _panel_instance = new lgfx::Panel_ST7796; else if (settingsMap[displayPanel] == ili9341) _panel_instance = new lgfx::Panel_ILI9341; + else if (settingsMap[displayPanel] == ili9488) + _panel_instance = new lgfx::Panel_ILI9488; + else if (settingsMap[displayPanel] == hx8357d) + _panel_instance = new lgfx::Panel_HX8357D; + else { + _panel_instance = new lgfx::Panel_NULL; + LOG_ERROR("Unknown display panel configured!\n"); + } + auto buscfg = _bus_instance.config(); buscfg.spi_mode = 0; buscfg.spi_host = settingsMap[displayspidev]; @@ -367,12 +378,12 @@ class LGFX : public lgfx::LGFX_Device LOG_DEBUG("Height: %d, Width: %d \n", settingsMap[displayHeight], settingsMap[displayWidth]); cfg.pin_cs = settingsMap[displayCS]; // Pin number where CS is connected (-1 = disable) cfg.pin_rst = settingsMap[displayReset]; - cfg.panel_width = settingsMap[displayWidth]; // actual displayable width - cfg.panel_height = settingsMap[displayHeight]; // actual displayable height - cfg.offset_x = settingsMap[displayOffsetX]; // Panel offset amount in X direction - cfg.offset_y = settingsMap[displayOffsetY]; // Panel offset amount in Y direction - cfg.offset_rotation = 0; // Rotation direction value offset 0~7 (4~7 is mirrored) - cfg.invert = settingsMap[displayInvert]; // Set to true if the light/darkness of the panel is reversed + cfg.panel_width = settingsMap[displayWidth]; // actual displayable width + cfg.panel_height = settingsMap[displayHeight]; // actual displayable height + cfg.offset_x = settingsMap[displayOffsetX]; // Panel offset amount in X direction + cfg.offset_y = settingsMap[displayOffsetY]; // Panel offset amount in Y direction + cfg.offset_rotation = settingsMap[displayOffsetRotate]; // Rotation direction value offset 0~7 (4~7 is mirrored) + cfg.invert = settingsMap[displayInvert]; // Set to true if the light/darkness of the panel is reversed _panel_instance->config(cfg); @@ -394,7 +405,7 @@ class LGFX : public lgfx::LGFX_Device touch_cfg.y_max = settingsMap[displayWidth] - 1; touch_cfg.pin_int = settingsMap[touchscreenIRQ]; touch_cfg.bus_shared = true; - touch_cfg.offset_rotation = 1; + touch_cfg.offset_rotation = settingsMap[touchscreenRotate]; if (settingsMap[touchscreenI2CAddr] != -1) { touch_cfg.i2c_addr = settingsMap[touchscreenI2CAddr]; } else { diff --git a/src/main.cpp b/src/main.cpp index 35899e3287..b93bf365d1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -679,9 +679,6 @@ void setup() } else #endif { - auto spiHost = [](const std::string &spidev) { - return spidev.empty() ? 0 : (spidev[11] - '0') | (spidev[13] - '0') << 4; - }; displayConfig.device(DisplayDriverConfig::device_t::CUSTOM_TFT) .panel(DisplayDriverConfig::panel_config_t{.type = panels[settingsMap[displayPanel]], .panel_width = (uint16_t)settingsMap[displayWidth], @@ -698,13 +695,13 @@ void setup() .freq_read = 16000000, .spi{.pin_dc = (int8_t)settingsMap[displayDC], .use_lock = true, - .spi_host = (uint16_t)spiHost(settingsStrings[displayspidev])}}) + .spi_host = (uint16_t)settingsMap[displayspidev]}}) .touch(DisplayDriverConfig::touch_config_t{.type = touch[settingsMap[touchscreenModule]], .freq = (uint32_t)settingsMap[touchscreenBusFrequency], .pin_int = (int16_t)settingsMap[touchscreenIRQ], .offset_rotation = (uint8_t)settingsMap[touchscreenRotate], .spi{ - .spi_host = (int8_t)spiHost(settingsStrings[touchscreenspidev]), + .spi_host = (int8_t)settingsMap[touchscreenspidev], }, .pin_cs = (int16_t)settingsMap[touchscreenCS]}) .light(DisplayDriverConfig::light_config_t{.pin_bl = (int16_t)settingsMap[displayBacklight], From 7990e7ef47429fc51498a2f65ec502626e20a01b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 1 May 2024 22:13:38 +0200 Subject: [PATCH 092/322] update lib spi_host --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 710a8a2984..0b9aee33c6 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 710a8a29847e68c07f98d489abe21fe514254301 +Subproject commit 0b9aee33c6561e3222c271279439db66453d4818 From 500c7d41a73863e3dc6750579ffcd8f6814e7879 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 1 May 2024 22:18:20 +0200 Subject: [PATCH 093/322] retry update lib --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 0b9aee33c6..35ec9328b2 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 0b9aee33c6561e3222c271279439db66453d4818 +Subproject commit 35ec9328b2c0e015bbd07f75ce962dcab5bb5597 From 3f30a84752327a97f98d7a0ba50d424c1f5a3e9d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 2 May 2024 00:07:38 +0200 Subject: [PATCH 094/322] try-fix i2c touch --- src/main.cpp | 34 +++++++++++++++++++++++-------- variants/portduino/platformio.ini | 4 ++-- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b93bf365d1..1cc54af904 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -696,17 +696,35 @@ void setup() .spi{.pin_dc = (int8_t)settingsMap[displayDC], .use_lock = true, .spi_host = (uint16_t)settingsMap[displayspidev]}}) - .touch(DisplayDriverConfig::touch_config_t{.type = touch[settingsMap[touchscreenModule]], - .freq = (uint32_t)settingsMap[touchscreenBusFrequency], - .pin_int = (int16_t)settingsMap[touchscreenIRQ], - .offset_rotation = (uint8_t)settingsMap[touchscreenRotate], - .spi{ - .spi_host = (int8_t)settingsMap[touchscreenspidev], - }, - .pin_cs = (int16_t)settingsMap[touchscreenCS]}) .light(DisplayDriverConfig::light_config_t{.pin_bl = (int16_t)settingsMap[displayBacklight], .pwm_channel = (int8_t)settingsMap[displayBacklightPWMChannel], .invert = (bool)settingsMap[displayBacklightInvert]}); + if (settingsMap[touchscreenI2CAddr] == -1) { + displayConfig.touch( + DisplayDriverConfig::touch_config_t{.type = touch[settingsMap[touchscreenModule]], + .freq = (uint32_t)settingsMap[touchscreenBusFrequency], + .pin_int = (int16_t)settingsMap[touchscreenIRQ], + .offset_rotation = (uint8_t)settingsMap[touchscreenRotate], + .spi{ + .spi_host = (int8_t)settingsMap[touchscreenspidev], + }, + .pin_cs = (int16_t)settingsMap[touchscreenCS]}); + } else { + displayConfig.touch(DisplayDriverConfig::touch_config_t{ + .type = touch[settingsMap[touchscreenModule]], + .freq = (uint32_t)settingsMap[touchscreenBusFrequency], + .x_min = 0, + .x_max = + (uint16_t)((settingsMap[touchscreenRotate] & 1 ? settingsMap[displayWidth] : settingsMap[displayHeight]) - + 1), + .y_min = 0, + .y_max = + (uint16_t)((settingsMap[touchscreenRotate] & 1 ? settingsMap[displayHeight] : settingsMap[displayWidth]) - + 1), + .pin_int = (int16_t)settingsMap[touchscreenIRQ], + .offset_rotation = (uint8_t)settingsMap[touchscreenRotate], + .i2c{.i2c_addr = (uint8_t)settingsMap[touchscreenI2CAddr]}}); + } } deviceScreen = &DeviceScreen::create(&displayConfig); PacketAPI::create(PacketServer::init()); diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 974733f321..3d5993efc7 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -23,7 +23,7 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti -D DISP_HOR_RES=320 -D DISP_VER_RES=240 -D LV_BUILD_TEST=0 - -D CALIBRATE_TOUCH=0 +; -D CALIBRATE_TOUCH=0 -D LV_USE_PERF_MONITOR=1 -D LV_USE_MEM_MONITOR=1 -D LV_LVGL_H_INCLUDE_SIMPLE @@ -63,7 +63,7 @@ build_flags = ${portduino_base.build_flags} -Ofast -lX11 -D DISP_HOR_RES=320 -D DISP_VER_RES=240 -D LV_BUILD_TEST=0 - -D CALIBRATE_TOUCH=0 +; -D CALIBRATE_TOUCH=0 -D LV_USE_PERF_MONITOR=0 -D LV_USE_MEM_MONITOR=0 -D LV_LVGL_H_INCLUDE_SIMPLE From 3fb8cdf7637a439f49d902bcf2bcc5c8ad4f99c3 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 2 May 2024 10:12:47 +0200 Subject: [PATCH 095/322] fix SPI touch --- lib/device-ui | 2 +- src/main.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index 35ec9328b2..2e3d2fbeda 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 35ec9328b2c0e015bbd07f75ce962dcab5bb5597 +Subproject commit 2e3d2fbeda9b5c0aac2de608f732803b4747563f diff --git a/src/main.cpp b/src/main.cpp index 1cc54af904..3046662cce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -715,12 +715,12 @@ void setup() .freq = (uint32_t)settingsMap[touchscreenBusFrequency], .x_min = 0, .x_max = - (uint16_t)((settingsMap[touchscreenRotate] & 1 ? settingsMap[displayWidth] : settingsMap[displayHeight]) - - 1), + (int16_t)((settingsMap[touchscreenRotate] & 1 ? settingsMap[displayWidth] : settingsMap[displayHeight]) - + 1), .y_min = 0, .y_max = - (uint16_t)((settingsMap[touchscreenRotate] & 1 ? settingsMap[displayHeight] : settingsMap[displayWidth]) - - 1), + (int16_t)((settingsMap[touchscreenRotate] & 1 ? settingsMap[displayHeight] : settingsMap[displayWidth]) - + 1), .pin_int = (int16_t)settingsMap[touchscreenIRQ], .offset_rotation = (uint8_t)settingsMap[touchscreenRotate], .i2c{.i2c_addr = (uint8_t)settingsMap[touchscreenI2CAddr]}}); From 62c0acf19c0749daed9c0be9506dd3186d7fe2d6 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 2 May 2024 13:12:25 +0200 Subject: [PATCH 096/322] fix BL/PWM (update lib) --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 2e3d2fbeda..3c5e80981f 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 2e3d2fbeda9b5c0aac2de608f732803b4747563f +Subproject commit 3c5e80981f994f590e1a8efc7fb2ed3080f8f069 From 9c36b9f17ffd74619b35ec90b34545c6fcc7298f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 2 May 2024 19:39:07 +0200 Subject: [PATCH 097/322] unphone part 1 --- boards/unphone.json | 43 +++++++++++++++++++++ src/main.cpp | 3 ++ variants/unphone/pins_arduino.h | 67 +++++++++++++++++++++++++++++++++ variants/unphone/platformio.ini | 54 ++++++++++++++++++++++++-- 4 files changed, 163 insertions(+), 4 deletions(-) create mode 100644 boards/unphone.json create mode 100644 variants/unphone/pins_arduino.h diff --git a/boards/unphone.json b/boards/unphone.json new file mode 100644 index 0000000000..bf59b55a17 --- /dev/null +++ b/boards/unphone.json @@ -0,0 +1,43 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "memory_type": "qio_opi", + "partitions": "default_8MB.csv" + }, + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM", + "-DUNPHONE_SPIN=9", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DARDUINO_USB_MODE=1", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [["0x16D0", "0x1178"]], + "mcu": "esp32s3", + "variant": "unphone" + }, + "connectivity": ["wifi", "bluetooth", "lora"], + "debug": { + "default_tool": "esp-builtin", + "onboard_tools": ["esp-builtin"], + "openocd_target": "esp32s3.cfg" + }, + "frameworks": ["arduino", "espidf"], + "name": "unPhone", + "upload": { + "flash_size": "8MB", + "maximum_ram_size": 327680, + "maximum_size": 8323072, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "require_upload_port": true, + "speed": 921600 + }, + "url": "https://unphone.net/", + "vendor": "University of Sheffield" +} diff --git a/src/main.cpp b/src/main.cpp index 3046662cce..4740c4eaac 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -246,6 +246,9 @@ void setup() #ifdef DEBUG_PORT consoleInit(); // Set serial baud rate and init our mesh console #endif +#ifdef UNPHONE + unphone.printStore(); +#endif serialSinceMsec = millis(); diff --git a/variants/unphone/pins_arduino.h b/variants/unphone/pins_arduino.h new file mode 100644 index 0000000000..c4e9add1c3 --- /dev/null +++ b/variants/unphone/pins_arduino.h @@ -0,0 +1,67 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define USB_VID 0x16D0 +#define USB_PID 0x1178 + +#define EXTERNAL_NUM_INTERRUPTS 46 +#define NUM_DIGITAL_PINS 48 +#define NUM_ANALOG_INPUTS 20 + +#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1) +#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1) +#define digitalPinHasPWM(p) (p < 46) + +#define LED_BUILTIN 13 +#define BUILTIN_LED LED_BUILTIN // backward compatibility + +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +static const uint8_t SDA = 3; +static const uint8_t SCL = 4; + +static const uint8_t SS = 13; +static const uint8_t MOSI = 40; +static const uint8_t MISO = 41; +static const uint8_t SCK = 39; + +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 8; +static const uint8_t A3 = 9; +static const uint8_t A4 = 5; +static const uint8_t A5 = 6; +static const uint8_t A6 = 14; +static const uint8_t A7 = 7; +static const uint8_t A8 = 15; +static const uint8_t A9 = 33; +static const uint8_t A10 = 27; +static const uint8_t A11 = 12; +static const uint8_t A12 = 13; +static const uint8_t A13 = 14; +static const uint8_t A14 = 15; +static const uint8_t A15 = 16; +static const uint8_t A16 = 17; +static const uint8_t A17 = 18; +static const uint8_t A18 = 19; +static const uint8_t A19 = 20; + +static const uint8_t T1 = 2; +static const uint8_t T2 = 8; +static const uint8_t T3 = 9; +static const uint8_t T4 = 5; +static const uint8_t T5 = 6; +static const uint8_t T6 = 14; +static const uint8_t T7 = 7; +static const uint8_t T8 = 15; +static const uint8_t T9 = 33; +static const uint8_t T10 = 27; +static const uint8_t T11 = 12; +static const uint8_t T12 = 13; +static const uint8_t T13 = 14; +static const uint8_t T14 = 15; + +#endif /* Pins_Arduino_h */ diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index e4a92fe4c1..1ecd8f3aad 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -13,7 +13,6 @@ build_unflags = -D ARDUINO_USB_MODE build_flags = ${esp32_base.build_flags} - ;-D BOARD_HAS_PSRAM // what's up with this - doesn't seem to be recognised at boot -D UNPHONE -I variants/unphone -D ARDUINO_USB_MODE=0 @@ -27,6 +26,53 @@ build_flags = ${esp32_base.build_flags} build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone> lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX @ ^1.1.8 - https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic @ ^9.0.0 - adafruit/Adafruit NeoPixel @ ^1.12.0 \ No newline at end of file + lovyan03/LovyanGFX@ 1.1.12 + https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic@9.0.0 + adafruit/Adafruit NeoPixel @ ^1.12.0 + + +[env:unphone-tft] +extends = esp32s3_base +board_level = extra +board = unphone +board_build.partitions = default_8MB.csv +monitor_speed = 115200 +monitor_filters = esp32_exception_decoder +build_flags = ${esp32_base.build_flags} + -D UNPHONE +; -D ARDUINO_USB_MODE=0 + -D UNPHONE_ACCEL=0 + -D UNPHONE_TOUCHS=0 + -D UNPHONE_SDCARD=0 + -D UNPHONE_UI0=0 + -D UNPHONE_LORA=0 + -D UNPHONE_FACTORY_MODE=0 + -D MAX_THREADS=40 + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D RAM_SIZE=512 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_BUILD_TEST=0 + -D LV_USE_PERF_MONITOR=1 + -D LV_USE_MEM_MONITOR=1 + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" +; -D CALIBRATE_TOUCH=0 + -D LGFX_DRIVER=LGFX_UNPHONE_V9 + -D VIEW_320x240 +; -D USE_DOUBLE_BUFFER + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 + -I variants/unphone + +build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone> + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> + +<../lib/device-ui/source> + +lib_deps = ${esp32s3_base.lib_deps} + lovyan03/LovyanGFX@^1.1.12 + https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic@9.0.0 + adafruit/Adafruit NeoPixel@1.12.0 \ No newline at end of file From 3bb506e59368597f53e70112db427e51648eb11d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 2 May 2024 21:17:42 +0200 Subject: [PATCH 098/322] Unphone support --- boards/unphone.json | 2 +- lib/device-ui | 2 +- variants/unphone/platformio.ini | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/boards/unphone.json b/boards/unphone.json index bf59b55a17..1fc1fd21c1 100644 --- a/boards/unphone.json +++ b/boards/unphone.json @@ -10,7 +10,7 @@ "-DBOARD_HAS_PSRAM", "-DUNPHONE_SPIN=9", "-DARDUINO_USB_CDC_ON_BOOT=1", - "-DARDUINO_USB_MODE=1", + "-DARDUINO_USB_MODE=0", "-DARDUINO_RUNNING_CORE=1", "-DARDUINO_EVENT_RUNNING_CORE=1" ], diff --git a/lib/device-ui b/lib/device-ui index 3c5e80981f..6d757cfed7 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 3c5e80981f994f590e1a8efc7fb2ed3080f8f069 +Subproject commit 6d757cfed7caec70892f27a372ae29f5c9a4b1f6 diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index 1ecd8f3aad..53554f06b7 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -40,7 +40,6 @@ monitor_speed = 115200 monitor_filters = esp32_exception_decoder build_flags = ${esp32_base.build_flags} -D UNPHONE -; -D ARDUINO_USB_MODE=0 -D UNPHONE_ACCEL=0 -D UNPHONE_TOUCHS=0 -D UNPHONE_SDCARD=0 @@ -55,8 +54,8 @@ build_flags = ${esp32_base.build_flags} -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE -D LV_BUILD_TEST=0 - -D LV_USE_PERF_MONITOR=1 - -D LV_USE_MEM_MONITOR=1 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" ; -D CALIBRATE_TOUCH=0 From c445af3eb89855c9030f6a7a3b922e75d0381b5f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 2 May 2024 22:32:21 +0200 Subject: [PATCH 099/322] fix includes --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 6d757cfed7..80c7ecf585 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 6d757cfed7caec70892f27a372ae29f5c9a4b1f6 +Subproject commit 80c7ecf585dec870ef6b6cbe7443397475940e43 From 324962bd08a51bfd5715e864a9b51c766403568f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 9 May 2024 10:36:10 +0200 Subject: [PATCH 100/322] X11 panel dimensions --- src/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8f9540d47d..3b3cb61850 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -362,7 +362,7 @@ void setup() Wire.begin(I2C_SDA, I2C_SCL); #elif defined(ARCH_PORTDUINO) if (settingsStrings[i2cdev] != "") { - LOG_INFO("Using %s as I2C device.\n", settingsStrings[i2cdev].c_str()); + LOG_INFO("Using %s as I2C device.\n", settingsStrings[i2cdev]); Wire.begin(settingsStrings[i2cdev].c_str()); } else { LOG_INFO("No I2C device configured, skipping.\n"); @@ -681,7 +681,11 @@ void setup() char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"}; #ifdef USE_X11 if (settingsMap[displayPanel] == x11) { - displayConfig.device(DisplayDriverConfig::device_t::X11); + if (settingsMap[displayWidth] && settingsMap[displayHeight]) + displayConfig = DisplayDriverConfig(DisplayDriverConfig::device_t::X11, (uint16_t)settingsMap[displayWidth], + (uint16_t)settingsMap[displayHeight]); + else + displayConfig.device(DisplayDriverConfig::device_t::X11); } else #endif { From b9dcff5a061e6e3b550152a5240924ef17fc70dd Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 9 May 2024 10:36:23 +0200 Subject: [PATCH 101/322] lib update --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 80c7ecf585..ff3dd691be 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 80c7ecf585dec870ef6b6cbe7443397475940e43 +Subproject commit ff3dd691bed2afbc3ee34f90ccbb52f1badbfdaa From e1f347df867a71202484be4f5a50decfd488b36d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 14 May 2024 21:23:40 +0200 Subject: [PATCH 102/322] fix compiler errors --- src/graphics/Screen.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index cfb08c0f4f..ff3ac798e7 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -26,6 +26,10 @@ class Screen void startRebootScreen() {} void startShutdownScreen() {} void startFirmwareUpdateScreen() {} + void increaseBrightness() {} + void decreaseBrightness() {} + void setFunctionSymbal(std::string) {} + void removeFunctionSymbal(std::string) {} }; } // namespace graphics #else From 3412bade56aa5b139c2eeb1d5e71841f21bb1aa4 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 15 May 2024 13:37:33 +0200 Subject: [PATCH 103/322] fix PortduinoGlue --- src/platform/portduino/PortduinoGlue.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index 89ac806dd0..34129bb918 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -276,7 +276,6 @@ void portduinoSetup() } settingsMap[maxnodes] = (yamlConfig["General"]["MaxNodes"]).as(200); - } catch (YAML::Exception &e) { std::cout << "*** Exception " << e.what() << std::endl; exit(EXIT_FAILURE); From 55e28b2bf626aeae3f1bcef64dfd2d83ce83963a Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 16 May 2024 00:53:37 +0200 Subject: [PATCH 104/322] remove lvglv8 drivers --- variants/portduino/platformio.ini | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 3d5993efc7..510cc3401f 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -9,10 +9,10 @@ board = cross_platform lib_deps = ${portduino_base.lib_deps} build_src_filter = ${portduino_base.build_src_filter} -[env:native-tft-320x240-debug] +[env:native-tft-debug] extends = portduino_base build_type = debug -build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsanitize=address -lX11 +build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 -I variants/portduino -I /usr/include -D DEBUG_HEAP @@ -20,8 +20,6 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti -D USE_X11=1 ; enables usage of X11 -D HAS_TFT=1 -D HAS_SCREEN=0 - -D DISP_HOR_RES=320 - -D DISP_VER_RES=240 -D LV_BUILD_TEST=0 ; -D CALIBRATE_TOUCH=0 -D LV_USE_PERF_MONITOR=1 @@ -38,9 +36,6 @@ build_flags = ${portduino_base.build_flags} -O0 -fno-omit-frame-pointer -fsaniti !pkg-config --libs libulfius --silence-errors || : !pkg-config --libs openssl --silence-errors || : board = cross_platform -lib_deps = ${portduino_base.lib_deps} - ; x11 is currently only supported in master branch, not in 6.1.1 - https://github.com/lvgl/lv_drivers.git#110089d7f4be4df34aa7efc17c8cdd911e562846 build_src_filter = ${portduino_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> @@ -50,7 +45,7 @@ build_src_filter = ${portduino_base.build_src_filter} +<../lib/device-ui/source> -[env:native-tft-320x240-release] +[env:native-tft-release] extends = portduino_base build_type = release build_flags = ${portduino_base.build_flags} -Ofast -lX11 @@ -60,8 +55,6 @@ build_flags = ${portduino_base.build_flags} -Ofast -lX11 -D USE_X11=1 ; enables usage of X11 -D HAS_TFT=1 -D HAS_SCREEN=0 - -D DISP_HOR_RES=320 - -D DISP_VER_RES=240 -D LV_BUILD_TEST=0 ; -D CALIBRATE_TOUCH=0 -D LV_USE_PERF_MONITOR=0 @@ -78,9 +71,6 @@ build_flags = ${portduino_base.build_flags} -Ofast -lX11 !pkg-config --libs libulfius --silence-errors || : !pkg-config --libs openssl --silence-errors || : board = cross_platform -lib_deps = ${portduino_base.lib_deps} - ; x11 is currently only supported in master branch, not in 6.1.1 - https://github.com/lvgl/lv_drivers.git#110089d7f4be4df34aa7efc17c8cdd911e562846 build_src_filter = ${portduino_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> From 279cdd063344c09cceef58a96f4c10ad0ec7b14a Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 16 May 2024 00:54:21 +0200 Subject: [PATCH 105/322] add custom dimension support to X11 panel From 96d97bc0d26ded15b7d848c31d8f3197d46cc659 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 16 May 2024 01:08:38 +0200 Subject: [PATCH 106/322] update lib (lvgl v9) --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index ff3dd691be..54907eeb24 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit ff3dd691bed2afbc3ee34f90ccbb52f1badbfdaa +Subproject commit 54907eeb241dfbd7994b57b74c6df774fddb5b6c From 38362492f2f442a14890349b12bde7f765cf13cd Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 16 May 2024 10:21:18 +0100 Subject: [PATCH 107/322] no lvgl log in release build --- variants/portduino/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 510cc3401f..72bae20a28 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -57,6 +57,7 @@ build_flags = ${portduino_base.build_flags} -Ofast -lX11 -D HAS_SCREEN=0 -D LV_BUILD_TEST=0 ; -D CALIBRATE_TOUCH=0 + -D LV_USE_LOG=0 -D LV_USE_PERF_MONITOR=0 -D LV_USE_MEM_MONITOR=0 -D LV_LVGL_H_INCLUDE_SIMPLE From 4df9da165ca43facd06804446d90fd497a1c59f2 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 16 May 2024 14:49:03 +0200 Subject: [PATCH 108/322] add ARCH_PORTDUINO --- variants/portduino/platformio.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 72bae20a28..04dbcf8778 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -13,6 +13,7 @@ build_src_filter = ${portduino_base.build_src_filter} extends = portduino_base build_type = debug build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 + -D ARCH_PORTDUINO -I variants/portduino -I /usr/include -D DEBUG_HEAP @@ -49,6 +50,7 @@ build_src_filter = ${portduino_base.build_src_filter} extends = portduino_base build_type = release build_flags = ${portduino_base.build_flags} -Ofast -lX11 + -D ARCH_PORTDUINO -I variants/portduino -I /usr/include -D RAM_SIZE=4096 @@ -78,4 +80,4 @@ build_src_filter = ${portduino_base.build_src_filter} +<../lib/device-ui/generated/ui_320x240/fonts> +<../lib/device-ui/resources> +<../lib/device-ui/portduino> - +<../lib/device-ui/source> + +<../lib/device-ui/source> \ No newline at end of file From 5eabfaa93d4bdefdf829deec7fce155dba630949 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 16 May 2024 14:49:29 +0200 Subject: [PATCH 109/322] fix for ILI9488 --- src/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index a75b17ad74..9565fe9be2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -702,7 +702,8 @@ void setup() .offset_y = (uint16_t)settingsMap[displayOffsetY], .offset_rotation = (uint8_t)settingsMap[displayOffsetRotate], .invert = settingsMap[displayInvert] ? true : false, - .rgb_order = (bool)settingsMap[displayRGBOrder]}) + .rgb_order = (bool)settingsMap[displayRGBOrder], + .dlen_16bit = settingsMap[displayPanel] == ili9488}) .bus(DisplayDriverConfig::bus_config_t{.freq_write = (uint32_t)settingsMap[displayBusFrequency], .freq_read = 16000000, .spi{.pin_dc = (int8_t)settingsMap[displayDC], From 4e1ed326a9fad1d6b484c01a2842dce5ff140ac1 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 16 May 2024 14:49:57 +0200 Subject: [PATCH 110/322] update lib --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 54907eeb24..fade1516d6 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 54907eeb241dfbd7994b57b74c6df774fddb5b6c +Subproject commit fade1516d65dc9ec74fce85cf3a077731524f7a6 From c9ed7927387c4d14492b39fa2f2c15fda4ee9974 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 16 May 2024 15:27:40 +0200 Subject: [PATCH 111/322] support ILI9486 --- lib/device-ui | 2 +- src/main.cpp | 6 +++--- src/platform/portduino/PortduinoGlue.cpp | 2 ++ src/platform/portduino/PortduinoGlue.h | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index fade1516d6..3c48d8ca97 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit fade1516d65dc9ec74fce85cf3a077731524f7a6 +Subproject commit 3c48d8ca97ae45b8c2727e9bbc7888d5896f0649 diff --git a/src/main.cpp b/src/main.cpp index 9565fe9be2..5a9ba60eb3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -559,7 +559,6 @@ void setup() SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::QMC5883L, meshtastic_TelemetrySensorType_QMC5883L) SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::PMSA0031, meshtastic_TelemetrySensorType_PMSA003I) SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::RCWL9620, meshtastic_TelemetrySensorType_RCWL9620) - SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::VEML7700, meshtastic_TelemetrySensorType_VEML7700) SCANNER_TO_SENSORS_MAP(ScanI2C::DeviceType::SHT4X, meshtastic_TelemetrySensorType_SHT4X) i2cScanner.reset(); @@ -679,7 +678,7 @@ void setup() #ifdef PORTDUINO if (settingsMap[displayPanel] != no_screen) { DisplayDriverConfig displayConfig; - char *panels[] = {"NOSCREEN", "X11", "ST7789", "ST7735", "ST7735S", "ST7796", "ILI9341", "ILI9488", "HX8357D"}; + char *panels[] = {"NOSCREEN", "X11", "ST7789", "ST7735", "ST7735S", "ST7796", "ILI9341", "ILI9486", "ILI9488", "HX8357D"}; char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"}; #ifdef USE_X11 if (settingsMap[displayPanel] == x11) { @@ -703,7 +702,8 @@ void setup() .offset_rotation = (uint8_t)settingsMap[displayOffsetRotate], .invert = settingsMap[displayInvert] ? true : false, .rgb_order = (bool)settingsMap[displayRGBOrder], - .dlen_16bit = settingsMap[displayPanel] == ili9488}) + .dlen_16bit = settingsMap[displayPanel] == ili9486 || + settingsMap[displayPanel] == ili9488}) .bus(DisplayDriverConfig::bus_config_t{.freq_write = (uint32_t)settingsMap[displayBusFrequency], .freq_read = 16000000, .spi{.pin_dc = (int8_t)settingsMap[displayDC], diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index 34129bb918..b46f714163 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -207,6 +207,8 @@ void portduinoSetup() settingsMap[displayPanel] = st7796; else if (yamlConfig["Display"]["Panel"].as("") == "ILI9341") settingsMap[displayPanel] = ili9341; + else if (yamlConfig["Display"]["Panel"].as("") == "ILI9486") + settingsMap[displayPanel] = ili9486; else if (yamlConfig["Display"]["Panel"].as("") == "ILI9488") settingsMap[displayPanel] = ili9488; else if (yamlConfig["Display"]["Panel"].as("") == "HX8357D") diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index ca935ea3bf..121381aee7 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -51,7 +51,7 @@ enum configNames { webserverrootpath, maxnodes }; -enum { no_screen, x11, st7789, st7735, st7735s, st7796, ili9341, ili9488, hx8357d }; +enum { no_screen, x11, st7789, st7735, st7735s, st7796, ili9341, ili9486, ili9488, hx8357d }; enum { no_touchscreen, xpt2046, stmpe610, gt911, ft5x06 }; enum { level_error, level_warn, level_info, level_debug }; From 0e7a4b391b15f5e7fb9ef40a0c90176b9bc1946d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 16 May 2024 15:27:57 +0200 Subject: [PATCH 112/322] support SHCHV 3.5 RPi TFT+Touchscreen --- bin/config-dist.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index 333d6eadca..1f6c91a42b 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -111,6 +111,16 @@ Display: # Height: 320 # Rotate: true +### SHCHV 3.5 RPi TFT+Touchscreen +# Panel: ILI9486 +# spidev: spidev0.0 +# BusFrequency: 30000000 +# DC: 24 +# Reset: 25 +# Width: 320 +# Height: 480 +# OffsetRotate: 2 + Touchscreen: ### Note, at least for now, the touchscreen must have a CS pin defined, even if you let Linux manage the CS switching. From 64d0e94d184870ed0b8e1da32c4b2620766e3567 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 20 May 2024 20:04:53 +0200 Subject: [PATCH 113/322] add defines for log and monitor --- variants/t-deck/platformio.ini | 5 ++++- variants/unphone/platformio.ini | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index f37e3b2391..19569d7ea0 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -15,10 +15,13 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D CALIBRATE_TOUCH=0 - -D KB_POWERON=10 +; -D KB_POWERON=10 -D LGFX_DRIVER=LGFX_TDECK -D VIEW_320x240 ; -D USE_DOUBLE_BUFFER diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index e4f0148899..7a97cc427e 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -55,6 +55,7 @@ build_flags = ${esp32_base.build_flags} -D LV_BUILD_TEST=0 -D LV_USE_PERF_MONITOR=0 -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" ; -D CALIBRATE_TOUCH=0 From 72b0986a72c805fc35e5de653a6c4c5027d2d7bb Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 25 May 2024 01:09:27 +0200 Subject: [PATCH 114/322] keyboard & mouse input --- lib/device-ui | 2 +- variants/portduino/platformio.ini | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index 3c48d8ca97..923309fb0f 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 3c48d8ca97ae45b8c2727e9bbc7888d5896f0649 +Subproject commit 923309fb0ffca17af04642ce612c6df83173fa3f diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 04dbcf8778..314f84276e 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -12,7 +12,7 @@ build_src_filter = ${portduino_base.build_src_filter} [env:native-tft-debug] extends = portduino_base build_type = debug -build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 +build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 -linput -lxkbcommon -D ARCH_PORTDUINO -I variants/portduino -I /usr/include @@ -21,10 +21,12 @@ build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 -D USE_X11=1 ; enables usage of X11 -D HAS_TFT=1 -D HAS_SCREEN=0 - -D LV_BUILD_TEST=0 ; -D CALIBRATE_TOUCH=0 + -D LV_BUILD_TEST=0 + -D LV_USE_LOG=1 -D LV_USE_PERF_MONITOR=1 -D LV_USE_MEM_MONITOR=1 + -D LV_USE_LIBINPUT=1 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE @@ -49,7 +51,7 @@ build_src_filter = ${portduino_base.build_src_filter} [env:native-tft-release] extends = portduino_base build_type = release -build_flags = ${portduino_base.build_flags} -Ofast -lX11 +build_flags = ${portduino_base.build_flags} -Ofast -lX11 -linput -lxkbcommon -D ARCH_PORTDUINO -I variants/portduino -I /usr/include @@ -62,6 +64,7 @@ build_flags = ${portduino_base.build_flags} -Ofast -lX11 -D LV_USE_LOG=0 -D LV_USE_PERF_MONITOR=0 -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LIBINPUT=1 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE From b867ab5ed831e43d577acfe5ea6bc0cf5d686fa7 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 25 May 2024 12:43:57 +0200 Subject: [PATCH 115/322] defines for monitoring control --- lib/device-ui | 2 +- variants/portduino/platformio.ini | 10 +++++++--- variants/t-deck/platformio.ini | 2 ++ variants/unphone/platformio.ini | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index 923309fb0f..a4994c7518 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 923309fb0ffca17af04642ce612c6df83173fa3f +Subproject commit a4994c751897ef52d872098c441cdb98a1b5967e diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 314f84276e..3919f6c4b7 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -17,15 +17,17 @@ build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 -linput -I variants/portduino -I /usr/include -D DEBUG_HEAP - -D RAM_SIZE=4096 + -D RAM_SIZE=16384 -D USE_X11=1 ; enables usage of X11 -D HAS_TFT=1 -D HAS_SCREEN=0 ; -D CALIBRATE_TOUCH=0 -D LV_BUILD_TEST=0 -D LV_USE_LOG=1 + -D LV_USE_SYSMON=1 -D LV_USE_PERF_MONITOR=1 - -D LV_USE_MEM_MONITOR=1 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_PROFILER=0 -D LV_USE_LIBINPUT=1 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE @@ -55,13 +57,15 @@ build_flags = ${portduino_base.build_flags} -Ofast -lX11 -linput -lxkbcommon -D ARCH_PORTDUINO -I variants/portduino -I /usr/include - -D RAM_SIZE=4096 + -D RAM_SIZE=16384 -D USE_X11=1 ; enables usage of X11 -D HAS_TFT=1 -D HAS_SCREEN=0 -D LV_BUILD_TEST=0 ; -D CALIBRATE_TOUCH=0 -D LV_USE_LOG=0 + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 -D LV_USE_PERF_MONITOR=0 -D LV_USE_MEM_MONITOR=0 -D LV_USE_LIBINPUT=1 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 19569d7ea0..756e11ce4e 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -15,6 +15,8 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 -D LV_USE_PERF_MONITOR=0 -D LV_USE_MEM_MONITOR=0 -D LV_USE_LOG=0 diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index e9e8e1c84c..ce09f10e67 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -54,6 +54,8 @@ build_flags = ${esp32_base.build_flags} -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE -D LV_BUILD_TEST=0 + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 -D LV_USE_PERF_MONITOR=0 -D LV_USE_MEM_MONITOR=0 -D LV_USE_LOG=0 From b8b8e47eaa426b40bcd2e57282415cd4e1ea9c86 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 28 May 2024 14:46:49 +0200 Subject: [PATCH 116/322] keyboard/mouse control for native --- lib/device-ui | 2 +- src/main.cpp | 7 +++++-- src/platform/portduino/PortduinoGlue.cpp | 2 ++ src/platform/portduino/PortduinoGlue.h | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index a4994c7518..901020302a 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit a4994c751897ef52d872098c441cdb98a1b5967e +Subproject commit 901020302a8e6b174142488d117eb916e5212781 diff --git a/src/main.cpp b/src/main.cpp index 2e9643ac4e..2be01942a9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -665,8 +665,9 @@ void setup() #ifdef PORTDUINO if (settingsMap[displayPanel] != no_screen) { DisplayDriverConfig displayConfig; - char *panels[] = {"NOSCREEN", "X11", "ST7789", "ST7735", "ST7735S", "ST7796", "ILI9341", "ILI9486", "ILI9488", "HX8357D"}; - char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"}; + static char *panels[] = {"NOSCREEN", "X11", "ST7789", "ST7735", "ST7735S", + "ST7796", "ILI9341", "ILI9486", "ILI9488", "HX8357D"}; + static char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"}; #ifdef USE_X11 if (settingsMap[displayPanel] == x11) { if (settingsMap[displayWidth] && settingsMap[displayHeight]) @@ -696,6 +697,8 @@ void setup() .spi{.pin_dc = (int8_t)settingsMap[displayDC], .use_lock = true, .spi_host = (uint16_t)settingsMap[displayspidev]}}) + .input(DisplayDriverConfig::input_config_t{.keyboardDevice = settingsStrings[keyboardDevice], + .pointerDevice = settingsStrings[pointerDevice]}) .light(DisplayDriverConfig::light_config_t{.pin_bl = (int16_t)settingsMap[displayBacklight], .pwm_channel = (int8_t)settingsMap[displayBacklightPWMChannel], .invert = (bool)settingsMap[displayBacklightInvert]}); diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index b46f714163..95261bd22d 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -93,6 +93,7 @@ void portduinoSetup() std::string gpioChipName = "gpiochip"; settingsStrings[i2cdev] = ""; settingsStrings[keyboardDevice] = ""; + settingsStrings[pointerDevice] = ""; settingsStrings[webserverrootpath] = ""; settingsStrings[spidev] = ""; settingsStrings[displayspidev] = ""; @@ -270,6 +271,7 @@ void portduinoSetup() } if (yamlConfig["Input"]) { settingsStrings[keyboardDevice] = (yamlConfig["Input"]["KeyboardDevice"]).as(""); + settingsStrings[pointerDevice] = (yamlConfig["Input"]["PointerDevice"]).as(""); } if (yamlConfig["Webserver"]) { diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index 121381aee7..57b0e25641 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -45,6 +45,7 @@ enum configNames { displayOffsetY, displayInvert, keyboardDevice, + pointerDevice, logoutputlevel, webserver, webserverport, From 342de9c4d395b89dbe00beef0d09a77f6cc612aa Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 28 May 2024 21:41:38 +0200 Subject: [PATCH 117/322] open sauce t-deck edition --- variants/t-deck/platformio.ini | 47 +++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 756e11ce4e..08ccd9c59e 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -23,7 +23,52 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D CALIBRATE_TOUCH=0 -; -D KB_POWERON=10 + -D LGFX_DRIVER=LGFX_TDECK + -D VIEW_320x240 +; -D USE_DOUBLE_BUFFER + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 + -I variants/t-deck +build_src_filter = ${esp32_base.build_src_filter} + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> + +<../lib/device-ui/source> +lib_deps = + ${esp32_base.lib_deps} + lovyan03/LovyanGFX@^1.1.12 + earlephilhower/ESP8266Audio@^1.9.7 + earlephilhower/ESP8266SAM@^1.0.1 + +[env:open-sauce] +extends = esp32s3_base +board = t-deck +board_build.partitions = default_16MB.csv ; just for test +board_check = true +upload_protocol = esptool +build_unflags = + ${esp32s3_base.build_unflags} + -D ARDUINO_USB_MODE +build_flags = ${esp32_base.build_flags} + -D OPEN_SAUCE + -D T_DECK + -D ARDUINO_USB_MODE=0 + -D MAX_THREADS=40 + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D RAM_SIZE=1024 + -D GPS_POWER_TOGGLE + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 + -D DEBUG_MUTE +; -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_TDECK -D VIEW_320x240 ; -D USE_DOUBLE_BUFFER From 4bac9086dd7694a9274c4e9338761295a53cc84c Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 29 May 2024 20:51:01 +0200 Subject: [PATCH 118/322] fixes native keyboard+mouse handling --- lib/device-ui | 2 +- src/graphics/Screen.cpp | 4 ++-- src/modules/CannedMessageModule.cpp | 2 +- src/modules/CannedMessageModule.h | 2 +- src/modules/Modules.cpp | 4 ++-- variants/portduino/platformio.ini | 2 ++ variants/t-deck/platformio.ini | 1 + 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index 901020302a..1f07291e7e 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 901020302a8e6b174142488d117eb916e5212781 +Subproject commit 1f07291e7e06cd050e4a3e9e65d326399a77b038 diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 6417d702e4..a1ba657f80 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1575,7 +1575,7 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O #elif defined(USE_SSD1306) dispdev = new SSD1306Wire(address.address, -1, -1, geometry, (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); -#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014) || defined(HX8357_CS) && !HAS_TFT +#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014) || defined(HX8357_CS) dispdev = new TFTDisplay(address.address, -1, -1, geometry, (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); #elif defined(USE_EINK) && !defined(USE_EINK_DYNAMICDISPLAY) @@ -1587,7 +1587,7 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O #elif defined(USE_ST7567) dispdev = new ST7567Wire(address.address, -1, -1, geometry, (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); -#elif ARCH_PORTDUINO && !HAS_TFT +#elif ARCH_PORTDUINO if (settingsMap[displayPanel] != no_screen) { LOG_DEBUG("Making TFTDisplay!\n"); dispdev = new TFTDisplay(address.address, -1, -1, geometry, diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index c5dfa1f3c8..1755a485f6 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -2,7 +2,7 @@ #if ARCH_PORTDUINO #include "PortduinoGlue.h" #endif -#if HAS_SCREEN || HAS_TFT +#if HAS_SCREEN #include "CannedMessageModule.h" #include "Channels.h" #include "FSCommon.h" diff --git a/src/modules/CannedMessageModule.h b/src/modules/CannedMessageModule.h index ab21e513ec..6bb43bdf25 100644 --- a/src/modules/CannedMessageModule.h +++ b/src/modules/CannedMessageModule.h @@ -1,5 +1,5 @@ #pragma once -#if HAS_SCREEN || HAS_TFT +#if HAS_SCREEN #include "ProtobufModule.h" #include "input/InputBroker.h" diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index d0aa160571..ebecdc0bf1 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -126,7 +126,7 @@ void setupModules() kbMatrixImpl->init(); #endif // INPUTBROKER_MATRIX_TYPE #endif // HAS_BUTTON -#if ARCH_PORTDUINO +#if ARCH_PORTDUINO && !HAS_TFT aLinuxInputImpl = new LinuxInputImpl(); aLinuxInputImpl->init(); #endif @@ -134,7 +134,7 @@ void setupModules() trackballInterruptImpl1 = new TrackballInterruptImpl1(); trackballInterruptImpl1->init(); #endif -#if (HAS_SCREEN || HAS_TFT) && !MESHTASTIC_EXCLUDE_CANNEDMESSAGES +#if HAS_SCREEN && !MESHTASTIC_EXCLUDE_CANNEDMESSAGES cannedMessageModule = new CannedMessageModule(); #endif #if HAS_TELEMETRY diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 3919f6c4b7..4e2c323e7f 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -14,6 +14,7 @@ extends = portduino_base build_type = debug build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 -linput -lxkbcommon -D ARCH_PORTDUINO + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -I variants/portduino -I /usr/include -D DEBUG_HEAP @@ -55,6 +56,7 @@ extends = portduino_base build_type = release build_flags = ${portduino_base.build_flags} -Ofast -lX11 -linput -lxkbcommon -D ARCH_PORTDUINO + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -I variants/portduino -I /usr/include -D RAM_SIZE=16384 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 08ccd9c59e..a4c921d55c 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -7,6 +7,7 @@ board_check = true upload_protocol = esptool build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D T_DECK + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 From 606e51d058c22f143a141f0cb70eb21e02db67ef Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 31 May 2024 19:07:48 +0200 Subject: [PATCH 119/322] update lib: message acknowlegdgement --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 1f07291e7e..bc6f69cf50 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 1f07291e7e06cd050e4a3e9e65d326399a77b038 +Subproject commit bc6f69cf5062a1a20feebc9677174aa5b8b4a362 From e772ead77b66e55bf1433a90f76b135ca3eb3ec4 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 31 May 2024 19:14:57 +0200 Subject: [PATCH 120/322] fix unPhone-tft compilation --- variants/unphone/pins_arduino.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/variants/unphone/pins_arduino.h b/variants/unphone/pins_arduino.h index c4e9add1c3..74067359fc 100644 --- a/variants/unphone/pins_arduino.h +++ b/variants/unphone/pins_arduino.h @@ -6,14 +6,6 @@ #define USB_VID 0x16D0 #define USB_PID 0x1178 -#define EXTERNAL_NUM_INTERRUPTS 46 -#define NUM_DIGITAL_PINS 48 -#define NUM_ANALOG_INPUTS 20 - -#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1) -#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1) -#define digitalPinHasPWM(p) (p < 46) - #define LED_BUILTIN 13 #define BUILTIN_LED LED_BUILTIN // backward compatibility From 36ac07c2c7d74ebeb81641012fd491bf98c60a64 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 1 Jun 2024 14:39:31 +0200 Subject: [PATCH 121/322] reduce size of native target --- variants/portduino/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 4e2c323e7f..ec27f7a683 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -54,7 +54,7 @@ build_src_filter = ${portduino_base.build_src_filter} [env:native-tft-release] extends = portduino_base build_type = release -build_flags = ${portduino_base.build_flags} -Ofast -lX11 -linput -lxkbcommon +build_flags = ${portduino_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunction-sections -fdata-sections -Wl,--gc-sections -D ARCH_PORTDUINO -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -I variants/portduino From 83bd87e08255a53396ae3d22b37882389d3c98e7 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 1 Jun 2024 19:06:11 +0200 Subject: [PATCH 122/322] frequency slot setting --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index bc6f69cf50..3b21c5a823 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit bc6f69cf5062a1a20feebc9677174aa5b8b4a362 +Subproject commit 3b21c5a82382231dcab9235a65fe23f70d928978 From 617cb4b60d631d12cb5ed8b7edf8fd47e81990e0 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 2 Jun 2024 20:51:39 +0200 Subject: [PATCH 123/322] message alert settings --- lib/device-ui | 2 +- variants/t-deck/platformio.ini | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 3b21c5a823..70bacc469a 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 3b21c5a82382231dcab9235a65fe23f70d928978 +Subproject commit 70bacc469a4a6328c690b64e3a8b7bb80f83c992 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index a4c921d55c..e276d9a676 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -11,6 +11,7 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 + -D USE_I2S_BUZZER -D RAM_SIZE=512 -D GPS_POWER_TOGGLE -D LV_LVGL_H_INCLUDE_SIMPLE @@ -56,6 +57,7 @@ build_flags = ${esp32_base.build_flags} -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 + -D USE_I2S_BUZZER -D RAM_SIZE=1024 -D GPS_POWER_TOGGLE -D LV_LVGL_H_INCLUDE_SIMPLE From a4443b44ec3e02510fbf68c849640e1ca8f77233 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 3 Jun 2024 18:25:33 +0100 Subject: [PATCH 124/322] add TZT 2.0inch ST7789 config --- bin/config-dist.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index 1f6c91a42b..e1320198a8 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -121,6 +121,19 @@ Display: # Height: 480 # OffsetRotate: 2 +### TZT 2.0 Inch TFT Display ST7789V 240RGBx320 +# Panel: ST7789 +# spidev: spidev0.0 +# # CS: 8 # can be freely chosen +# BusFrequency: 80000000 +# DC: 24 # can be freely chosen +# Width: 320 +# Height: 240 +# Reset: 25 # can be freely chosen +# Rotate: true +# OffsetRotate: 1 +# Invert: true + Touchscreen: ### Note, at least for now, the touchscreen must have a CS pin defined, even if you let Linux manage the CS switching. From 599e1484869240643e5d87f098ae547bca2c283b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 3 Jun 2024 18:26:03 +0100 Subject: [PATCH 125/322] lib update: fix display issue --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 70bacc469a..7b2b0df7cf 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 70bacc469a4a6328c690b64e3a8b7bb80f83c992 +Subproject commit 7b2b0df7cf45a1e2cb366df25d564f0f67816efa From ed7f63153c50b5bc216490713e71ed108d1e326e Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 6 Jun 2024 09:39:33 +0200 Subject: [PATCH 126/322] update lib: channel settings --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 7b2b0df7cf..118d46d5af 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 7b2b0df7cf45a1e2cb366df25d564f0f67816efa +Subproject commit 118d46d5af0142f1c4d1d29218ec27660e88b945 From 509e385744bf27d632584abd00145a9fd2a11c7f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 6 Jun 2024 09:48:18 +0200 Subject: [PATCH 127/322] update lib: stability --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 118d46d5af..d0cacd79db 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 118d46d5af0142f1c4d1d29218ec27660e88b945 +Subproject commit d0cacd79dbeef65b9199a98c41332656f3f86682 From 2738af88c6ed584f3bb7b11604b02ba937127584 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 6 Jun 2024 15:49:20 +0200 Subject: [PATCH 128/322] update lib: fix channels, add alert --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index d0cacd79db..b9557d0ced 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit d0cacd79dbeef65b9199a98c41332656f3f86682 +Subproject commit b9557d0ced6e634c388489ff90b421c0cd24e0e7 From cb5fa5cd3b7a5639f4bc46509b14e7f4434150ad Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 6 Jun 2024 18:05:50 +0200 Subject: [PATCH 129/322] update lib: fix active chats --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index b9557d0ced..9cde40caab 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit b9557d0ced6e634c388489ff90b421c0cd24e0e7 +Subproject commit 9cde40caabd345c63a26e25bb69a752455256221 From a613e740a8d4770721745a4f31c595ab3f4ab025 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 7 Jun 2024 12:01:29 +0200 Subject: [PATCH 130/322] update lib: fix DEL chat button --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 9cde40caab..f27a2176b0 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 9cde40caabd345c63a26e25bb69a752455256221 +Subproject commit f27a2176b0be5cc6c00bd33a22e77b39891ef907 From 57d47a02542f196a20ff990623716ca3304cb65f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 7 Jun 2024 13:29:45 +0200 Subject: [PATCH 131/322] tweak t-deck defaults --- src/mesh/NodeDB.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index cf576e94fe..bdfef5e267 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -189,6 +189,12 @@ bool NodeDB::resetRadioConfig(bool factory_reset) rebootAtMsec = millis() + (5 * 1000); } +#ifdef T_DECK &&HAS_TFT + config.bluetooth.enabled = false; + if (moduleConfig.external_notification.nag_timeout == 60) + moduleConfig.external_notification.nag_timeout = 3; +#endif + return didFactoryReset; } From bc32dfb09237dbddd56e2cc58a23690b657dee5f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 7 Jun 2024 21:14:19 +0200 Subject: [PATCH 132/322] update lib: added latin-1 extended font --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index f27a2176b0..1a11350c1a 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit f27a2176b0be5cc6c00bd33a22e77b39891ef907 +Subproject commit 1a11350c1af0dab684ffaf5a3e88eaf76bc9d0aa From 320a052453f5d661b4c55eab17ed40b9c78451aa Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 8 Jun 2024 18:15:13 +0200 Subject: [PATCH 133/322] update lib: frequency slot defaults --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 1a11350c1a..f6016a4d7d 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 1a11350c1af0dab684ffaf5a3e88eaf76bc9d0aa +Subproject commit f6016a4d7d22ec15b3e93acf41746bc25d392186 From 007237d5db1795689e4e60fd81a65139b324cdc5 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 9 Jun 2024 10:59:18 +0200 Subject: [PATCH 134/322] update lib: fix channels --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index f6016a4d7d..80571fcd04 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit f6016a4d7d22ec15b3e93acf41746bc25d392186 +Subproject commit 80571fcd04f4375c11cc95139b5fd8ea9fb8669e From ad36ad9fe31888fb3a92834a263898cb9e7912fc Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 9 Jun 2024 18:02:35 +0200 Subject: [PATCH 135/322] update lib: channel deletion and fix --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 80571fcd04..e818f2771a 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 80571fcd04f4375c11cc95139b5fd8ea9fb8669e +Subproject commit e818f2771aa9fcd01a52339a3e2592e19a7f8ebe From 63e5ea5f17926c801fc24912d716eed75624a1d8 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 10 Jun 2024 10:29:58 +0200 Subject: [PATCH 136/322] fix unphone display and touch calibration --- variants/unphone/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index ce09f10e67..c0f477927f 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -61,7 +61,7 @@ build_flags = ${esp32_base.build_flags} -D LV_USE_LOG=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -; -D CALIBRATE_TOUCH=0 + -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_UNPHONE_V9 -D VIEW_320x240 ; -D USE_DOUBLE_BUFFER From 21a93a4bbc396667e6f5ee7904e2f43ba4f782ef Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 10 Jun 2024 13:09:24 +0200 Subject: [PATCH 137/322] update lib: unphone display fixes --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index e818f2771a..119a881f6c 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit e818f2771aa9fcd01a52339a3e2592e19a7f8ebe +Subproject commit 119a881f6cdf8c603a5af1e10599982ab017cd32 From f488193b6388e0a9196459a8b67761bcc8bffc47 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 11 Jun 2024 00:13:48 +0200 Subject: [PATCH 138/322] update lib: node details --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 119a881f6c..9df895c8a3 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 119a881f6cdf8c603a5af1e10599982ab017cd32 +Subproject commit 9df895c8a3b6b9743002d7610bc2329cc7b98964 From a5274658cfe3168a15c71c60a7fb8fb41c987e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 11 Jun 2024 14:39:00 +0200 Subject: [PATCH 139/322] warning: extra tokens at end of #ifdef directive --- src/mesh/NodeDB.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index bdfef5e267..ca680856cd 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -189,7 +189,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset) rebootAtMsec = millis() + (5 * 1000); } -#ifdef T_DECK &&HAS_TFT +#if defined(T_DECK) && defined(HAS_TFT) config.bluetooth.enabled = false; if (moduleConfig.external_notification.nag_timeout == 60) moduleConfig.external_notification.nag_timeout = 3; @@ -1026,4 +1026,4 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co LOG_ERROR("A critical failure occurred, portduino is exiting..."); exit(2); #endif -} \ No newline at end of file +} From e6f7314ca0c13336e5af580466a9bac1c98afb9b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 13 Jun 2024 19:37:46 +0200 Subject: [PATCH 140/322] update HWid unphone --- boards/unphone.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/boards/unphone.json b/boards/unphone.json index 1fc1fd21c1..bf711993c1 100644 --- a/boards/unphone.json +++ b/boards/unphone.json @@ -17,7 +17,10 @@ "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", - "hwids": [["0x16D0", "0x1178"]], + "hwids": [ + ["0x16D0", "0x1178"], + ["0x303a", "0x1001"] + ], "mcu": "esp32s3", "variant": "unphone" }, From 106f2285ddd4b71fce668ba732612f87ceee3926 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 14 Jun 2024 15:17:03 +0200 Subject: [PATCH 141/322] update lib: node options part 1 --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 9df895c8a3..384dccf640 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 9df895c8a3b6b9743002d7610bc2329cc7b98964 +Subproject commit 384dccf64012c9032a23bc978ffd941083b61d2a From cf1f0032e4d0d16f1b465829691f5657206656b8 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 16 Jun 2024 17:16:22 +0200 Subject: [PATCH 142/322] lib update: node options + localisation preparations --- lib/device-ui | 2 +- variants/portduino/platformio.ini | 2 ++ variants/t-deck/platformio.ini | 1 + variants/unphone/platformio.ini | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 384dccf640..134a45dd70 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 384dccf64012c9032a23bc978ffd941083b61d2a +Subproject commit 134a45dd70b74b8bce8b14e354873d0c7705e936 diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index ec27f7a683..fa4731ec86 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -48,6 +48,7 @@ build_src_filter = ${portduino_base.build_src_filter} +<../lib/device-ui/generated/ui_320x240/fonts> +<../lib/device-ui/resources> +<../lib/device-ui/portduino> + +<../lib/device-ui/locale> +<../lib/device-ui/source> @@ -89,4 +90,5 @@ build_src_filter = ${portduino_base.build_src_filter} +<../lib/device-ui/generated/ui_320x240/fonts> +<../lib/device-ui/resources> +<../lib/device-ui/portduino> + +<../lib/device-ui/locale> +<../lib/device-ui/source> \ No newline at end of file diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index e276d9a676..19c97ee969 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -34,6 +34,7 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer build_src_filter = ${esp32_base.build_src_filter} +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/resources> + +<../lib/device-ui/locale> +<../lib/device-ui/source> lib_deps = ${esp32_base.lib_deps} diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index c0f477927f..19d19dff46 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -72,6 +72,7 @@ build_flags = ${esp32_base.build_flags} build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone> +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/resources> + +<../lib/device-ui/locale> +<../lib/device-ui/source> lib_deps = ${esp32s3_base.lib_deps} From f6fa649af379e39bde5ca21d5cafc1ede32a2464 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 16 Jun 2024 20:47:14 +0200 Subject: [PATCH 143/322] update lib: textarea and keyboard fixes --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 134a45dd70..421bc5915f 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 134a45dd70b74b8bce8b14e354873d0c7705e936 +Subproject commit 421bc5915f44853fccf1b62c72b102e3d7b00ba1 From 2c2dfcf7df2745f1a1beefff329a1034d5377992 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 17 Jun 2024 21:42:40 +0200 Subject: [PATCH 144/322] reduce load of TFT task --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6037d16bb6..7c89569a7e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1088,7 +1088,7 @@ void setup() #if HAS_TFT #ifdef HAS_FREE_RTOS - xTaskCreatePinnedToCore(tft_task_handler, "tft", 8192, NULL, 9, NULL, 0); + xTaskCreatePinnedToCore(tft_task_handler, "tft", 8192, NULL, 5, NULL, 0); #endif #else setCPUFast(false); // 80MHz is fine for our slow peripherals @@ -1176,7 +1176,7 @@ void tft_task_handler(void *param = nullptr) if (deviceScreen) deviceScreen->task_handler(); #ifdef HAS_FREE_RTOS - vTaskDelay((TickType_t)5); + vTaskDelay((TickType_t)15); #else delay(5); #endif From 58102acce61134052dd36f74bc7df58c760c7b62 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 17 Jun 2024 21:44:22 +0200 Subject: [PATCH 145/322] exclude inputbroker fixes crash --- variants/t-deck/platformio.ini | 51 ++-------------------------------- 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 19c97ee969..1784d69d21 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -8,11 +8,13 @@ upload_protocol = esptool build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D T_DECK -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MAX_NUM_NODES=250 -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 -D USE_I2S_BUZZER - -D RAM_SIZE=512 + -D RAM_SIZE=1024 -D GPS_POWER_TOGGLE -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE @@ -41,50 +43,3 @@ lib_deps = lovyan03/LovyanGFX@^1.1.12 earlephilhower/ESP8266Audio@^1.9.7 earlephilhower/ESP8266SAM@^1.0.1 - -[env:open-sauce] -extends = esp32s3_base -board = t-deck -board_build.partitions = default_16MB.csv ; just for test -board_check = true -upload_protocol = esptool -build_unflags = - ${esp32s3_base.build_unflags} - -D ARDUINO_USB_MODE -build_flags = ${esp32_base.build_flags} - -D OPEN_SAUCE - -D T_DECK - -D ARDUINO_USB_MODE=0 - -D MAX_THREADS=40 - -D HAS_SCREEN=0 - -D HAS_TFT=1 - -D USE_I2S_BUZZER - -D RAM_SIZE=1024 - -D GPS_POWER_TOGGLE - -D LV_LVGL_H_INCLUDE_SIMPLE - -D LV_CONF_INCLUDE_SIMPLE - -D LV_COMP_CONF_INCLUDE_SIMPLE - -D LV_USE_SYSMON=0 - -D LV_USE_PROFILER=0 - -D LV_USE_PERF_MONITOR=0 - -D LV_USE_MEM_MONITOR=0 - -D LV_USE_LOG=0 - -D DEBUG_MUTE -; -D USE_LOG_DEBUG - -D LOG_DEBUG_INC=\"DebugConfiguration.h\" - -D CALIBRATE_TOUCH=0 - -D LGFX_DRIVER=LGFX_TDECK - -D VIEW_320x240 -; -D USE_DOUBLE_BUFFER - -D USE_PACKET_API - -I lib/device-ui/generated/ui_320x240 - -I variants/t-deck -build_src_filter = ${esp32_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> - +<../lib/device-ui/resources> - +<../lib/device-ui/source> -lib_deps = - ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.12 - earlephilhower/ESP8266Audio@^1.9.7 - earlephilhower/ESP8266SAM@^1.0.1 From bebee051707f177c9faf99220ad9f52816a313d2 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 18 Jun 2024 23:07:34 +0200 Subject: [PATCH 146/322] add ext notification module to portduino --- src/modules/Modules.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index 1f2e7a32c0..e1176ecb2c 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -60,7 +60,7 @@ #include "modules/esp32/StoreForwardModule.h" #endif #endif -#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040) +#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040) || defined(ARCH_PORTDUINO) #if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION #include "modules/ExternalNotificationModule.h" #endif @@ -177,7 +177,7 @@ void setupModules() paxcounterModule = new PaxcounterModule(); #endif #endif -#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040) +#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040) || defined(ARCH_PORTDUINO) #if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION externalNotificationModule = new ExternalNotificationModule(); #endif From d7d5cd0a456284022732d92119b78bfdc93bce95 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 18 Jun 2024 23:08:20 +0200 Subject: [PATCH 147/322] give little more time for other threads --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index ba6f6c321f..bb6774a8c6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1173,7 +1173,7 @@ void tft_task_handler(void *param = nullptr) if (deviceScreen) deviceScreen->task_handler(); #ifdef HAS_FREE_RTOS - vTaskDelay((TickType_t)15); + vTaskDelay((TickType_t)20); #else delay(5); #endif From d4776d2b847ac2688eb0d581fb329d071349c153 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 18 Jun 2024 23:08:53 +0200 Subject: [PATCH 148/322] lib update: ringtones --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 421bc5915f..e6cf8c6714 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 421bc5915f44853fccf1b62c72b102e3d7b00ba1 +Subproject commit e6cf8c67148557c6858c9833065fb5d5d7b2c2b2 From 01a1d864ecc95791a706cd7772bb33f92dc232a9 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 19 Jun 2024 01:42:02 +0200 Subject: [PATCH 149/322] update lib: time display --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index e6cf8c6714..b9bdde90a3 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit e6cf8c67148557c6858c9833065fb5d5d7b2c2b2 +Subproject commit b9bdde90a3c93f80e0b4680423512fe0627ffab3 From ffb18db48e8717d12ca8ad9874fa739247e04e41 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 19 Jun 2024 10:27:42 +0200 Subject: [PATCH 150/322] disable BT when TFT in use --- src/mesh/NodeDB.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index ca680856cd..37eb9f2c1b 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -189,10 +189,10 @@ bool NodeDB::resetRadioConfig(bool factory_reset) rebootAtMsec = millis() + (5 * 1000); } -#if defined(T_DECK) && defined(HAS_TFT) +#if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3)) && defined(HAS_TFT) config.bluetooth.enabled = false; if (moduleConfig.external_notification.nag_timeout == 60) - moduleConfig.external_notification.nag_timeout = 3; + moduleConfig.external_notification.nag_timeout = 0; #endif return didFactoryReset; From 5a6d01afddd431ba4440e6fa9c3d000798a35bf7 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 19 Jun 2024 10:29:25 +0200 Subject: [PATCH 151/322] add comment BT disable --- src/mesh/NodeDB.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 37eb9f2c1b..b36d3799af 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -190,6 +190,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset) } #if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3)) && defined(HAS_TFT) + // as long as PhoneAPI shares BT and TFT app switch BT off config.bluetooth.enabled = false; if (moduleConfig.external_notification.nag_timeout == 60) moduleConfig.external_notification.nag_timeout = 0; From c080b0f8dee129128fd74d7e4ab3d896dd054a85 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 19 Jun 2024 14:51:51 +0200 Subject: [PATCH 152/322] lib update: bunch of fixes --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index b9bdde90a3..d2f35439a8 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit b9bdde90a3c93f80e0b4680423512fe0627ffab3 +Subproject commit d2f35439a87165e20a8a7abb4fc7e8930c3ef94b From aec970be7292b2d8d863c01da30a583350cf6c78 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 19 Jun 2024 19:28:34 +0200 Subject: [PATCH 153/322] lib update: channel + buzzer fix --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index d2f35439a8..fd713de4bd 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit d2f35439a87165e20a8a7abb4fc7e8930c3ef94b +Subproject commit fd713de4bd214f4efebf737fec1ca66be4c06e43 From 179027ed80494510105fca136e6b461fa201434b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 20 Jun 2024 19:44:10 +0200 Subject: [PATCH 154/322] fix wifi/bt connection status --- src/modules/AdminModule.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 0915864623..123a451ae8 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -750,7 +750,7 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r #ifdef ARCH_PORTDUINO conn.wifi.status.is_connected = true; #else - conn.wifi.status.is_connected = WiFi.status() != WL_CONNECTED; + conn.wifi.status.is_connected = WiFi.status() == WL_CONNECTED; #endif strncpy(conn.wifi.ssid, config.network.wifi_ssid, 33); if (conn.wifi.status.is_connected) { @@ -782,10 +782,14 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r conn.has_bluetooth = true; conn.bluetooth.pin = config.bluetooth.fixed_pin; #ifdef ARCH_ESP32 - conn.bluetooth.is_connected = nimbleBluetooth->isConnected(); - conn.bluetooth.rssi = nimbleBluetooth->getRssi(); + if (config.bluetooth.enabled && nimbleBluetooth) { + conn.bluetooth.is_connected = nimbleBluetooth->isConnected(); + conn.bluetooth.rssi = nimbleBluetooth->getRssi(); + } #elif defined(ARCH_NRF52) - conn.bluetooth.is_connected = nrf52Bluetooth->isConnected(); + if (config.bluetooth.enabled && nrf52Bluetooth) { + conn.bluetooth.is_connected = nrf52Bluetooth->isConnected(); + } #endif #endif conn.has_serial = true; // No serial-less devices From 02922c4f4ef379808a825e947827f2cd8f724aee Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 20 Jun 2024 19:44:53 +0200 Subject: [PATCH 155/322] lib update: home screen --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index fd713de4bd..f77a76df31 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit fd713de4bd214f4efebf737fec1ca66be4c06e43 +Subproject commit f77a76df31856a05c87c90902256c6c087b25971 From 963c109d4d69968c1cb6f7bf5e7bfda1ea575dba Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 20 Jun 2024 23:07:46 +0200 Subject: [PATCH 156/322] lib update: initial PIComputer support --- lib/device-ui | 2 +- variants/picomputer-s3/platformio.ini | 43 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index f77a76df31..034909a492 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit f77a76df31856a05c87c90902256c6c087b25971 +Subproject commit 034909a492905c3db016128bb677f107d960c390 diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index 202cd05e70..8684049ebc 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -15,3 +15,46 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@^1.1.8 + + +[env:picomputer-s3-tft] +extends = esp32s3_base +board = bpi_picow_esp32_s3 +board_build.partitions = default_8MB.csv ; just for test +;board_check = true +upload_protocol = esptool +build_flags = ${esp32_base.build_flags} + -D PICOMPUTER_S3 + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MAX_NUM_NODES=250 + -D MAX_THREADS=40 + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D USE_I2S_BUZZER + -D RAM_SIZE=1024 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 + -D LV_USE_PERF_MONITOR=1 + -D LV_USE_MEM_MONITOR=1 + -D LV_USE_LOG=1 + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" +; -D CALIBRATE_TOUCH=0 + -D LGFX_DRIVER=LGFX_PICOMPUTER_S3 + -D VIEW_320x240 +; -D USE_DOUBLE_BUFFER + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 + -I variants/picomputer-s3 +build_src_filter = ${esp32_base.build_src_filter} + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> + +<../lib/device-ui/locale> + +<../lib/device-ui/source> +lib_deps = + ${esp32_base.lib_deps} + lovyan03/LovyanGFX@^1.1.12 From 1f1419293ae6f46a77816e9de0be607d91e295d7 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 21 Jun 2024 10:36:44 +0200 Subject: [PATCH 157/322] lib update: kbd matrix driver --- lib/device-ui | 2 +- variants/picomputer-s3/platformio.ini | 12 +++++------- variants/t-deck/platformio.ini | 3 ++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index 034909a492..dea6be0fdb 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 034909a492905c3db016128bb677f107d960c390 +Subproject commit dea6be0fdb8eb0ec344521d2b00d9896f693cf43 diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index 8684049ebc..b336a03c8c 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -27,23 +27,21 @@ build_flags = ${esp32_base.build_flags} -D PICOMPUTER_S3 -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 - -D MAX_NUM_NODES=250 - -D MAX_THREADS=40 + -D INPUTDRIVER_MATRIX_TYPE=1 + -D MAX_NUM_NODES=200 -D HAS_SCREEN=0 -D HAS_TFT=1 - -D USE_I2S_BUZZER -D RAM_SIZE=1024 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE -D LV_USE_SYSMON=0 -D LV_USE_PROFILER=0 - -D LV_USE_PERF_MONITOR=1 - -D LV_USE_MEM_MONITOR=1 - -D LV_USE_LOG=1 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -; -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_PICOMPUTER_S3 -D VIEW_320x240 ; -D USE_DOUBLE_BUFFER diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 1784d69d21..cb7ccb0210 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -9,6 +9,7 @@ build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer -D T_DECK -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D INPUTDRIVER_I2C_KBD_TYPE=0x55 -D MAX_NUM_NODES=250 -D MAX_THREADS=40 -D HAS_SCREEN=0 @@ -42,4 +43,4 @@ lib_deps = ${esp32_base.lib_deps} lovyan03/LovyanGFX@^1.1.12 earlephilhower/ESP8266Audio@^1.9.7 - earlephilhower/ESP8266SAM@^1.0.1 + earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file From 7489e709a792bc8bc99867b4965705df726f98ad Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 24 Jun 2024 14:54:14 +0200 Subject: [PATCH 158/322] gcc option can be removed --- variants/t-deck/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index cb7ccb0210..6f4d08fcaf 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -5,7 +5,7 @@ board = t-deck board_build.partitions = default_16MB.csv ; just for test board_check = true upload_protocol = esptool -build_flags = ${esp32_base.build_flags} -fno-omit-frame-pointer +build_flags = ${esp32_base.build_flags} -D T_DECK -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 From 5682081a591ae9a32d2343bc8e394c5caf8be600 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 24 Jun 2024 14:54:53 +0200 Subject: [PATCH 159/322] fix MESHTASTIC_EXCLUDE_GPS --- src/mesh/MeshService.cpp | 2 +- src/modules/AdminModule.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index c92b89eb47..e5f33e8e7f 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -269,7 +269,7 @@ bool MeshService::trySendPosition(NodeNum dest, bool wantReplies) assert(node); if (hasValidPosition(node)) { -#if HAS_GPS +#if HAS_GPS && !MESHTASTIC_EXCLUDE_GPS if (positionModule) { LOG_INFO("Sending position ping to 0x%x, wantReplies=%d, channel=%d\n", dest, wantReplies, node->channel); positionModule->sendOurPosition(dest, wantReplies, node->channel); diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 80e2193321..50a0242f14 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -232,9 +232,9 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta #if !MESHTASTIC_EXCLUDE_GPS if (gps != nullptr) gps->enable(); -#endif // Send our new fixed position to the mesh for good measure positionModule->sendOurPosition(); +#endif } break; } From 669d3b0b4c4acb8df9f7ae84a067ab81230b043b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 24 Jun 2024 14:56:26 +0200 Subject: [PATCH 160/322] add diy TFT build to T3S3 (for tests) --- variants/tlora_t3s3_v1/platformio.ini | 67 ++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/variants/tlora_t3s3_v1/platformio.ini b/variants/tlora_t3s3_v1/platformio.ini index 0a57972803..82de475992 100644 --- a/variants/tlora_t3s3_v1/platformio.ini +++ b/variants/tlora_t3s3_v1/platformio.ini @@ -6,4 +6,69 @@ upload_protocol = esptool build_flags = ${esp32_base.build_flags} -D TLORA_T3S3_V1 -I variants/tlora_t3s3_v1 - -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. \ No newline at end of file + -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. + + +[env:tlora-t3s3-tft] +extends = esp32s3_base +board = tlora-t3s3-v1 +;board_check = true +upload_protocol = esp-builtin + +build_flags = ${esp32_base.build_flags} + -D TLORA_T3S3_V1 + -D MESHTASTIC_EXCLUDE_SCREEN=1 + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_PAXCOUNTER=1 + -D MESHTASTIC_EXCLUDE_WEBSERVER=1 + -D MESHTASTIC_EXCLUDE_GPS=1 + -D MESHTASTIC_EXCLUDE_AUDIO=1 + -D MESHTASTIC_EXCLUDE_POWER_TELEMETRY=1 + -D MESHTASTIC_EXCLUDE_ATAK=1 + -D MESHTASTIC_EXCLUDE_REMOTEHARDWARE=1 + -D MAX_NUM_NODES=250 + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D RAM_SIZE=1024 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" +; -D CALIBRATE_TOUCH=0 + -D LGFX_DRIVER_TEMPLATE + -D LGFX_DRIVER=LGFX_GENERIC + -D LGFX_PANEL=ST7789 + -D LGFX_TOUCH=XPT2046 + -D LGFX_INVERT_COLOR=true + -D LGFX_PIN_SCK=12 + -D LGFX_PIN_MOSI=15 + -D LGFX_PIN_MISO=16 + -D LGFX_PIN_DC=47 + -D LGFX_PIN_CS=48 + -D LGFX_PIN_RST=34 + -D LGFX_PIN_BL=35 + -D LGFX_TOUCH_INT=38 + -D LGFX_TOUCH_CS=39 + -D LGFX_TOUCH_CLK=12 + -D LGFX_TOUCH_DO=15 + -D LGFX_TOUCH_DIN=16 + -D VIEW_320x240 +; -D USE_DOUBLE_BUFFER + -D USE_PACKET_API + -I variants/tlora_t3s3_v1 + -I lib/device-ui/generated/ui_320x240 +build_src_filter = ${esp32_base.build_src_filter} + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> + +<../lib/device-ui/locale> + +<../lib/device-ui/source> +lib_deps = + ${esp32_base.lib_deps} + lovyan03/LovyanGFX@^1.1.12 From 2f2ac71522b0ff85a8708ea015cfa8711f09b447 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 24 Jun 2024 14:56:43 +0200 Subject: [PATCH 161/322] lib update: generic driver --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index dea6be0fdb..0b5643f659 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit dea6be0fdb8eb0ec344521d2b00d9896f693cf43 +Subproject commit 0b5643f659e77f3ddbcd1f602f62d12448f817d9 From 520a8a8ca95cc3f421f778b942d7c286c9664e93 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 27 Jun 2024 15:41:09 +0200 Subject: [PATCH 162/322] trackball support --- variants/t-deck/platformio.ini | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 6f4d08fcaf..40322b434b 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -10,6 +10,12 @@ build_flags = ${esp32_base.build_flags} -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 -D INPUTDRIVER_I2C_KBD_TYPE=0x55 + -D INPUTDRIVER_ENCODER_TYPE=3 + -D INPUTDRIVER_ENCODER_LEFT=1 + -D INPUTDRIVER_ENCODER_RIGHT=2 + -D INPUTDRIVER_ENCODER_UP=3 + -D INPUTDRIVER_ENCODER_DOWN=15 + -D INPUTDRIVER_ENCODER_BTN=0 -D MAX_NUM_NODES=250 -D MAX_THREADS=40 -D HAS_SCREEN=0 From 50452848de667a15e09963a133282302a5a2563c Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 27 Jun 2024 15:42:00 +0200 Subject: [PATCH 163/322] enable buzzer alert for picomputer --- variants/picomputer-s3/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index b336a03c8c..5ee9ab8ac1 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -28,6 +28,7 @@ build_flags = ${esp32_base.build_flags} -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 -D INPUTDRIVER_MATRIX_TYPE=1 + -D USE_PIN_BUZZER=PIN_BUZZER -D MAX_NUM_NODES=200 -D HAS_SCREEN=0 -D HAS_TFT=1 From fc0e97d55be48c420273c081827834c1cf4d5467 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 27 Jun 2024 15:42:53 +0200 Subject: [PATCH 164/322] lib update: inputnavigation --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 0b5643f659..7b751567d7 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 0b5643f659e77f3ddbcd1f602f62d12448f817d9 +Subproject commit 7b751567d7669f02b58831fb25e0d50da77e86a0 From a57e4934a5c124b7346993bf1891d4c1b23feef9 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 28 Jun 2024 14:28:01 +0200 Subject: [PATCH 165/322] bump up lovyanGFX driver version --- variants/picomputer-s3/platformio.ini | 2 +- variants/t-deck/platformio.ini | 2 +- variants/tlora_t3s3_v1/platformio.ini | 2 +- variants/unphone/platformio.ini | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index 5ee9ab8ac1..8399b32136 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -56,4 +56,4 @@ build_src_filter = ${esp32_base.build_src_filter} +<../lib/device-ui/source> lib_deps = ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.12 + lovyan03/LovyanGFX@^1.1.16 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 40322b434b..782fdf9a89 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -47,6 +47,6 @@ build_src_filter = ${esp32_base.build_src_filter} +<../lib/device-ui/source> lib_deps = ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.12 + lovyan03/LovyanGFX@^1.1.16 earlephilhower/ESP8266Audio@^1.9.7 earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file diff --git a/variants/tlora_t3s3_v1/platformio.ini b/variants/tlora_t3s3_v1/platformio.ini index 82de475992..663efffc13 100644 --- a/variants/tlora_t3s3_v1/platformio.ini +++ b/variants/tlora_t3s3_v1/platformio.ini @@ -71,4 +71,4 @@ build_src_filter = ${esp32_base.build_src_filter} +<../lib/device-ui/source> lib_deps = ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.12 + lovyan03/LovyanGFX@^1.1.16 diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index 19d19dff46..80882e08aa 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -26,7 +26,7 @@ build_flags = ${esp32_base.build_flags} build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone> lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@ 1.1.12 + lovyan03/LovyanGFX@ 1.1.16 https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic@9.0.0 adafruit/Adafruit NeoPixel @ ^1.12.0 @@ -76,6 +76,6 @@ build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone> +<../lib/device-ui/source> lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.12 + lovyan03/LovyanGFX@^1.1.16 https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic@9.0.0 adafruit/Adafruit NeoPixel@1.12.0 \ No newline at end of file From d73975cbb4b677ea24913e8ce4a37f99140a7c77 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 28 Jun 2024 14:33:44 +0200 Subject: [PATCH 166/322] bump lovyanGFX version --- arch/portduino/portduino.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 67c21e9724..8154444196 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -24,8 +24,8 @@ lib_deps = ${env.lib_deps} ${networking_base.lib_deps} rweather/Crypto@^0.4.0 - https://github.com/lovyan03/LovyanGFX.git#5a39989aa2c9492572255b22f033843ec8900233 ; contains spi_host fix - + https://github.com/lovyan03/LovyanGFX.git#6f211f91e10244f143b7c92b0216853647c6f927 + build_flags = ${arduino_base.build_flags} -fPIC From 5cb8283fba263fa6cfc79ed6dd00b27270fbdcf9 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 30 Jun 2024 21:18:40 +0200 Subject: [PATCH 167/322] lib update: PICOmputer fixes --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 7b751567d7..b5a5a1b684 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 7b751567d7669f02b58831fb25e0d50da77e86a0 +Subproject commit b5a5a1b6849c7b770e701f0a245916f627f03bea From 2ded2bfd618f058d59223ba01dcd441addaeac7d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 3 Jul 2024 10:15:09 +0200 Subject: [PATCH 168/322] lib update: fix LONG_PRESSED for button/enter key --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index b5a5a1b684..3ddc248ee0 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit b5a5a1b6849c7b770e701f0a245916f627f03bea +Subproject commit 3ddc248ee0f27a588195a3f1a873d44f7aae5ab6 From 91a0ffb1fa5dd5fccab002997e3e716014bd4a9c Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 3 Jul 2024 11:16:14 +0200 Subject: [PATCH 169/322] added 1200baud reset --- boards/bpi_picow_esp32_s3.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/bpi_picow_esp32_s3.json b/boards/bpi_picow_esp32_s3.json index 9a20dd57f9..75983d8450 100644 --- a/boards/bpi_picow_esp32_s3.json +++ b/boards/bpi_picow_esp32_s3.json @@ -28,6 +28,8 @@ "flash_size": "8MB", "maximum_ram_size": 327680, "maximum_size": 8388608, + "use_1200bps_touch": true, + "wait_for_upload_port": true, "require_upload_port": true, "speed": 921600 }, From 3498890c132ff7d09402854c1dd78cc597818446 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 3 Jul 2024 11:17:17 +0200 Subject: [PATCH 170/322] USB mode=1 messed up the debug log --- boards/t-deck.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/t-deck.json b/boards/t-deck.json index 33a34b60dc..b112921b9b 100644 --- a/boards/t-deck.json +++ b/boards/t-deck.json @@ -8,7 +8,7 @@ "extra_flags": [ "-DBOARD_HAS_PSRAM", "-DARDUINO_USB_CDC_ON_BOOT=1", - "-DARDUINO_USB_MODE=1", + "-DARDUINO_USB_MODE=0", "-DARDUINO_RUNNING_CORE=1", "-DARDUINO_EVENT_RUNNING_CORE=1" ], From b4eb8d1f014376d8062d61019e7c5c19b46ef1a3 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 3 Jul 2024 11:18:01 +0200 Subject: [PATCH 171/322] lib update: swap controls for PICOmputer --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 3ddc248ee0..5aa10bd54a 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 3ddc248ee0f27a588195a3f1a873d44f7aae5ab6 +Subproject commit 5aa10bd54abd7fe0a63570e4672c3c8d7d39a49b From 41628736a685736a0f30be29888f5154f846b442 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 4 Jul 2024 12:45:50 +0200 Subject: [PATCH 172/322] lib update: trackball behavior fix --- lib/device-ui | 2 +- src/sleep.cpp | 3 +++ variants/t-deck/variant.h | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index 5aa10bd54a..ca5a3e359f 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 5aa10bd54abd7fe0a63570e4672c3c8d7d39a49b +Subproject commit ca5a3e359f572f326f9a8cfdcd2da2aa9de4e3f3 diff --git a/src/sleep.cpp b/src/sleep.cpp index c9c45bf67e..037912787e 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -369,6 +369,9 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r gpio_wakeup_enable(pin, GPIO_INTR_LOW_LEVEL); esp_sleep_enable_gpio_wakeup(); #endif +#ifdef INPUTDRIVER_ENCODER_BTN + gpio_wakeup_enable((gpio_num_t)INPUTDRIVER_ENCODER_BTN, GPIO_INTR_LOW_LEVEL); +#endif #ifdef T_WATCH_S3 gpio_wakeup_enable((gpio_num_t)SCREEN_TOUCH_INT, GPIO_INTR_LOW_LEVEL); #endif diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index ddd1fb402d..c3c4d05272 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -27,8 +27,10 @@ #define SLEEP_TIME 120 +#ifndef HAS_TFT #define BUTTON_PIN 0 // #define BUTTON_NEED_PULLUP +#endif #define GPS_RX_PIN 44 #define GPS_TX_PIN 43 @@ -60,7 +62,7 @@ #define TB_DOWN 15 #define TB_LEFT 1 #define TB_RIGHT 2 -#define TB_PRESS BUTTON_PIN +#define TB_PRESS 0 // BUTTON_PIN // microphone #define ES7210_SCK 47 From 87b9e15b5629e306b16063ba1b4a93900cc6d007 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 5 Jul 2024 00:24:47 +0200 Subject: [PATCH 173/322] lib update: settings panel disabled --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index ca5a3e359f..3d0a8afb9c 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit ca5a3e359f572f326f9a8cfdcd2da2aa9de4e3f3 +Subproject commit 3d0a8afb9c4da90a3bde3a99a8cfc7ee00f693be From cce11b79552fa188b04ecf3c5ed5ba8e950fe675 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 5 Jul 2024 12:28:21 +0200 Subject: [PATCH 174/322] prevent reducing CPU speed when using TFT --- src/sleep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sleep.cpp b/src/sleep.cpp index f344b50e61..b9454e536f 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -57,7 +57,7 @@ RTC_DATA_ATTR int bootCount = 0; */ void setCPUFast(bool on) { -#if defined(ARCH_ESP32) && HAS_WIFI +#if defined(ARCH_ESP32) && HAS_WIFI && !HAS_TFT if (isWifiAvailable()) { /* From 674c7a8e2f5dcdb2dc1279dde7caaf7ccd566a42 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 5 Jul 2024 12:29:26 +0200 Subject: [PATCH 175/322] exclude webserver / bluetooth --- variants/picomputer-s3/platformio.ini | 1 + variants/t-deck/platformio.ini | 2 ++ variants/unphone/platformio.ini | 7 ++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index 8399b32136..bf070b00a7 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -27,6 +27,7 @@ build_flags = ${esp32_base.build_flags} -D PICOMPUTER_S3 -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 -D INPUTDRIVER_MATRIX_TYPE=1 -D USE_PIN_BUZZER=PIN_BUZZER -D MAX_NUM_NODES=200 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 782fdf9a89..564013a7c8 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -9,6 +9,8 @@ build_flags = ${esp32_base.build_flags} -D T_DECK -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 + -D MESHTASTIC_EXCLUDE_WEBSERVER=1 -D INPUTDRIVER_I2C_KBD_TYPE=0x55 -D INPUTDRIVER_ENCODER_TYPE=3 -D INPUTDRIVER_ENCODER_LEFT=1 diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index 80882e08aa..6699dce2bb 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -46,10 +46,15 @@ build_flags = ${esp32_base.build_flags} -D UNPHONE_UI0=0 -D UNPHONE_LORA=0 -D UNPHONE_FACTORY_MODE=0 + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 + -D MESHTASTIC_EXCLUDE_WEBSERVER=1 + -D MAX_NUM_NODES=200 -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 - -D RAM_SIZE=512 + -D RAM_SIZE=1024 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE From 7c8dca3fcc8c13522068495a77000c2edd2dbf75 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 5 Jul 2024 12:29:59 +0200 Subject: [PATCH 176/322] fix bluetooth exclusion --- src/RedirectablePrint.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/RedirectablePrint.cpp b/src/RedirectablePrint.cpp index 1851ffbaad..01e5a34a70 100644 --- a/src/RedirectablePrint.cpp +++ b/src/RedirectablePrint.cpp @@ -173,6 +173,7 @@ void RedirectablePrint::log_to_syslog(const char *logLevel, const char *format, void RedirectablePrint::log_to_ble(const char *logLevel, const char *format, va_list arg) { +#if !MESHTASTIC_EXCLUDE_BLUETOOTH if (config.bluetooth.device_logging_enabled && !pauseBluetoothLogging) { bool isBleConnected = false; #ifdef ARCH_ESP32 @@ -211,6 +212,11 @@ void RedirectablePrint::log_to_ble(const char *logLevel, const char *format, va_ delete[] buffer; } } +#else + (void)logLevel; + (void)format; + (void)arg; +#endif } meshtastic_LogRecord_Level RedirectablePrint::getLogLevel(const char *logLevel) From f9babec29443f1d83104c019e6e62924aaef4da3 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 5 Jul 2024 12:31:49 +0200 Subject: [PATCH 177/322] lib update --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 3d0a8afb9c..0b320ae94a 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 3d0a8afb9c4da90a3bde3a99a8cfc7ee00f693be +Subproject commit 0b320ae94af699d744c0614bc8bf96d9e77cf10b From 1018522d33eaf74da96ad09725a2b7545df689c6 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 12 Jul 2024 18:05:42 +0200 Subject: [PATCH 178/322] lib update: group input order --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 0b320ae94a..94d15e3020 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 0b320ae94af699d744c0614bc8bf96d9e77cf10b +Subproject commit 94d15e3020542fb5c27e8324b9c2ac96d1e06b26 From 2d45b333e5be2297bcd33c199f6c27e5f288ae53 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 15 Jul 2024 10:42:26 +0200 Subject: [PATCH 179/322] try-fix spi lock --- src/main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 32bc2c61dd..954eaa57b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1186,10 +1186,13 @@ void loop() void tft_task_handler(void *param = nullptr) { while (true) { - if (deviceScreen) + if (deviceScreen) { + spiLock->lock(); deviceScreen->task_handler(); + spiLock->unlock(); + } #ifdef HAS_FREE_RTOS - vTaskDelay((TickType_t)20); + vTaskDelay((TickType_t)10); #else delay(5); #endif From 2022d69f6ab3ae2c1997e2be461db47c52be1146 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 15 Jul 2024 10:44:07 +0200 Subject: [PATCH 180/322] lib update: try-fix bat icon --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 94d15e3020..dbee3fc120 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 94d15e3020542fb5c27e8324b9c2ac96d1e06b26 +Subproject commit dbee3fc120eff3f41c0c156d0b4703bb93717f6b From 3d581b634026a5f3d25ce84a9f6d240a21ee82c4 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 15 Jul 2024 23:39:01 +0200 Subject: [PATCH 181/322] lib update: fix group ordering and null-pointer issue --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index dbee3fc120..b4c8a25210 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit dbee3fc120eff3f41c0c156d0b4703bb93717f6b +Subproject commit b4c8a25210a0c50fdcce46a46490966d4ae9ab6d From 3b2ac05a9af78c2c0c98fbcce8eed04c24559b58 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 19 Jul 2024 22:09:07 +0200 Subject: [PATCH 182/322] lib update: battery & premature tool --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index b4c8a25210..f7ed2e8d02 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit b4c8a25210a0c50fdcce46a46490966d4ae9ab6d +Subproject commit f7ed2e8d02faf6ea7204e27def9f47f65cb84ab3 From 75229e69dab089d331a55b67e978505d29737b7f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 20 Jul 2024 00:51:33 +0200 Subject: [PATCH 183/322] lib update: fix channel setting --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index f7ed2e8d02..f8df50ab09 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit f7ed2e8d02faf6ea7204e27def9f47f65cb84ab3 +Subproject commit f8df50ab094b5bfccafbc4f39a153a3d89571ab6 From 0dccb9a18c18774069b9a2c9367f6118825d9ec4 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 22 Jul 2024 22:07:12 +0200 Subject: [PATCH 184/322] adaptions for signal scanner --- variants/picomputer-s3/platformio.ini | 1 + variants/unphone/platformio.ini | 1 + 2 files changed, 2 insertions(+) diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index bf070b00a7..e20f9a0b33 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -30,6 +30,7 @@ build_flags = ${esp32_base.build_flags} -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 -D INPUTDRIVER_MATRIX_TYPE=1 -D USE_PIN_BUZZER=PIN_BUZZER + -D USE_SX127x -D MAX_NUM_NODES=200 -D HAS_SCREEN=0 -D HAS_TFT=1 diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index 6699dce2bb..8f2168f27c 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -50,6 +50,7 @@ build_flags = ${esp32_base.build_flags} -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 -D MESHTASTIC_EXCLUDE_WEBSERVER=1 + -D USE_SX127x -D MAX_NUM_NODES=200 -D MAX_THREADS=40 -D HAS_SCREEN=0 From d4a7a90688a83ec5acea0372ab13ecd16292655b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 22 Jul 2024 22:07:35 +0200 Subject: [PATCH 185/322] lib update: signal scanner --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index f8df50ab09..3fb5fecbd7 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit f8df50ab094b5bfccafbc4f39a153a3d89571ab6 +Subproject commit 3fb5fecbd70800736717527d3749cb5320d7cb76 From daad8320915667ec00f4b1bedd6224c323b83188 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 22 Jul 2024 22:38:36 +0200 Subject: [PATCH 186/322] lib update: fix battery display --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 3fb5fecbd7..704dde38d0 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 3fb5fecbd70800736717527d3749cb5320d7cb76 +Subproject commit 704dde38d030906acd51ad1aac5826ec0f1a183f From 1631e2805cf5c8de92a5e531597dcb2c87aaf752 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 23 Jul 2024 00:29:51 +0200 Subject: [PATCH 187/322] lib update: trace route spinner behavior --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 704dde38d0..b88f5e5e8b 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 704dde38d030906acd51ad1aac5826ec0f1a183f +Subproject commit b88f5e5e8bc6e790f98ada6768a7e958bb5bb084 From 5e63f313545753d0d0b45aa27930c519803e2709 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 25 Jul 2024 16:59:31 +0200 Subject: [PATCH 188/322] try-fix: stability --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 706b4a6fad..81c842b993 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -684,7 +684,7 @@ void setup() // ESP32 SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); LOG_DEBUG("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)\n", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); - SPI.setFrequency(4000000); + SPI.setFrequency(1000000); #endif #if HAS_TFT From b7475a45c0aec4ed144236319f82a5e90c5299f8 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 2 Aug 2024 17:30:21 +0200 Subject: [PATCH 189/322] update t3s3-tft --- variants/tlora_t3s3_v1/platformio.ini | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/variants/tlora_t3s3_v1/platformio.ini b/variants/tlora_t3s3_v1/platformio.ini index 663efffc13..c062dbd7b0 100644 --- a/variants/tlora_t3s3_v1/platformio.ini +++ b/variants/tlora_t3s3_v1/platformio.ini @@ -45,8 +45,8 @@ build_flags = ${esp32_base.build_flags} -D LGFX_DRIVER_TEMPLATE -D LGFX_DRIVER=LGFX_GENERIC -D LGFX_PANEL=ST7789 + -D LGFX_OFFSET_ROTATION=1 -D LGFX_TOUCH=XPT2046 - -D LGFX_INVERT_COLOR=true -D LGFX_PIN_SCK=12 -D LGFX_PIN_MOSI=15 -D LGFX_PIN_MISO=16 @@ -59,6 +59,10 @@ build_flags = ${esp32_base.build_flags} -D LGFX_TOUCH_CLK=12 -D LGFX_TOUCH_DO=15 -D LGFX_TOUCH_DIN=16 + -D LGFX_TOUCH_X_MIN=300 + -D LGFX_TOUCH_X_MAX=3900 + -D LGFX_TOUCH_Y_MIN=400 + -D LGFX_TOUCH_Y_MAX=3900 -D VIEW_320x240 ; -D USE_DOUBLE_BUFFER -D USE_PACKET_API From 5ef58e925d56b438003c6e04862061688070a3f7 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 3 Aug 2024 09:57:13 +0200 Subject: [PATCH 190/322] sensecap indicator support --- boards/seeed-sensecap-indicator.json | 42 +++++++++++ lib/device-ui | 2 +- src/platform/esp32/architecture.h | 2 + .../seeed-sensecap-indicator/pins_arduino.h | 56 +++++++++++++++ .../seeed-sensecap-indicator/platformio.ini | 72 +++++++++++++++++++ variants/seeed-sensecap-indicator/variant.h | 67 +++++++++++++++++ 6 files changed, 240 insertions(+), 1 deletion(-) create mode 100644 boards/seeed-sensecap-indicator.json create mode 100644 variants/seeed-sensecap-indicator/pins_arduino.h create mode 100644 variants/seeed-sensecap-indicator/platformio.ini create mode 100644 variants/seeed-sensecap-indicator/variant.h diff --git a/boards/seeed-sensecap-indicator.json b/boards/seeed-sensecap-indicator.json new file mode 100644 index 0000000000..3fc57126f9 --- /dev/null +++ b/boards/seeed-sensecap-indicator.json @@ -0,0 +1,42 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "partitions": "default_8MB.csv", + "memory_type": "qio_opi" + }, + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM", + "-DARDUINO_USB_CDC_ON_BOOT=0", + "-DARDUINO_USB_MODE=1", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [["0x1A86", "0x7523"]], + "mcu": "esp32s3", + "variant": "esp32s3r8" + }, + "connectivity": ["wifi", "bluetooth", "lora"], + "debug": { + "default_tool": "esp-builtin", + "onboard_tools": ["esp-builtin"], + "openocd_target": "esp32s3.cfg" + }, + "frameworks": ["arduino"], + "name": "Seeed Studio SenseCAP Indicator", + "upload": { + "flash_size": "8MB", + "maximum_ram_size": 327680, + "maximum_size": 8388608, + "require_upload_port": true, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "speed": 921600 + }, + "url": "https://www.seeedstudio.com/Indicator-for-Meshtastic.html", + "vendor": "Seeed Studio" +} diff --git a/lib/device-ui b/lib/device-ui index b88f5e5e8b..d2fd55fc61 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit b88f5e5e8bc6e790f98ada6768a7e958bb5bb084 +Subproject commit d2fd55fc6158895334a0b9e48f7c62dfd139153d diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index fd3f92a9c3..ee42610605 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -159,6 +159,8 @@ #define HW_VENDOR meshtastic_HardwareModel_HELTEC_VISION_MASTER_E290 #elif defined(HELTEC_MESH_NODE_T114) #define HW_VENDOR meshtastic_HardwareModel_HELTEC_MESH_NODE_T114 +#elif defined(SENSECAP_INDICATOR) +#define HW_VENDOR meshtastic_HardwareModel_SENSECAP_INDICATOR #endif // ----------------------------------------------------------------------------- diff --git a/variants/seeed-sensecap-indicator/pins_arduino.h b/variants/seeed-sensecap-indicator/pins_arduino.h new file mode 100644 index 0000000000..300f0e0f5d --- /dev/null +++ b/variants/seeed-sensecap-indicator/pins_arduino.h @@ -0,0 +1,56 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +// static const uint8_t LED_BUILTIN = -1; + +// static const uint8_t TX = 43; +// static const uint8_t RX = 44; + +static const uint8_t SDA = 39; +static const uint8_t SCL = 40; + +// Default SPI will be mapped to Radio +static const uint8_t SS = -1; +static const uint8_t MOSI = 48; +static const uint8_t MISO = 47; +static const uint8_t SCK = 41; + +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 3; +static const uint8_t A3 = 4; +static const uint8_t A4 = 5; +static const uint8_t A5 = 6; +static const uint8_t A6 = 7; +static const uint8_t A7 = 8; +static const uint8_t A8 = 9; +static const uint8_t A9 = 10; +static const uint8_t A10 = 11; +static const uint8_t A11 = 12; +static const uint8_t A12 = 13; +static const uint8_t A13 = 14; +static const uint8_t A14 = 15; +static const uint8_t A15 = 16; +static const uint8_t A16 = 17; +static const uint8_t A17 = 18; +static const uint8_t A18 = 19; +static const uint8_t A19 = 20; + +static const uint8_t T1 = 1; +static const uint8_t T2 = 2; +static const uint8_t T3 = 3; +static const uint8_t T4 = 4; +static const uint8_t T5 = 5; +static const uint8_t T6 = 6; +static const uint8_t T7 = 7; +static const uint8_t T8 = 8; +static const uint8_t T9 = 9; +static const uint8_t T10 = 10; +static const uint8_t T11 = 11; +static const uint8_t T12 = 12; +static const uint8_t T13 = 13; +static const uint8_t T14 = 14; + +#endif /* Pins_Arduino_h */ \ No newline at end of file diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini new file mode 100644 index 0000000000..5b8d0ad456 --- /dev/null +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -0,0 +1,72 @@ +; Seeed Studio SenseCAP Indicator +[env:seeed-sensecap-indicator] +extends = esp32s3_base +platform_packages = +; platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32-fork + platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 + +board = seeed-sensecap-indicator +board_check = true +upload_protocol = esptool +build_type = debug + +build_flags = ${esp32_base.build_flags} -Og + -Ivariants/seeed-sensecap-indicator + -DSENSECAP_INDICATOR + -DIO_EXPANDER=0x40 + +lib_deps = ${esp32s3_base.lib_deps} + lovyan03/LovyanGFX@^1.1.16 + earlephilhower/ESP8266Audio@^1.9.7 + earlephilhower/ESP8266SAM@^1.0.1 + + +[env:seeed-sensecap-indicator-tft] +extends = esp32s3_base +platform_packages = +; platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32-fork + platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 +board = seeed-sensecap-indicator +;board_build.partitions = default_16MB.csv +board_check = true +upload_protocol = esptool +build_type = debug +build_flags = ${esp32_base.build_flags} + -D SENSECAP_INDICATOR + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 + -D MESHTASTIC_EXCLUDE_SCREEN=1 + -D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 + -D IO_EXPANDER=0x40 + -D MAX_NUM_NODES=250 + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D USE_I2S_BUZZER + -D RAM_SIZE=1024 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" +; -D CALIBRATE_TOUCH=0 + -D LGFX_DRIVER=LGFX_INDICATOR + -D VIEW_320x240 +; -D USE_DOUBLE_BUFFER + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 + -I variants/seeed-sensecap-indicator +build_src_filter = ${esp32_base.build_src_filter} + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> + +<../lib/device-ui/locale> + +<../lib/device-ui/source> +lib_deps = ${esp32s3_base.lib_deps} + lovyan03/LovyanGFX@^1.1.16 + earlephilhower/ESP8266Audio@^1.9.7 + earlephilhower/ESP8266SAM@^1.0.1 diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h new file mode 100644 index 0000000000..6662f940e7 --- /dev/null +++ b/variants/seeed-sensecap-indicator/variant.h @@ -0,0 +1,67 @@ +#define I2C_SDA 39 +#define I2C_SCL 40 + +#define BUTTON_PIN 38 +// #define BUTTON_NEED_PULLUP + +// #define BATTERY_PIN 27 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage +// #define ADC_CHANNEL ADC1_GPIO27_CHANNEL +// #define ADC_MULTIPLIER 2 + +// ST7701 TFT LCD +#define ST7701_CS (4 | IO_EXPANDER) +#define ST7701_RS -1 // DC +#define ST7701_SDA 48 // MOSI +#define ST7701_SCK 41 +#define ST7701_RESET (5 | IO_EXPANDER) +#define ST7701_MISO 47 +#define ST7701_BUSY -1 +#define ST7701_BL 45 +#define ST7701_SPI_HOST SPI2_HOST +#define ST7701_BACKLIGHT_EN 45 +#define SPI_FREQUENCY 20000000 +#define SPI_READ_FREQUENCY 16000000 +#define TFT_HEIGHT 480 +#define TFT_WIDTH 480 +#define TFT_OFFSET_X 0 +#define TFT_OFFSET_Y 0 +#define TFT_OFFSET_ROTATION 1 +#define TFT_BL 45 +#define SCREEN_ROTATE +#define SCREEN_TRANSITION_FRAMERATE 5 // fps + +#define HAS_TOUCHSCREEN 3 +#define SCREEN_TOUCH_INT (6 | IO_EXPANDER) +#define SCREEN_TOUCH_RST (7 | IO_EXPANDER) +#define TOUCH_I2C_PORT 1 +#define TOUCH_SLAVE_ADDRESS 0x48 + +// Buzzer +#define PIN_BUZZER 19 + +#define HAS_GPS 0 +#undef GPS_RX_PIN +#undef GPS_TX_PIN + +// disabled until IO_EXPANDER interrupts supported +#define HAS_RADIO 0 +// #define USE_SX1262 +// #define USE_SX1268 + +#define LORA_SCK 41 +#define LORA_MISO 47 +#define LORA_MOSI 48 +#define LORA_CS (0 | IO_EXPANDER) + +#define LORA_DIO0 -1 // a no connect on the SX1262 module +#define LORA_RESET (1 | IO_EXPANDER) +#define LORA_DIO1 (3 | IO_EXPANDER) // SX1262 IRQ +#define LORA_DIO2 (2 | IO_EXPANDER) // SX1262 BUSY +#define LORA_DIO3 + +#define SX126X_CS LORA_CS +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_DIO2 +#define SX126X_RESET LORA_RESET +#define SX126X_DIO2_AS_RF_SWITCH +// #define SX126X_DIO3_TCXO_VOLTAGE 1.8 From 31510b038d41732e6e647d7643efec538cae8718 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 3 Aug 2024 11:00:41 +0200 Subject: [PATCH 191/322] fix due to #4369 --- src/mesh/api/PacketAPI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp index f8393fda04..1e6f6c2ddb 100644 --- a/src/mesh/api/PacketAPI.cpp +++ b/src/mesh/api/PacketAPI.cpp @@ -44,7 +44,7 @@ bool PacketAPI::receivePacket(void) case meshtastic_ToRadio_packet_tag: { meshtastic_MeshPacket *mp = &mr->packet; printPacket("PACKET FROM QUEUE", mp); - service.handleToRadio(*mp); + service->handleToRadio(*mp); break; } case meshtastic_ToRadio_want_config_id_tag: { From b79cac538202786c93a7e9bdd24a27ef98683f2b Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 9 Aug 2024 20:41:54 -0500 Subject: [PATCH 192/322] Update ref to fix admin message --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index d2fd55fc61..5ad87f137b 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit d2fd55fc6158895334a0b9e48f7c62dfd139153d +Subproject commit 5ad87f137be151fcc41128ae2b114dd791e9089f From 474611275256f838614fbab646c69857af6698fd Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 21 Aug 2024 02:10:46 +0200 Subject: [PATCH 193/322] lib update: light theme --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 5ad87f137b..b4e783460a 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 5ad87f137be151fcc41128ae2b114dd791e9089f +Subproject commit b4e783460aa3155b918b7ade6d555f9cb1ec81bb From 1d1995b7985a34fb55c0ca852492c61c1c0a1c62 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 21 Aug 2024 02:19:08 +0200 Subject: [PATCH 194/322] fix merge issue --- src/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index ab2098fb86..a41eaa5048 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -123,6 +123,7 @@ AudioThread *audioThread = nullptr; void tft_task_handler(void *); DeviceScreen *deviceScreen = nullptr; +#endif #if defined(TCXO_OPTIONAL) float tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE; // if TCXO is optional, put this here so it can be changed further down. @@ -1215,6 +1216,7 @@ extern meshtastic_DeviceMetadata getDeviceMetadata() deviceMetadata.hasRemoteHardware = moduleConfig.remote_hardware.enabled; return deviceMetadata; } + #ifndef PIO_UNIT_TESTING void loop() { @@ -1261,6 +1263,7 @@ void loop() } // if (didWake) LOG_DEBUG("wake!\n"); } +#endif #if HAS_TFT void tft_task_handler(void *param = nullptr) From 776268effab2c6ed12425cfa5b4fdcc5cac77111 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 21 Aug 2024 13:23:23 +0200 Subject: [PATCH 195/322] lib update: home buttons + button try-fix --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index b4e783460a..a35803fec1 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit b4e783460aa3155b918b7ade6d555f9cb1ec81bb +Subproject commit a35803fec1db665cb26465fd30126ecf66ea6288 From ca82d917d6bd907d8fc3c6788c04ce05bb5b013f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 21 Aug 2024 13:51:46 +0200 Subject: [PATCH 196/322] lib update: icon color fix --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index a35803fec1..76426e6822 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit a35803fec1db665cb26465fd30126ecf66ea6288 +Subproject commit 76426e6822f8dc1a946440211d34b5346a1d64c1 From 898a5d078990af8349fa04ac563ab6254e6bfbd9 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 21 Aug 2024 18:49:16 +0200 Subject: [PATCH 197/322] lib update: fix instability/crash on notification --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 76426e6822..8b44cc0b1a 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 76426e6822f8dc1a946440211d34b5346a1d64c1 +Subproject commit 8b44cc0b1ae4b24d31c99321225a57e15bc971d2 From 3c1ad03e7950aba49e6d1a684d3b0738ed22d464 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 21 Aug 2024 21:16:18 +0200 Subject: [PATCH 198/322] update lib: timezone --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 8b44cc0b1a..a4f09f9718 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 8b44cc0b1ae4b24d31c99321225a57e15bc971d2 +Subproject commit a4f09f9718ef5f1e64021bdad4544b33011fa463 From dfc6caed05e76cf235d80a094d028ad1fa6c54ea Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 21 Aug 2024 21:54:08 +0200 Subject: [PATCH 199/322] timezone label --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index a4f09f9718..6b2f3f38a6 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit a4f09f9718ef5f1e64021bdad4544b33011fa463 +Subproject commit 6b2f3f38a6b54049a1192f1a867a008c2b46f1f0 From a98adab6df275427da5195c9f076d86346fadc32 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 23 Aug 2024 10:59:00 +0200 Subject: [PATCH 200/322] lib update: fix set owner --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 6b2f3f38a6..23171afbfa 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 6b2f3f38a6b54049a1192f1a867a008c2b46f1f0 +Subproject commit 23171afbfa0c55902425643622981abd886dd313 From c8f059918bb1dc4faba9845f4ec020be1f4941c5 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 25 Aug 2024 12:37:50 +0200 Subject: [PATCH 201/322] fix spiLock in RadioLibInterface --- src/mesh/RadioLibInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index f299ebff2c..f4874d4c32 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -19,9 +19,9 @@ void LockingArduinoHal::spiBeginTransaction() void LockingArduinoHal::spiEndTransaction() { - spiLock->unlock(); - ArduinoHal::spiEndTransaction(); + + spiLock->unlock(); } #if ARCH_PORTDUINO void LockingArduinoHal::spiTransfer(uint8_t *out, size_t len, uint8_t *in) From 5334e7be25ffa6725b3e2b09b40d43b7c975167a Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 26 Aug 2024 07:15:31 +0200 Subject: [PATCH 202/322] add picomputer tft build --- variants/picomputer-s3/platformio.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index e20f9a0b33..f9e1f56521 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -1,4 +1,4 @@ -[env:picomputer-s3] +[env:picomputer-s3-old] extends = esp32s3_base board = bpi_picow_esp32_s3 @@ -17,11 +17,11 @@ lib_deps = lovyan03/LovyanGFX@^1.1.8 -[env:picomputer-s3-tft] +[env:picomputer-s3] extends = esp32s3_base board = bpi_picow_esp32_s3 board_build.partitions = default_8MB.csv ; just for test -;board_check = true +board_check = true upload_protocol = esptool build_flags = ${esp32_base.build_flags} -D PICOMPUTER_S3 From 3255991e8d767c43cb16a5bc33fe79341069be2c Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 26 Aug 2024 07:19:47 +0200 Subject: [PATCH 203/322] picomputer build --- lib/device-ui | 2 +- variants/picomputer-s3/platformio.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index 23171afbfa..ca3779735e 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 23171afbfa0c55902425643622981abd886dd313 +Subproject commit ca3779735ee08555a95b3b47a76358ccb91b4141 diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index f9e1f56521..8bffdcaa78 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -1,4 +1,4 @@ -[env:picomputer-s3-old] +[env:picomputer-s3-oled] extends = esp32s3_base board = bpi_picow_esp32_s3 From d306ece6a9c8223276eeece64400dc53b7d996d6 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 27 Aug 2024 10:21:36 +0200 Subject: [PATCH 204/322] fix compiler error std::find() --- src/gps/GPS.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 7d7de8700e..147b07594a 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -16,6 +16,7 @@ #ifdef ARCH_PORTDUINO #include "PortduinoGlue.h" #include "meshUtils.h" +#include #include #endif From 7b3ad3dfe531632d8c5ef44d937ebdfaa85f8f45 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 31 Aug 2024 14:30:44 +0200 Subject: [PATCH 205/322] fix merge --- src/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index e91a5ae17d..052a761018 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -278,7 +278,6 @@ void setup() unphone.printStore(); #endif -======= #if ARCH_PORTDUINO struct timeval tv; tv.tv_sec = time(NULL); From 3a141ec7d5617822a47a887afea2796c8843a574 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 1 Sep 2024 11:11:13 +0200 Subject: [PATCH 206/322] lib update: theme runtime config --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index ca3779735e..14b9bb76b9 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit ca3779735ee08555a95b3b47a76358ccb91b4141 +Subproject commit 14b9bb76b916613d195545034e491a64ac0e95ac From c86b278aa5940d3be46b0a62348f993f5000b64b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 2 Sep 2024 20:54:00 +0200 Subject: [PATCH 207/322] lib update: packet logger + T-Deck Plus --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 14b9bb76b9..a6a981cb81 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 14b9bb76b916613d195545034e491a64ac0e95ac +Subproject commit a6a981cb8120588324c562994d3c378aad39eedb From c4e0989440f5b6d537e0909f11773d30736b28f8 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 4 Sep 2024 18:57:39 +0200 Subject: [PATCH 208/322] lib update: mesh detector --- lib/device-ui | 2 +- src/mesh/api/PacketAPI.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index a6a981cb81..43758a65cd 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit a6a981cb8120588324c562994d3c378aad39eedb +Subproject commit 43758a65cd45343432e1dba59510b2d1bc0d5180 diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp index 1e6f6c2ddb..348b329495 100644 --- a/src/mesh/api/PacketAPI.cpp +++ b/src/mesh/api/PacketAPI.cpp @@ -4,6 +4,7 @@ #include "MeshService.h" #include "PowerFSM.h" #include "RadioInterface.h" +#include "modules/NodeInfoModule.h" PacketAPI *packetAPI = nullptr; @@ -54,7 +55,14 @@ bool PacketAPI::receivePacket(void) break; } case meshtastic_ToRadio_heartbeat_tag: - LOG_DEBUG("Got client heartbeat\n"); + if (mr->heartbeat.dummy_field == 1) { + if (nodeInfoModule) { + LOG_INFO("Broadcasting nodeinfo ping\n"); + nodeInfoModule->sendOurNodeInfo(NODENUM_BROADCAST, true, 0, true); + } + } else { + LOG_DEBUG("Got client heartbeat\n"); + } break; default: LOG_ERROR("Error: unhandled meshtastic_ToRadio variant: %d\n", mr->which_payload_variant); From 3a736481cd4f309a150e52d4307f140584f323dc Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 6 Sep 2024 01:49:19 +0200 Subject: [PATCH 209/322] lib update: fix brightness & trackball crash --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 43758a65cd..f4b3ac0016 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 43758a65cd45343432e1dba59510b2d1bc0d5180 +Subproject commit f4b3ac00163b78e7e5bc3de7c3ad9b5cab343613 From 0ca687e6c4f12c4fa8209a334c98dacec4207af8 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 8 Sep 2024 23:43:53 +0200 Subject: [PATCH 210/322] try-fix less paranoia --- lib/device-ui | 2 +- variants/t-deck/platformio.ini | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index f4b3ac0016..f4da014788 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit f4b3ac00163b78e7e5bc3de7c3ad9b5cab343613 +Subproject commit f4da01478825545aea53a6eb6442010037b78cae diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 564013a7c8..bc0694e9d6 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -35,6 +35,7 @@ build_flags = ${esp32_base.build_flags} -D LV_USE_LOG=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D RADIOLIB_SPI_PARANOID=0 -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_TDECK -D VIEW_320x240 From bb7286c085dfbb24e74994b0b58069d40185e892 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 10 Sep 2024 16:12:16 +0200 Subject: [PATCH 211/322] sensecap indicator updates --- lib/device-ui | 2 +- .../seeed-sensecap-indicator/platformio.ini | 34 ++++++++++++++----- variants/seeed-sensecap-indicator/variant.h | 16 ++++----- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index f4da014788..a3e502d3bd 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit f4da01478825545aea53a6eb6442010037b78cae +Subproject commit a3e502d3bd0e31ddd05d49f922e5cb9d78165827 diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 5b8d0ad456..c5b3640429 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -8,15 +8,23 @@ platform_packages = board = seeed-sensecap-indicator board_check = true upload_protocol = esptool -build_type = debug -build_flags = ${esp32_base.build_flags} -Og +build_flags = ${esp32_base.build_flags} -Ivariants/seeed-sensecap-indicator -DSENSECAP_INDICATOR + -DCONFIG_ARDUHAL_LOG_COLORS + -DRADIOLIB_DEBUG_SPI=0 + -DRADIOLIB_DEBUG_PROTOCOL=0 + -DRADIOLIB_DEBUG_BASIC=0 + -DRADIOLIB_VERBOSE_ASSERT=0 + -DRADIOLIB_SPI_PARANOID=0 -DIO_EXPANDER=0x40 + -DIO_EXPANDER_IRQ=42 + ;-DIO_EXPANDER_DEBUG + -DUSE_ARDUINO_HAL_GPIO lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.16 + https://github.com/mverch67/LovyanGFX#develop earlephilhower/ESP8266Audio@^1.9.7 earlephilhower/ESP8266SAM@^1.0.1 @@ -24,13 +32,11 @@ lib_deps = ${esp32s3_base.lib_deps} [env:seeed-sensecap-indicator-tft] extends = esp32s3_base platform_packages = -; platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32-fork - platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 + platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32 +; platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 board = seeed-sensecap-indicator -;board_build.partitions = default_16MB.csv board_check = true upload_protocol = esptool -build_type = debug build_flags = ${esp32_base.build_flags} -D SENSECAP_INDICATOR -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 @@ -38,7 +44,16 @@ build_flags = ${esp32_base.build_flags} -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 -D MESHTASTIC_EXCLUDE_SCREEN=1 -D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 + -D CONFIG_ARDUHAL_LOG_COLORS + -D RADIOLIB_DEBUG_SPI=0 + -D RADIOLIB_DEBUG_PROTOCOL=0 + -D RADIOLIB_DEBUG_BASIC=0 + -D RADIOLIB_VERBOSE_ASSERT=0 + -D RADIOLIB_SPI_PARANOID=0 -D IO_EXPANDER=0x40 + -D IO_EXPANDER_IRQ=42 + ;-D IO_EXPANDER_DEBUG + -D USE_ARDUINO_HAL_GPIO -D MAX_NUM_NODES=250 -D HAS_SCREEN=0 -D HAS_TFT=1 @@ -54,7 +69,7 @@ build_flags = ${esp32_base.build_flags} -D LV_USE_LOG=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -; -D CALIBRATE_TOUCH=0 + -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_INDICATOR -D VIEW_320x240 ; -D USE_DOUBLE_BUFFER @@ -67,6 +82,7 @@ build_src_filter = ${esp32_base.build_src_filter} +<../lib/device-ui/locale> +<../lib/device-ui/source> lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.16 + https://github.com/mverch67/LovyanGFX#develop +; file:///home/manuel/Documents/PlatformIO/Projects/LovyanGFX earlephilhower/ESP8266Audio@^1.9.7 earlephilhower/ESP8266SAM@^1.0.1 diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index 6662f940e7..fe07c34b42 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -19,21 +19,20 @@ #define ST7701_BL 45 #define ST7701_SPI_HOST SPI2_HOST #define ST7701_BACKLIGHT_EN 45 -#define SPI_FREQUENCY 20000000 -#define SPI_READ_FREQUENCY 16000000 +#define SPI_FREQUENCY 12000000 #define TFT_HEIGHT 480 #define TFT_WIDTH 480 #define TFT_OFFSET_X 0 #define TFT_OFFSET_Y 0 -#define TFT_OFFSET_ROTATION 1 +#define TFT_OFFSET_ROTATION 0 #define TFT_BL 45 #define SCREEN_ROTATE #define SCREEN_TRANSITION_FRAMERATE 5 // fps -#define HAS_TOUCHSCREEN 3 +#define HAS_TOUCHSCREEN 1 #define SCREEN_TOUCH_INT (6 | IO_EXPANDER) #define SCREEN_TOUCH_RST (7 | IO_EXPANDER) -#define TOUCH_I2C_PORT 1 +#define TOUCH_I2C_PORT 0 #define TOUCH_SLAVE_ADDRESS 0x48 // Buzzer @@ -43,10 +42,8 @@ #undef GPS_RX_PIN #undef GPS_TX_PIN -// disabled until IO_EXPANDER interrupts supported -#define HAS_RADIO 0 -// #define USE_SX1262 -// #define USE_SX1268 +#define USE_SX1262 +#define USE_SX1268 #define LORA_SCK 41 #define LORA_MISO 47 @@ -64,4 +61,3 @@ #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET #define SX126X_DIO2_AS_RF_SWITCH -// #define SX126X_DIO3_TCXO_VOLTAGE 1.8 From 08e6f75da8f7e88ab90314a93729a57bbf182514 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 11 Sep 2024 09:55:15 +0200 Subject: [PATCH 212/322] lib update: indicator fix --- lib/device-ui | 2 +- variants/seeed-sensecap-indicator/platformio.ini | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index a3e502d3bd..c29f18d2e2 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit a3e502d3bd0e31ddd05d49f922e5cb9d78165827 +Subproject commit c29f18d2e21bd7d4800f58e34951000f3f5b4595 diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index c5b3640429..03e6920afd 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -32,8 +32,8 @@ lib_deps = ${esp32s3_base.lib_deps} [env:seeed-sensecap-indicator-tft] extends = esp32s3_base platform_packages = - platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32 -; platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 +; platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32 + platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 board = seeed-sensecap-indicator board_check = true upload_protocol = esptool From 5829a746e68121c8f91fd7ce78d2e8c877fe21be Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 17 Sep 2024 21:40:11 +0200 Subject: [PATCH 213/322] lib update: statistic & some fixes --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index c29f18d2e2..8047231c5b 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit c29f18d2e21bd7d4800f58e34951000f3f5b4595 +Subproject commit 8047231c5b5970f2ca6e111643e2f8809ec64135 From 73ce1cd7c1aa1ba6b97054750d959401cfd67fed Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 18 Sep 2024 21:48:51 +0200 Subject: [PATCH 214/322] lib-update: other T-Deck touch driver --- lib/device-ui | 2 +- src/main.cpp | 2 +- variants/t-deck/platformio.ini | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/device-ui b/lib/device-ui index 8047231c5b..433815b707 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 8047231c5b5970f2ca6e111643e2f8809ec64135 +Subproject commit 433815b70782bc0a03ff7323f98273f53cda9129 diff --git a/src/main.cpp b/src/main.cpp index 365d21f876..663737b8bf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1266,7 +1266,7 @@ void tft_task_handler(void *param = nullptr) spiLock->unlock(); } #ifdef HAS_FREE_RTOS - vTaskDelay((TickType_t)10); + vTaskDelay(5 / portTICK_PERIOD_MS); #else delay(5); #endif diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index bc0694e9d6..8c7dc6f0c9 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -36,6 +36,7 @@ build_flags = ${esp32_base.build_flags} -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D RADIOLIB_SPI_PARANOID=0 + -D CUSTOM_TOUCH_DRIVER -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_TDECK -D VIEW_320x240 @@ -51,5 +52,6 @@ build_src_filter = ${esp32_base.build_src_filter} lib_deps = ${esp32_base.lib_deps} lovyan03/LovyanGFX@^1.1.16 + bitbank2/bb_captouch@1.2.2 ; alternative touch library supporting GT911 earlephilhower/ESP8266Audio@^1.9.7 earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file From 1ff5c867b2db5e914129387f9dbb9280eba29a6c Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 19 Sep 2024 12:26:20 +0200 Subject: [PATCH 215/322] use custom touch driver for Indicator --- lib/device-ui | 2 +- variants/seeed-sensecap-indicator/platformio.ini | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 433815b707..a9fc70cbde 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 433815b70782bc0a03ff7323f98273f53cda9129 +Subproject commit a9fc70cbde73ca60b8f5a570feb70fa07e3dd650 diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 0ccbd52d44..6b5f919276 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -68,6 +68,8 @@ build_flags = ${esp32_base.build_flags} -D LV_USE_LOG=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D CUSTOM_TOUCH_DRIVER + -D FT6X36_ADDR=0x48 -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_INDICATOR -D VIEW_320x240 @@ -83,5 +85,6 @@ build_src_filter = ${esp32_base.build_src_filter} lib_deps = ${esp32s3_base.lib_deps} https://github.com/mverch67/LovyanGFX#develop ; file:///home/manuel/Documents/PlatformIO/Projects/LovyanGFX + bitbank2/bb_captouch@1.2.2 ; alternative touch library supporting FT6x36 earlephilhower/ESP8266Audio@^1.9.7 earlephilhower/ESP8266SAM@^1.0.1 From 30890094c496e07c8c7948c87f4b31876a86d392 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 20 Sep 2024 12:51:11 +0200 Subject: [PATCH 216/322] lower tft task prio --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 0bbd9b5c0f..4158c1b2e4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1173,7 +1173,7 @@ void setup() #if HAS_TFT #ifdef HAS_FREE_RTOS - xTaskCreatePinnedToCore(tft_task_handler, "tft", 8192, NULL, 5, NULL, 0); + xTaskCreatePinnedToCore(tft_task_handler, "tft", 8192, NULL, 1, NULL, 0); #endif #else setCPUFast(false); // 80MHz is fine for our slow peripherals From 45b173abb35cc752277406050fc67478b1d65f9b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 23 Sep 2024 22:00:10 +0200 Subject: [PATCH 217/322] prepare LVGL ST7789 driver --- variants/t-deck/platformio.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 8c7dc6f0c9..2210be1db0 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -39,6 +39,8 @@ build_flags = ${esp32_base.build_flags} -D CUSTOM_TOUCH_DRIVER -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_TDECK +; -D LVGL_DRIVER=LVGL_TDECK +; -D LV_USE_ST7789=1 -D VIEW_320x240 ; -D USE_DOUBLE_BUFFER -D USE_PACKET_API From 307c44feacb29c0fd123cc0185defaf561f59fc9 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 23 Sep 2024 22:00:35 +0200 Subject: [PATCH 218/322] lib update: try-fix audio --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index a9fc70cbde..a1083198b5 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit a9fc70cbde73ca60b8f5a570feb70fa07e3dd650 +Subproject commit a1083198b5e6ebd32fedaf1dc487c7fd2477789c From 94e882c827a38505386ff0dcf39a2d9b4266467d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 20 Sep 2024 06:55:16 -0500 Subject: [PATCH 219/322] Drop received packets from self --- src/mqtt/MQTT.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 0f4c5a8c52..c15ac3325f 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -158,6 +158,11 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length) meshtastic_MeshPacket *p = packetPool.allocCopy(*e.packet); p->via_mqtt = true; // Mark that the packet was received via MQTT + if (p->from == 0 || p->from == nodeDB->getNodeNum()) { + LOG_INFO("Ignoring downlink message we originally sent.\n"); + packetPool.release(p); + return; + } if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { p->channel = ch.index; } From f625e8c83705bbd5aabe06b265954a8e7f50fac8 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 20 Sep 2024 07:22:11 -0500 Subject: [PATCH 220/322] Additional decoded packet ignores --- src/mqtt/MQTT.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index c15ac3325f..6840700e52 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -164,6 +164,16 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length) return; } if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { + if (moduleConfig.mqtt.encryption_enabled) { + LOG_INFO("Ignoring decoded message on MQTT, encryption is enabled.\n"); + packetPool.release(p); + return; + } + if (p->decoded.portnum == meshtastic_PortNum_ADMIN_APP) { + LOG_INFO("Ignoring decoded admin packet.\n"); + packetPool.release(p); + return; + } p->channel = ch.index; } From 29442c599d54e1986b6cbef8dd7fcfdba7182fe6 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Sat, 21 Sep 2024 06:27:41 +1200 Subject: [PATCH 221/322] Honor flip & color for Heltec T114 and T190 (#4786) * Honor TFT_MESH color if defined for Heltec T114 or T190 * Temporary: point lib_deps at fork of Heltec's ST7789 library For demo only, until ST7789 is merged * Update lib_deps; tidy preprocessor logic --- src/graphics/Screen.cpp | 7 +++++++ variants/heltec_mesh_node_t114/platformio.ini | 2 +- variants/heltec_vision_master_t190/platformio.ini | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index eceeab64f9..5ccf22aa2b 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1670,6 +1670,11 @@ void Screen::setup() static_cast(dispdev)->setSubtype(7); #endif +#if defined(USE_ST7789) && defined(TFT_MESH) + // Heltec T114 and T190: honor a custom text color, if defined in variant.h + static_cast(dispdev)->setRGB(TFT_MESH); +#endif + // Initialising the UI will init the display too. ui->init(); @@ -1726,6 +1731,8 @@ void Screen::setup() #if defined(ST7701_CS) || defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7789_CS) || \ defined(RAK14014) || defined(HX8357_CS) static_cast(dispdev)->flipScreenVertically(); +#elif defined(USE_ST7789) + static_cast(dispdev)->flipScreenVertically(); #else dispdev->flipScreenVertically(); #endif diff --git a/variants/heltec_mesh_node_t114/platformio.ini b/variants/heltec_mesh_node_t114/platformio.ini index e0d8ca0cc7..1b06c7f5e3 100644 --- a/variants/heltec_mesh_node_t114/platformio.ini +++ b/variants/heltec_mesh_node_t114/platformio.ini @@ -14,4 +14,4 @@ build_src_filter = ${nrf52_base.build_src_filter} +<../variants/heltec_mesh_node lib_deps = ${nrf52840_base.lib_deps} lewisxhe/PCF8563_Library@^1.0.1 - https://github.com/meshtastic/st7789#7181320e7ed05c7fb5fd2d32f14723bce6088b7b \ No newline at end of file + https://github.com/meshtastic/st7789#bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f \ No newline at end of file diff --git a/variants/heltec_vision_master_t190/platformio.ini b/variants/heltec_vision_master_t190/platformio.ini index fd00014394..0c504d62bb 100644 --- a/variants/heltec_vision_master_t190/platformio.ini +++ b/variants/heltec_vision_master_t190/platformio.ini @@ -9,5 +9,5 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} lewisxhe/PCF8563_Library@^1.0.1 - https://github.com/meshtastic/st7789#7181320e7ed05c7fb5fd2d32f14723bce6088b7b + https://github.com/meshtastic/st7789#bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f upload_speed = 921600 \ No newline at end of file From a84ec50e9b4f994082267a51ce44703e54e0e645 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 20 Sep 2024 14:55:53 -0500 Subject: [PATCH 222/322] Download debian files after firmware zip --- .github/workflows/main_matrix.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 9b97dcb2e4..549a5d60f3 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -251,12 +251,6 @@ jobs: merge-multiple: true path: ./output - - uses: actions/download-artifact@v4 - with: - pattern: meshtasticd_${{ steps.version.outputs.version }}_*.deb - merge-multiple: true - path: ./output - - name: Display structure of downloaded files run: ls -R @@ -314,6 +308,12 @@ jobs: asset_name: debug-elfs-${{ steps.version.outputs.version }}.zip asset_content_type: application/zip + - uses: actions/download-artifact@v4 + with: + pattern: meshtasticd_${{ steps.version.outputs.version }}_*.deb + merge-multiple: true + path: ./output + - name: Add raspbian aarch64 .deb uses: actions/upload-release-asset@v1 env: From 75eda8f14f5bdcbfdd66826bb27f06ed252cffc3 Mon Sep 17 00:00:00 2001 From: Jason Murray <15822260+scruplelesswizard@users.noreply.github.com> Date: Fri, 20 Sep 2024 18:30:32 -0700 Subject: [PATCH 223/322] set title for protobufs bump PR (#4792) --- .github/workflows/update_protobufs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index 4402a280e7..b46c070f11 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -28,6 +28,7 @@ jobs: - name: Create pull request uses: peter-evans/create-pull-request@v6 with: + title: Update protobufs and classes add-paths: | protobufs src/mesh From 81ec117dbbe781454803ebbe72f67c01d45eb4eb Mon Sep 17 00:00:00 2001 From: Jason Murray <15822260+scruplelesswizard@users.noreply.github.com> Date: Fri, 20 Sep 2024 18:30:49 -0700 Subject: [PATCH 224/322] set title for version bump PR (#4791) --- .github/workflows/main_matrix.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 549a5d60f3..588f0981ac 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -351,5 +351,6 @@ jobs: - name: Create version.properties pull request uses: peter-evans/create-pull-request@v6 with: + title: Bump version.properties add-paths: | version.properties From a2a68ce517c2fd7adc42ec26454235d1bdac8d98 Mon Sep 17 00:00:00 2001 From: Jason Murray Date: Fri, 20 Sep 2024 14:40:10 -0700 Subject: [PATCH 225/322] Enable Dependabot --- .github/dependabot.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..c81c7fc07c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,26 @@ +version: 2 +updates: +- package-ecosystem: docker + directory: devcontainer + schedule: + interval: daily + time: "05:00" + timezone: US/Pacific +- package-ecosystem: docker + directory: / + schedule: + interval: daily + time: "05:00" + timezone: US/Pacific +- package-ecosystem: gitsubmodule + directory: / + schedule: + interval: daily + time: "05:00" + timezone: US/Pacific +- package-ecosystem: github-actions + directory: /.github/workflows + schedule: + interval: daily + time: "05:00" + timezone: US/Pacific From b6d63eb0b54192907b4aa6fdd83800399810e8db Mon Sep 17 00:00:00 2001 From: Jason Murray Date: Fri, 20 Sep 2024 19:22:45 -0700 Subject: [PATCH 226/322] chore: trunk fmt --- .github/dependabot.yml | 48 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c81c7fc07c..b15e8c1ce2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,26 +1,26 @@ version: 2 updates: -- package-ecosystem: docker - directory: devcontainer - schedule: - interval: daily - time: "05:00" - timezone: US/Pacific -- package-ecosystem: docker - directory: / - schedule: - interval: daily - time: "05:00" - timezone: US/Pacific -- package-ecosystem: gitsubmodule - directory: / - schedule: - interval: daily - time: "05:00" - timezone: US/Pacific -- package-ecosystem: github-actions - directory: /.github/workflows - schedule: - interval: daily - time: "05:00" - timezone: US/Pacific + - package-ecosystem: docker + directory: devcontainer + schedule: + interval: daily + time: 05:00 + timezone: US/Pacific + - package-ecosystem: docker + directory: / + schedule: + interval: daily + time: 05:00 + timezone: US/Pacific + - package-ecosystem: gitsubmodule + directory: / + schedule: + interval: daily + time: 05:00 + timezone: US/Pacific + - package-ecosystem: github-actions + directory: /.github/workflows + schedule: + interval: daily + time: 05:00 + timezone: US/Pacific From d13755bdb2cda04abfed346da7af82d7956c5eea Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sat, 21 Sep 2024 14:20:30 +0800 Subject: [PATCH 227/322] fix dependabot syntax (#4795) * fix dependabot syntax * Update dependabot.yml * Update dependabot.yml --- .github/dependabot.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b15e8c1ce2..616c16ce24 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,23 +4,23 @@ updates: directory: devcontainer schedule: interval: daily - time: 05:00 + time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check timezone: US/Pacific - package-ecosystem: docker directory: / schedule: interval: daily - time: 05:00 + time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check timezone: US/Pacific - package-ecosystem: gitsubmodule directory: / schedule: interval: daily - time: 05:00 + time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check timezone: US/Pacific - package-ecosystem: github-actions directory: /.github/workflows schedule: interval: daily - time: 05:00 + time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check timezone: US/Pacific From 0d9fdecdd11d6ef16f6b88dc71b5aec87c081aa6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 08:17:31 +0000 Subject: [PATCH 228/322] Bump peter-evans/create-pull-request from 6 to 7 in /.github/workflows (#4797) --- .github/workflows/main_matrix.yml | 2 +- .github/workflows/update_protobufs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 588f0981ac..be09c24b28 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -349,7 +349,7 @@ jobs: bin/bump_version.py - name: Create version.properties pull request - uses: peter-evans/create-pull-request@v6 + uses: peter-evans/create-pull-request@v7 with: title: Bump version.properties add-paths: | diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index b46c070f11..f93930a837 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -26,7 +26,7 @@ jobs: ./bin/regen-protos.sh - name: Create pull request - uses: peter-evans/create-pull-request@v6 + uses: peter-evans/create-pull-request@v7 with: title: Update protobufs and classes add-paths: | From e15d40aa9972e7206dfff88b5316906eed903c57 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 09:30:36 +0000 Subject: [PATCH 229/322] Bump docker/build-push-action from 5 to 6 in /.github/workflows (#4800) --- .github/workflows/build_native.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_native.yml b/.github/workflows/build_native.yml index 51bef0c132..1fb44a7170 100644 --- a/.github/workflows/build_native.yml +++ b/.github/workflows/build_native.yml @@ -67,7 +67,7 @@ jobs: - name: Docker build and push tagged versions if: ${{ github.event_name == 'workflow_dispatch' }} continue-on-error: true # FIXME: Failing docker login auth - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile @@ -77,7 +77,7 @@ jobs: - name: Docker build and push if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} continue-on-error: true # FIXME: Failing docker login auth - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile From 0617f33eecae8648a140205cf92d2033985c64b5 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sat, 21 Sep 2024 19:10:59 +0800 Subject: [PATCH 230/322] Actions: Semgrep Images have moved from returntocorp to semgrep (#4774) https://hub.docker.com/r/returntocorp/semgrep notes: "We've moved! Official Docker images for Semgrep now available at semgrep/semgrep." Patch updates our CI workflow for these images. Co-authored-by: Ben Meadors --- .github/workflows/sec_sast_semgrep_cron.yml | 2 +- .github/workflows/sec_sast_semgrep_pull.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sec_sast_semgrep_cron.yml b/.github/workflows/sec_sast_semgrep_cron.yml index 2a0361f5e3..54bbbe6d24 100644 --- a/.github/workflows/sec_sast_semgrep_cron.yml +++ b/.github/workflows/sec_sast_semgrep_cron.yml @@ -12,7 +12,7 @@ jobs: semgrep-full: runs-on: ubuntu-latest container: - image: returntocorp/semgrep + image: semgrep/semgrep steps: # step 1 diff --git a/.github/workflows/sec_sast_semgrep_pull.yml b/.github/workflows/sec_sast_semgrep_pull.yml index 2575cbf019..9013f1c74c 100644 --- a/.github/workflows/sec_sast_semgrep_pull.yml +++ b/.github/workflows/sec_sast_semgrep_pull.yml @@ -6,7 +6,7 @@ jobs: semgrep-diff: runs-on: ubuntu-22.04 container: - image: returntocorp/semgrep + image: semgrep/semgrep steps: # step 1 From d3cb80872f493115b205163c4d14cdc9469629e0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 06:11:32 -0500 Subject: [PATCH 231/322] Bump meshtestic from `31ee3d9` to `37245b3` (#4799) Bumps [meshtestic](https://github.com/meshtastic/meshTestic) from `31ee3d9` to `37245b3`. - [Commits](https://github.com/meshtastic/meshTestic/compare/31ee3d90c8bef61e835c3271be2c7cda8c4a5cc2...37245b3d612a9272f546bbb092837bafdad46bc2) --- updated-dependencies: - dependency-name: meshtestic dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- meshtestic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtestic b/meshtestic index 31ee3d90c8..37245b3d61 160000 --- a/meshtestic +++ b/meshtestic @@ -1 +1 @@ -Subproject commit 31ee3d90c8bef61e835c3271be2c7cda8c4a5cc2 +Subproject commit 37245b3d612a9272f546bbb092837bafdad46bc2 From 9f64adf604e2fac94d083f56775fc07015a49cc8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 06:12:05 -0500 Subject: [PATCH 232/322] [create-pull-request] automated change (#4789) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 69c4784820..b308271919 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 5 -build = 1 +build = 2 From b06238f9d99332507737e64ce3fdfcb85c5c10cf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 06:13:09 -0500 Subject: [PATCH 233/322] Bump pnpm/action-setup from 2 to 4 in /.github/workflows (#4798) Bumps [pnpm/action-setup](https://github.com/pnpm/action-setup) from 2 to 4. - [Release notes](https://github.com/pnpm/action-setup/releases) - [Commits](https://github.com/pnpm/action-setup/compare/v2...v4) --- updated-dependencies: - dependency-name: pnpm/action-setup dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f58b38ac9e..bf3d15dbac 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -77,7 +77,7 @@ jobs: pio upgrade - name: Setup pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v4 with: version: latest From 6377f0e1b4a96fbfd3aec40c1e2da1f962554fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 21 Sep 2024 14:50:19 +0200 Subject: [PATCH 234/322] Raspberry Pico2 - needs protos --- arch/esp32/esp32.ini | 2 +- arch/nrf52/nrf52.ini | 2 +- arch/portduino/portduino.ini | 2 +- arch/{rp2040 => rp2xx0}/rp2040.ini | 2 +- arch/rp2xx0/rp2350.ini | 23 +++++++++ arch/stm32/stm32.ini | 2 +- .../{rp2040 => rp2xx0}/architecture.h | 2 + .../main-rp2xx0.cpp} | 0 variants/rpipico2/platformio.ini | 16 ++++++ variants/rpipico2/variant.h | 50 +++++++++++++++++++ 10 files changed, 96 insertions(+), 5 deletions(-) rename arch/{rp2040 => rp2xx0}/rp2040.ini (97%) create mode 100644 arch/rp2xx0/rp2350.ini rename src/platform/{rp2040 => rp2xx0}/architecture.h (90%) rename src/platform/{rp2040/main-rp2040.cpp => rp2xx0/main-rp2xx0.cpp} (100%) create mode 100644 variants/rpipico2/platformio.ini create mode 100644 variants/rpipico2/variant.h diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index 0dd6cbc1d7..13360be780 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -5,7 +5,7 @@ custom_esp32_kind = esp32 platform = platformio/espressif32@6.7.0 build_src_filter = - ${arduino_base.build_src_filter} - - - - - + ${arduino_base.build_src_filter} - - - - - upload_speed = 921600 debug_init_break = tbreak setup diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index 5c5064afc5..4e3093c558 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -16,7 +16,7 @@ build_flags = -DLFS_NO_ASSERT ; Disable LFS assertions , see https://github.com/meshtastic/firmware/pull/3818 build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - - - + ${arduino_base.build_src_filter} - - - - - - - - - - lib_deps= ${arduino_base.lib_deps} diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 8154444196..dde9f8c047 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -9,7 +9,7 @@ build_src_filter = - - - - - + - - - + diff --git a/arch/rp2040/rp2040.ini b/arch/rp2xx0/rp2040.ini similarity index 97% rename from arch/rp2040/rp2040.ini rename to arch/rp2xx0/rp2040.ini index 4dc89c04b5..224833289a 100644 --- a/arch/rp2040/rp2040.ini +++ b/arch/rp2xx0/rp2040.ini @@ -8,7 +8,7 @@ board_build.core = earlephilhower board_build.filesystem_size = 0.5m build_flags = ${arduino_base.build_flags} -Wno-unused-variable - -Isrc/platform/rp2040 + -Isrc/platform/rp2xx0 -D__PLAT_RP2040__ # -D _POSIX_THREADS build_src_filter = diff --git a/arch/rp2xx0/rp2350.ini b/arch/rp2xx0/rp2350.ini new file mode 100644 index 0000000000..96ed0cb217 --- /dev/null +++ b/arch/rp2xx0/rp2350.ini @@ -0,0 +1,23 @@ +; Common settings for rp2040 Processor based targets +[rp2350_base] +platform = https://github.com/maxgerhardt/platform-raspberrypi.git#9e55f6db5c56b9867c69fe473f388beea4546672 +extends = arduino_base +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#a6ab6e1f95bc1428d667d55ea7173c0744acc03c ; 4.0.2+ + +board_build.core = earlephilhower +board_build.filesystem_size = 0.5m +build_flags = + ${arduino_base.build_flags} -Wno-unused-variable + -Isrc/platform/rp2xx0 + -D__PLAT_RP2040__ +# -D _POSIX_THREADS +build_src_filter = + ${arduino_base.build_src_filter} - - - - - - - - - + +lib_ignore = + BluetoothOTA + +lib_deps = + ${arduino_base.lib_deps} + ${environmental_base.lib_deps} + rweather/Crypto \ No newline at end of file diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini index 050dbf7f0f..4be2900154 100644 --- a/arch/stm32/stm32.ini +++ b/arch/stm32/stm32.ini @@ -22,7 +22,7 @@ build_flags = -fdata-sections build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - - - - - - - + ${arduino_base.build_src_filter} - - - - - - - - - - - - - - board_upload.offset_address = 0x08000000 upload_protocol = stlink diff --git a/src/platform/rp2040/architecture.h b/src/platform/rp2xx0/architecture.h similarity index 90% rename from src/platform/rp2040/architecture.h rename to src/platform/rp2xx0/architecture.h index 3f75735d34..8c7dfc0cdf 100644 --- a/src/platform/rp2040/architecture.h +++ b/src/platform/rp2xx0/architecture.h @@ -23,6 +23,8 @@ #if defined(RPI_PICO) #define HW_VENDOR meshtastic_HardwareModel_RPI_PICO +#elif defined(RPI_PICO2) +#define HW_VENDOR meshtastic_HardwareModel_RPI_PICO2 #elif defined(RAK11310) #define HW_VENDOR meshtastic_HardwareModel_RAK11310 #elif defined(SENSELORA_RP2040) diff --git a/src/platform/rp2040/main-rp2040.cpp b/src/platform/rp2xx0/main-rp2xx0.cpp similarity index 100% rename from src/platform/rp2040/main-rp2040.cpp rename to src/platform/rp2xx0/main-rp2xx0.cpp diff --git a/variants/rpipico2/platformio.ini b/variants/rpipico2/platformio.ini new file mode 100644 index 0000000000..a634144187 --- /dev/null +++ b/variants/rpipico2/platformio.ini @@ -0,0 +1,16 @@ +[env:pico2] +extends = rp2350_base +board = rpipico2 +upload_protocol = picotool + +# add our variants files to the include and src paths +build_flags = ${rp2350_base.build_flags} + -DRPI_PICO2 + -Ivariants/rpipico2 + -DDEBUG_RP2040_PORT=Serial + -DHW_SPI1_DEVICE + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" +lib_deps = + ${rp2350_base.lib_deps} +debug_build_flags = ${rp2350_base.build_flags} +debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file diff --git a/variants/rpipico2/variant.h b/variants/rpipico2/variant.h new file mode 100644 index 0000000000..7efaeaf7a8 --- /dev/null +++ b/variants/rpipico2/variant.h @@ -0,0 +1,50 @@ +// #define RADIOLIB_CUSTOM_ARDUINO 1 +// #define RADIOLIB_TONE_UNSUPPORTED 1 +// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1 + +#define ARDUINO_ARCH_AVR + +// default I2C pins: +// SDA = 4 +// SCL = 5 + +// Recommended pins for SerialModule: +// txd = 8 +// rxd = 9 + +#define EXT_NOTIFY_OUT 22 +#define BUTTON_PIN 17 + +#define LED_PIN PIN_LED + +#define BATTERY_PIN 26 +// ratio of voltage divider = 3.0 (R17=200k, R18=100k) +#define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic +#define BATTERY_SENSE_RESOLUTION_BITS ADC_RESOLUTION + +#define USE_SX1262 + +#undef LORA_SCK +#undef LORA_MISO +#undef LORA_MOSI +#undef LORA_CS + +#define LORA_SCK 10 +#define LORA_MISO 12 +#define LORA_MOSI 11 +#define LORA_CS 3 + +#define LORA_DIO0 RADIOLIB_NC +#define LORA_RESET 15 +#define LORA_DIO1 20 +#define LORA_DIO2 2 +#define LORA_DIO3 RADIOLIB_NC + +#ifdef USE_SX1262 +#define SX126X_CS LORA_CS +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_DIO2 +#define SX126X_RESET LORA_RESET +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#endif From c6e71f2e72bcdaa1f1f1270ea44cc825f30ed73a Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Sun, 22 Sep 2024 00:59:17 +1200 Subject: [PATCH 235/322] Re-order doDeepSleep (#4802) Make sure PMU sleep takes place before I2C ends --- src/sleep.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/sleep.cpp b/src/sleep.cpp index 99468f6c28..d553bf23d7 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -271,13 +271,6 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false) digitalWrite(LORA_CS, HIGH); gpio_hold_en((gpio_num_t)LORA_CS); } - -#if defined(I2C_SDA) - Wire.end(); - pinMode(I2C_SDA, ANALOG); - pinMode(I2C_SCL, ANALOG); -#endif - #endif #ifdef HAS_PMU @@ -315,6 +308,14 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false) } #endif +#if defined(ARCH_ESP32) && defined(I2C_SDA) + // Added by https://github.com/meshtastic/firmware/pull/4418 + // Possibly to support Heltec Capsule Sensor? + Wire.end(); + pinMode(I2C_SDA, ANALOG); + pinMode(I2C_SCL, ANALOG); +#endif + console->flush(); cpuDeepSleep(msecToWake); } From 2a06106ac061cfd4912b1294b4535465dfac0070 Mon Sep 17 00:00:00 2001 From: thebentern <9000580+thebentern@users.noreply.github.com> Date: Sat, 21 Sep 2024 13:12:45 +0000 Subject: [PATCH 236/322] [create-pull-request] automated change --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/protobufs b/protobufs index 5709c0a05e..9b84907847 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 5709c0a05eaefccbc9cb8ed3917adbf5fd134197 +Subproject commit 9b84907847b67047b72f9792f4b47532b308bbe4 diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 921dfa55bf..aa83ff27a6 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -71,6 +71,8 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_RAK2560 = 22, /* Heltec HRU-3601: https://heltec.org/project/hru-3601/ */ meshtastic_HardwareModel_HELTEC_HRU_3601 = 23, + /* Heltec Wireless Bridge */ + meshtastic_HardwareModel_HELTEC_WIRELESS_BRIDGE = 24, /* B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station */ meshtastic_HardwareModel_STATION_G1 = 25, /* RAK11310 (RP2040 + SX1262) */ @@ -199,6 +201,8 @@ typedef enum _meshtastic_HardwareModel { /* M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/ */ meshtastic_HardwareModel_M5STACK_COREBASIC = 77, meshtastic_HardwareModel_M5STACK_CORE2 = 78, + /* Pico2 with Waveshare Hat, same as Pico */ + meshtastic_HardwareModel_RPI_PICO2 = 79, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ From 9e99fdab9f910ca65a7be7d2774f5c0dd5a6d68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 21 Sep 2024 12:42:51 +0200 Subject: [PATCH 237/322] heltec-wireless-bridge requires Proto PR first --- src/platform/esp32/architecture.h | 2 ++ .../heltec_wireless_bridge/platformio.ini | 6 ++++ variants/heltec_wireless_bridge/variant.h | 29 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 variants/heltec_wireless_bridge/platformio.ini create mode 100644 variants/heltec_wireless_bridge/variant.h diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index 93630aa8a6..90c4c392dc 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -76,6 +76,8 @@ #ifdef HELTEC_V2_1 #define HW_VENDOR meshtastic_HardwareModel_HELTEC_V2_1 #endif +#elif defined(HELTEC_WIRELESS_BRIDGE) +#define HW_VENDOR meshtastic_HardwareModel_HELTEC_WIRELESS_BRIDGE #elif defined(ARDUINO_HELTEC_WIFI_LORA_32) #define HW_VENDOR meshtastic_HardwareModel_HELTEC_V1 #elif defined(TLORA_V1) diff --git a/variants/heltec_wireless_bridge/platformio.ini b/variants/heltec_wireless_bridge/platformio.ini new file mode 100644 index 0000000000..45c3aba740 --- /dev/null +++ b/variants/heltec_wireless_bridge/platformio.ini @@ -0,0 +1,6 @@ +[env:heltec-wireless-bridge] +;build_type = debug ; to make it possible to step through our jtag debugger +extends = esp32_base +board = heltec_wifi_lora_32 +build_flags = + ${esp32_base.build_flags} -D HELTEC_WIRELESS_BRIDGE -I variants/heltec_wireless_bridge \ No newline at end of file diff --git a/variants/heltec_wireless_bridge/variant.h b/variants/heltec_wireless_bridge/variant.h new file mode 100644 index 0000000000..7c4f416600 --- /dev/null +++ b/variants/heltec_wireless_bridge/variant.h @@ -0,0 +1,29 @@ +// the default ESP32 Pin of 15 is the Oled SCL, set to 36 and 37 and works fine. +// Tested on Neo6m module. +#undef GPS_RX_PIN +#undef GPS_TX_PIN +#define GPS_RX_PIN 36 +#define GPS_TX_PIN 33 + +#ifndef USE_JTAG // gpio15 is TDO for JTAG, so no I2C on this board while doing jtag +#define I2C_SDA 4 // I2C pins for this board +#define I2C_SCL 15 +#endif + +#define LED_PIN 25 // If defined we will blink this LED +#define BUTTON_PIN 0 // If defined, this will be used for user button presses + +#define USE_RF95 +#define LORA_DIO0 26 // a No connect on the SX1262 module +#ifndef USE_JTAG +#define LORA_RESET 14 +#endif +#define LORA_DIO1 35 +#define LORA_DIO2 34 // Not really used + +// ratio of voltage divider = 3.20 (R1=100k, R2=220k) +#define ADC_MULTIPLIER 3.2 + +#define BATTERY_PIN 13 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage +#define ADC_CHANNEL ADC2_GPIO13_CHANNEL +#define BAT_MEASURE_ADC_UNIT 2 \ No newline at end of file From 1bff6bfb8b19689454ff4979064c55f1ff90e828 Mon Sep 17 00:00:00 2001 From: Jason Murray Date: Sat, 21 Sep 2024 07:37:37 -0700 Subject: [PATCH 238/322] feat: trigger class update when protobufs are changed --- .github/workflows/update_protobufs.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index f93930a837..466767273d 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -1,5 +1,10 @@ -name: "Update protobufs and regenerate classes" -on: workflow_dispatch +name: Update protobufs and regenerate classes +on: + pull_request: + branches: + - master + paths: + - meshtastic/** jobs: update-protobufs: @@ -11,10 +16,6 @@ jobs: with: submodules: true - - name: Update submodule - run: | - git submodule update --remote protobufs - - name: Download nanopb run: | wget https://jpa.kapsi.fi/nanopb/download/nanopb-0.4.8-linux-x86.tar.gz @@ -25,10 +26,11 @@ jobs: run: | ./bin/regen-protos.sh - - name: Create pull request - uses: peter-evans/create-pull-request@v7 + - name: Commit changes + uses: EndBug/add-and-commit@v9 with: - title: Update protobufs and classes - add-paths: | - protobufs - src/mesh + add: src/mesh + author_name: CI Bot + author_email: meshtastic-ci-bot@users.noreply.github.com + default_author: github_actor + message: Update classes from protobugs From 4ee17bb92259c3eb31041d82a7d08d4f5be12626 Mon Sep 17 00:00:00 2001 From: Jason Murray Date: Sat, 21 Sep 2024 08:49:36 -0700 Subject: [PATCH 239/322] meshtastic/ is a test suite; protobufs/ contains protobufs; --- .github/workflows/update_protobufs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index 466767273d..eb1ca3648d 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -4,7 +4,7 @@ on: branches: - master paths: - - meshtastic/** + - protobufs/** jobs: update-protobufs: @@ -33,4 +33,4 @@ jobs: author_name: CI Bot author_email: meshtastic-ci-bot@users.noreply.github.com default_author: github_actor - message: Update classes from protobugs + message: Update classes from protobufs From 873def52acc629bdde29eba8d275b5ca2b4c193b Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sat, 21 Sep 2024 16:17:30 -0500 Subject: [PATCH 240/322] Update platform-native to pick up portduino crash fix (#4807) --- arch/portduino/portduino.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index dde9f8c047..5d99fffed6 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based sim environment on top of any host OS, all hardware will be simulated [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#ad8112adf82ce1f5b917092cf32be07a077801a0 +platform = https://github.com/meshtastic/platform-native.git#6b3796d697481c8f6e3f4aa5c111bd9979f29e64 framework = arduino build_src_filter = From 8cee3a497167547700e3e963eb97c6015dd02051 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 21 Sep 2024 16:34:26 -0500 Subject: [PATCH 241/322] Hopefully extract and commit to meshtastic.github.io --- .github/workflows/main_matrix.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index be09c24b28..3564b8f931 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -354,3 +354,29 @@ jobs: title: Bump version.properties add-paths: | version.properties + + - name: Checkout meshtastic/meshtastic.github.io + uses: actions/checkout@v4 + with: + repository: meshtastic/meshtastic.github.io + token: ${{ secrets.GITHUB_TOKEN }} + path: meshtastic.github.io + + - name: Display structure of downloaded files + run: ls -R + + - name: Extract firmware.zip + run: | + unzip ./firmware-${{ steps.version.outputs.version }}.zip -d meshtastic.github.io/firmware-${{ steps.version.outputs.version }} + + - name: Display structure of downloaded files + run: ls -R + + - name: Commit and push changes + run: | + cd meshtastic.github.io + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "Add firmware version ${{ steps.version.outputs.version }}" + git push From 0e9c22910063ee35d391b1634cd839b24df9e26d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 21 Sep 2024 20:53:23 -0500 Subject: [PATCH 242/322] CI fixes --- .github/workflows/main_matrix.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 3564b8f931..19a92d8b8b 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -359,7 +359,7 @@ jobs: uses: actions/checkout@v4 with: repository: meshtastic/meshtastic.github.io - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.ARTIFACTS_TOKEN }} path: meshtastic.github.io - name: Display structure of downloaded files @@ -375,6 +375,7 @@ jobs: - name: Commit and push changes run: | cd meshtastic.github.io + find . -type f -name 'meshtasticd_*' -exec rm -f {} + git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" git add . From de7a3f9cf8b28afc9ec9ae368cbd56f7ff3c7fa6 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 22 Sep 2024 02:47:49 -0400 Subject: [PATCH 243/322] [Board] DIY "t-energy-s3_e22" (#4782) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * New variant "t-energy-s3_e22" - Lilygo T-Energy-S3 - NanoVHF "Mesh-v1.06-TTGO-T18" board - Ebyte E22 Series * add board_level = extra * Update variant.h --------- Co-authored-by: Thomas Göttgens Co-authored-by: Tom Fifield --- variants/diy/platformio.ini | 20 ++++++++++- variants/diy/t-energy-s3_e22/variant.h | 46 ++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 variants/diy/t-energy-s3_e22/variant.h diff --git a/variants/diy/platformio.ini b/variants/diy/platformio.ini index 2a55f7a791..f3c22b7a87 100644 --- a/variants/diy/platformio.ini +++ b/variants/diy/platformio.ini @@ -69,4 +69,22 @@ build_flags = ${nrf52840_base.build_flags} build_src_filter = ${nrf52_base.build_src_filter} +<../variants/diy/nrf52_promicro_diy_tcxo> lib_deps = ${nrf52840_base.lib_deps} -debug_tool = jlink \ No newline at end of file +debug_tool = jlink + +; NanoVHF T-Energy-S3 + E22(0)-xxxM - DIY +[env:t-energy-s3_e22] +extends = esp32s3_base +board = esp32-s3-devkitc-1 +board_level = extra +board_upload.flash_size = 16MB ;Specify the FLASH capacity as 16MB +board_build.arduino.memory_type = qio_opi ;Enable internal PSRAM +build_unflags = + ${esp32s3_base.build_unflags} + -D ARDUINO_USB_MODE=1 +build_flags = + ${esp32s3_base.build_flags} + -D EBYTE_ESP32_S3 + -D BOARD_HAS_PSRAM + -D ARDUINO_USB_MODE=0 + -D ARDUINO_USB_CDC_ON_BOOT=1 + -I variants/diy/t-energy-s3_e22 diff --git a/variants/diy/t-energy-s3_e22/variant.h b/variants/diy/t-energy-s3_e22/variant.h new file mode 100644 index 0000000000..6933d7715c --- /dev/null +++ b/variants/diy/t-energy-s3_e22/variant.h @@ -0,0 +1,46 @@ +// NanoVHF T-Energy-S3 + E22(0)-xxxM - DIY +// https://github.com/NanoVHF/Meshtastic-DIY/tree/main/PCB/ESP-32-devkit_EBYTE-E22/Mesh-v1.06-TTGO-T18 + +// Battery +#define BATTERY_PIN 3 +#define ADC_MULTIPLIER 2.0 +#define ADC_CHANNEL ADC1_GPIO3_CHANNEL + +// Button on NanoVHF PCB +#define BUTTON_PIN 39 + +// I2C via connectors on NanoVHF PCB +#define I2C_SCL 2 +#define I2C_SDA 42 + +// Screen (disabled) +#define HAS_SCREEN 0 // Assume no screen present by default to prevent crash... + +// GPS via T-Energy-S3 onboard connector +#define HAS_GPS 1 +#define GPS_TX_PIN 43 +#define GPS_RX_PIN 44 + +// LoRa +#define USE_SX1262 // E22-900M30S, E22-900M22S, and E22-900MM22S (not E220!) use SX1262 +#define USE_SX1268 // E22-400M30S, E22-400M33S, E22-400M22S, and E22-400MM22S use SX1268 + +#define SX126X_MAX_POWER 22 // SX126xInterface.cpp defaults to 22 if not defined, but here we define it for good practice +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // E22 series TCXO reference voltage is 1.8V + +#define SX126X_CS 5 // EBYTE module's NSS pin // FIXME: rename to SX126X_SS +#define SX126X_SCK 6 // EBYTE module's SCK pin +#define SX126X_MOSI 13 // EBYTE module's MOSI pin +#define SX126X_MISO 4 // EBYTE module's MISO pin +#define SX126X_RESET 1 // EBYTE module's NRST pin +#define SX126X_BUSY 48 // EBYTE module's BUSY pin +#define SX126X_DIO1 47 // EBYTE module's DIO1 pin + +#define SX126X_TXEN 10 // Schematic connects EBYTE module's TXEN pin to MCU +#define SX126X_RXEN 12 // Schematic connects EBYTE module's RXEN pin to MCU + +#define LORA_CS SX126X_CS // Compatibility with variant file configuration structure +#define LORA_SCK SX126X_SCK // Compatibility with variant file configuration structure +#define LORA_MOSI SX126X_MOSI // Compatibility with variant file configuration structure +#define LORA_MISO SX126X_MISO // Compatibility with variant file configuration structure +#define LORA_DIO1 SX126X_DIO1 // Compatibility with variant file configuration structure From 1c3d477202a82efc4fcec6d7543b696336332d93 Mon Sep 17 00:00:00 2001 From: Jason Murray <15822260+scruplelesswizard@users.noreply.github.com> Date: Sun, 22 Sep 2024 04:22:00 -0700 Subject: [PATCH 244/322] Consolidate variant build steps (#4806) * poc: consolidate variant build steps * use build-variant action * only checkout once and clean up after run --- .github/actions/build-variant/action.yml | 97 ++++++++++++++++++++++++ .github/workflows/build_esp32.yml | 60 ++++----------- .github/workflows/build_esp32_c3.yml | 59 ++++---------- .github/workflows/build_esp32_s3.yml | 60 ++++----------- .github/workflows/build_nrf52.yml | 22 ++---- .github/workflows/build_rpi2040.yml | 22 ++---- .github/workflows/build_stm32.yml | 24 ++---- 7 files changed, 159 insertions(+), 185 deletions(-) create mode 100644 .github/actions/build-variant/action.yml diff --git a/.github/actions/build-variant/action.yml b/.github/actions/build-variant/action.yml new file mode 100644 index 0000000000..0a96a0155a --- /dev/null +++ b/.github/actions/build-variant/action.yml @@ -0,0 +1,97 @@ +name: Setup Build Variant Composite Action +description: Variant build actions for Meshtastic Platform IO steps + +inputs: + board: + description: The board to build for + required: true + github_token: + description: GitHub token + required: true + build-script-path: + description: Path to the build script + required: true + remove-debug-flags: + description: A newline separated list of files to remove debug flags from + required: false + default: "" + ota-firmware-source: + description: The OTA firmware file to pull + required: false + default: "" + ota-firmware-target: + description: The target path to store the OTA firmware file + required: false + default: "" + artifact-paths: + description: A newline separated list of paths to store as artifacts + required: false + default: "" + include-web-ui: + description: Include the web UI in the build + required: false + default: "false" + +runs: + using: composite + steps: + - uses: actions/checkout@v4 + + - name: Build base + id: base + uses: ./.github/actions/setup-base + + - name: Pull web ui + if: ${{ inputs.include-web-ui == "true" }} + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: meshtastic/web + file: build.tar + target: build.tar + token: ${{ inputs.github_token }} + + - name: Unpack web ui + if: ${{ inputs.include-web-ui == "true" }} + shell: bash + run: | + tar -xf build.tar -C data/static + rm build.tar + + - name: Remove debug flags for release + shell: bash + if: ${{ inputs.remove-debug-flags != "" }} + run: | + for PATH in ${{ inputs.remove-debug-flags }}; do + sed -i '/DDEBUG_HEAP/d' ${PATH} + done + + - name: Build ${{ inputs.board }} + shell: bash + run: ${{ inputs.build-script-path }} ${{ inputs.board }} + + - name: Pull OTA Firmware + if: ${{ inputs.ota-firmware-source != "" && inputs.ota-firmware-target != "" }} + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: meshtastic/firmware-ota + file: ${{ inputs.ota-firmware-source }} + target: ${{ inputs.ota-firmware-target }} + token: ${{ inputs.github_token }} + + - name: Get release version string + shell: bash + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v4 + with: + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + overwrite: true + path: | + ${{ inputs.artifact-paths }} + + - name: Clean up resources + shell: bash + run: | + rm -rf . diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 4cbb4c7a42..8b7017fc93 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -11,53 +11,21 @@ jobs: build-esp32: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Build base - id: base - uses: ./.github/actions/setup-base - - - name: Pull web ui - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: meshtastic/web - file: build.tar - target: build.tar - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unpack web ui - run: | - tar -xf build.tar -C data/static - rm build.tar - - - name: Remove debug flags for release - if: ${{ github.event_name == 'workflow_dispatch' }} - run: | - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini - - name: Build ESP32 - run: bin/build-esp32.sh ${{ inputs.board }} - - - name: Pull OTA Firmware - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: meshtastic/firmware-ota - file: firmware.bin - target: release/bleota.bin - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get release version string - shell: bash - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + id: build + uses: ./.github/actions/build-variant with: - name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip - overwrite: true - path: | + github_token: ${{ secrets.GITHUB_TOKEN }} + board: ${{ inputs.board }} + remove-debug-flags: | + ./arch/esp32/esp32.ini + ./arch/esp32/esp32s2.ini + ./arch/esp32/esp32s3.ini + ./arch/esp32/esp32c3.ini + build-script-path: bin/build-esp32.sh + ota-firmware-source: firmware.bin + ota-firmware-target: release/bleota.bin + artifact-paths: | release/*.bin release/*.elf + include-web-ui: true diff --git a/.github/workflows/build_esp32_c3.yml b/.github/workflows/build_esp32_c3.yml index 07727d7115..249f6f1263 100644 --- a/.github/workflows/build_esp32_c3.yml +++ b/.github/workflows/build_esp32_c3.yml @@ -13,51 +13,20 @@ jobs: build-esp32-c3: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Build base - id: base - uses: ./.github/actions/setup-base - - - name: Pull web ui - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: meshtastic/web - file: build.tar - target: build.tar - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unpack web ui - run: | - tar -xf build.tar -C data/static - rm build.tar - - name: Remove debug flags for release - if: ${{ github.event_name == 'workflow_dispatch' }} - run: | - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini - - name: Build ESP32 - run: bin/build-esp32.sh ${{ inputs.board }} - - - name: Pull OTA Firmware - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: meshtastic/firmware-ota - file: firmware-c3.bin - target: release/bleota-c3.bin - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get release version string - shell: bash - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + - name: Build ESP32-C3 + id: build + uses: ./.github/actions/build-variant with: - name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip - overwrite: true - path: | + github_token: ${{ secrets.GITHUB_TOKEN }} + board: ${{ inputs.board }} + remove-debug-flags: | + ./arch/esp32/esp32.ini + ./arch/esp32/esp32s2.ini + ./arch/esp32/esp32s3.ini + ./arch/esp32/esp32c3.ini + build-script-path: bin/build-esp32.sh + ota-firmware-source: firmware-c3.bin + ota-firmware-target: release/bleota-c3.bin + artifact-paths: | release/*.bin release/*.elf diff --git a/.github/workflows/build_esp32_s3.yml b/.github/workflows/build_esp32_s3.yml index 10773833e6..7df3e5737b 100644 --- a/.github/workflows/build_esp32_s3.yml +++ b/.github/workflows/build_esp32_s3.yml @@ -11,51 +11,21 @@ jobs: build-esp32-s3: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Build base - id: base - uses: ./.github/actions/setup-base - - - name: Pull web ui - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: meshtastic/web - file: build.tar - target: build.tar - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unpack web ui - run: | - tar -xf build.tar -C data/static - rm build.tar - - name: Remove debug flags for release - if: ${{ github.event_name == 'workflow_dispatch' }} - run: | - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini - sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini - - name: Build ESP32 - run: bin/build-esp32.sh ${{ inputs.board }} - - - name: Pull OTA Firmware - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: meshtastic/firmware-ota - file: firmware-s3.bin - target: release/bleota-s3.bin - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get release version string - shell: bash - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + - name: Build ESP32-S3 + id: build + uses: ./.github/actions/build-variant with: - name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip - overwrite: true - path: | + github_token: ${{ secrets.GITHUB_TOKEN }} + board: ${{ inputs.board }} + remove-debug-flags: | + ./arch/esp32/esp32.ini + ./arch/esp32/esp32s2.ini + ./arch/esp32/esp32s3.ini + ./arch/esp32/esp32c3.ini + build-script-path: bin/build-esp32.sh + ota-firmware-source: firmware-s3.bin + ota-firmware-target: release/bleota-s3.bin + artifact-paths: | release/*.bin release/*.elf + include-web-ui: true diff --git a/.github/workflows/build_nrf52.yml b/.github/workflows/build_nrf52.yml index ac509a096a..85d3635cd1 100644 --- a/.github/workflows/build_nrf52.yml +++ b/.github/workflows/build_nrf52.yml @@ -11,24 +11,14 @@ jobs: build-nrf52: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Build base - id: base - uses: ./.github/actions/setup-base - - name: Build NRF52 - run: bin/build-nrf52.sh ${{ inputs.board }} - - - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + id: build + uses: ./.github/actions/build-variant with: - name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip - overwrite: true - path: | + github_token: ${{ secrets.GITHUB_TOKEN }} + board: ${{ inputs.board }} + build-script-path: bin/build-nrf52.sh + artifact-paths: | release/*.hex release/*.uf2 release/*.elf diff --git a/.github/workflows/build_rpi2040.yml b/.github/workflows/build_rpi2040.yml index 6e258fe2aa..d3e19f8fd3 100644 --- a/.github/workflows/build_rpi2040.yml +++ b/.github/workflows/build_rpi2040.yml @@ -11,23 +11,13 @@ jobs: build-rpi2040: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Build base - id: base - uses: ./.github/actions/setup-base - - name: Build Raspberry Pi 2040 - run: ./bin/build-rpi2040.sh ${{ inputs.board }} - - - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + id: build + uses: ./.github/actions/build-variant with: - name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip - overwrite: true - path: | + github_token: ${{ secrets.GITHUB_TOKEN }} + board: ${{ inputs.board }} + build-script-path: bin/build-rpi2040.sh + artifact-paths: | release/*.uf2 release/*.elf diff --git a/.github/workflows/build_stm32.yml b/.github/workflows/build_stm32.yml index d13c52c8a1..9252087df3 100644 --- a/.github/workflows/build_stm32.yml +++ b/.github/workflows/build_stm32.yml @@ -11,23 +11,13 @@ jobs: build-stm32: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Build base - id: base - uses: ./.github/actions/setup-base - - - name: Build STM32 - run: bin/build-stm32.sh ${{ inputs.board }} - - - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 + - name: Build Raspberry Pi 2040 + id: build + uses: ./.github/actions/build-variant with: - name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip - overwrite: true - path: | + github_token: ${{ secrets.GITHUB_TOKEN }} + board: ${{ inputs.board }} + build-script-path: bin/build-stm32.sh + artifact-paths: | release/*.hex release/*.bin From c356bec3ae8305cd99f629c71518c728a8536b16 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sun, 22 Sep 2024 19:39:35 +0800 Subject: [PATCH 245/322] Revert "Consolidate variant build steps (#4806)" (#4816) This reverts commit 9f8d86cb25febfb86c57f395549b7deb82458065. --- .github/actions/build-variant/action.yml | 97 ------------------------ .github/workflows/build_esp32.yml | 60 +++++++++++---- .github/workflows/build_esp32_c3.yml | 59 ++++++++++---- .github/workflows/build_esp32_s3.yml | 60 +++++++++++---- .github/workflows/build_nrf52.yml | 22 ++++-- .github/workflows/build_rpi2040.yml | 22 ++++-- .github/workflows/build_stm32.yml | 24 ++++-- 7 files changed, 185 insertions(+), 159 deletions(-) delete mode 100644 .github/actions/build-variant/action.yml diff --git a/.github/actions/build-variant/action.yml b/.github/actions/build-variant/action.yml deleted file mode 100644 index 0a96a0155a..0000000000 --- a/.github/actions/build-variant/action.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Setup Build Variant Composite Action -description: Variant build actions for Meshtastic Platform IO steps - -inputs: - board: - description: The board to build for - required: true - github_token: - description: GitHub token - required: true - build-script-path: - description: Path to the build script - required: true - remove-debug-flags: - description: A newline separated list of files to remove debug flags from - required: false - default: "" - ota-firmware-source: - description: The OTA firmware file to pull - required: false - default: "" - ota-firmware-target: - description: The target path to store the OTA firmware file - required: false - default: "" - artifact-paths: - description: A newline separated list of paths to store as artifacts - required: false - default: "" - include-web-ui: - description: Include the web UI in the build - required: false - default: "false" - -runs: - using: composite - steps: - - uses: actions/checkout@v4 - - - name: Build base - id: base - uses: ./.github/actions/setup-base - - - name: Pull web ui - if: ${{ inputs.include-web-ui == "true" }} - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: meshtastic/web - file: build.tar - target: build.tar - token: ${{ inputs.github_token }} - - - name: Unpack web ui - if: ${{ inputs.include-web-ui == "true" }} - shell: bash - run: | - tar -xf build.tar -C data/static - rm build.tar - - - name: Remove debug flags for release - shell: bash - if: ${{ inputs.remove-debug-flags != "" }} - run: | - for PATH in ${{ inputs.remove-debug-flags }}; do - sed -i '/DDEBUG_HEAP/d' ${PATH} - done - - - name: Build ${{ inputs.board }} - shell: bash - run: ${{ inputs.build-script-path }} ${{ inputs.board }} - - - name: Pull OTA Firmware - if: ${{ inputs.ota-firmware-source != "" && inputs.ota-firmware-target != "" }} - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: meshtastic/firmware-ota - file: ${{ inputs.ota-firmware-source }} - target: ${{ inputs.ota-firmware-target }} - token: ${{ inputs.github_token }} - - - name: Get release version string - shell: bash - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 - with: - name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip - overwrite: true - path: | - ${{ inputs.artifact-paths }} - - - name: Clean up resources - shell: bash - run: | - rm -rf . diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 8b7017fc93..4cbb4c7a42 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -11,21 +11,53 @@ jobs: build-esp32: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - name: Build base + id: base + uses: ./.github/actions/setup-base + + - name: Pull web ui + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: meshtastic/web + file: build.tar + target: build.tar + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Unpack web ui + run: | + tar -xf build.tar -C data/static + rm build.tar + + - name: Remove debug flags for release + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini + - name: Build ESP32 - id: build - uses: ./.github/actions/build-variant + run: bin/build-esp32.sh ${{ inputs.board }} + + - name: Pull OTA Firmware + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: meshtastic/firmware-ota + file: firmware.bin + target: release/bleota.bin + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get release version string + shell: bash + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - board: ${{ inputs.board }} - remove-debug-flags: | - ./arch/esp32/esp32.ini - ./arch/esp32/esp32s2.ini - ./arch/esp32/esp32s3.ini - ./arch/esp32/esp32c3.ini - build-script-path: bin/build-esp32.sh - ota-firmware-source: firmware.bin - ota-firmware-target: release/bleota.bin - artifact-paths: | + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + overwrite: true + path: | release/*.bin release/*.elf - include-web-ui: true diff --git a/.github/workflows/build_esp32_c3.yml b/.github/workflows/build_esp32_c3.yml index 249f6f1263..07727d7115 100644 --- a/.github/workflows/build_esp32_c3.yml +++ b/.github/workflows/build_esp32_c3.yml @@ -13,20 +13,51 @@ jobs: build-esp32-c3: runs-on: ubuntu-latest steps: - - name: Build ESP32-C3 - id: build - uses: ./.github/actions/build-variant + - uses: actions/checkout@v4 + - name: Build base + id: base + uses: ./.github/actions/setup-base + + - name: Pull web ui + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: meshtastic/web + file: build.tar + target: build.tar + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Unpack web ui + run: | + tar -xf build.tar -C data/static + rm build.tar + - name: Remove debug flags for release + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini + - name: Build ESP32 + run: bin/build-esp32.sh ${{ inputs.board }} + + - name: Pull OTA Firmware + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: meshtastic/firmware-ota + file: firmware-c3.bin + target: release/bleota-c3.bin + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get release version string + shell: bash + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - board: ${{ inputs.board }} - remove-debug-flags: | - ./arch/esp32/esp32.ini - ./arch/esp32/esp32s2.ini - ./arch/esp32/esp32s3.ini - ./arch/esp32/esp32c3.ini - build-script-path: bin/build-esp32.sh - ota-firmware-source: firmware-c3.bin - ota-firmware-target: release/bleota-c3.bin - artifact-paths: | + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + overwrite: true + path: | release/*.bin release/*.elf diff --git a/.github/workflows/build_esp32_s3.yml b/.github/workflows/build_esp32_s3.yml index 7df3e5737b..10773833e6 100644 --- a/.github/workflows/build_esp32_s3.yml +++ b/.github/workflows/build_esp32_s3.yml @@ -11,21 +11,51 @@ jobs: build-esp32-s3: runs-on: ubuntu-latest steps: - - name: Build ESP32-S3 - id: build - uses: ./.github/actions/build-variant + - uses: actions/checkout@v4 + - name: Build base + id: base + uses: ./.github/actions/setup-base + + - name: Pull web ui + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: meshtastic/web + file: build.tar + target: build.tar + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Unpack web ui + run: | + tar -xf build.tar -C data/static + rm build.tar + - name: Remove debug flags for release + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini + sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini + - name: Build ESP32 + run: bin/build-esp32.sh ${{ inputs.board }} + + - name: Pull OTA Firmware + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: meshtastic/firmware-ota + file: firmware-s3.bin + target: release/bleota-s3.bin + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get release version string + shell: bash + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - board: ${{ inputs.board }} - remove-debug-flags: | - ./arch/esp32/esp32.ini - ./arch/esp32/esp32s2.ini - ./arch/esp32/esp32s3.ini - ./arch/esp32/esp32c3.ini - build-script-path: bin/build-esp32.sh - ota-firmware-source: firmware-s3.bin - ota-firmware-target: release/bleota-s3.bin - artifact-paths: | + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + overwrite: true + path: | release/*.bin release/*.elf - include-web-ui: true diff --git a/.github/workflows/build_nrf52.yml b/.github/workflows/build_nrf52.yml index 85d3635cd1..ac509a096a 100644 --- a/.github/workflows/build_nrf52.yml +++ b/.github/workflows/build_nrf52.yml @@ -11,14 +11,24 @@ jobs: build-nrf52: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - name: Build base + id: base + uses: ./.github/actions/setup-base + - name: Build NRF52 - id: build - uses: ./.github/actions/build-variant + run: bin/build-nrf52.sh ${{ inputs.board }} + + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - board: ${{ inputs.board }} - build-script-path: bin/build-nrf52.sh - artifact-paths: | + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + overwrite: true + path: | release/*.hex release/*.uf2 release/*.elf diff --git a/.github/workflows/build_rpi2040.yml b/.github/workflows/build_rpi2040.yml index d3e19f8fd3..6e258fe2aa 100644 --- a/.github/workflows/build_rpi2040.yml +++ b/.github/workflows/build_rpi2040.yml @@ -11,13 +11,23 @@ jobs: build-rpi2040: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - name: Build base + id: base + uses: ./.github/actions/setup-base + - name: Build Raspberry Pi 2040 - id: build - uses: ./.github/actions/build-variant + run: ./bin/build-rpi2040.sh ${{ inputs.board }} + + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - board: ${{ inputs.board }} - build-script-path: bin/build-rpi2040.sh - artifact-paths: | + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + overwrite: true + path: | release/*.uf2 release/*.elf diff --git a/.github/workflows/build_stm32.yml b/.github/workflows/build_stm32.yml index 9252087df3..d13c52c8a1 100644 --- a/.github/workflows/build_stm32.yml +++ b/.github/workflows/build_stm32.yml @@ -11,13 +11,23 @@ jobs: build-stm32: runs-on: ubuntu-latest steps: - - name: Build Raspberry Pi 2040 - id: build - uses: ./.github/actions/build-variant + - uses: actions/checkout@v4 + - name: Build base + id: base + uses: ./.github/actions/setup-base + + - name: Build STM32 + run: bin/build-stm32.sh ${{ inputs.board }} + + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - board: ${{ inputs.board }} - build-script-path: bin/build-stm32.sh - artifact-paths: | + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + overwrite: true + path: | release/*.hex release/*.bin From cbaee64ce1eae97a022e9c80bf037c18c8efc90e Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sun, 22 Sep 2024 23:00:32 +0800 Subject: [PATCH 246/322] Make Ublox code more readable (#4727) * Simplify Ublox code Ublox comes in a myriad of versions and settings. Presently our configuration code does a lot of branching based on versions being or not being present. This patch adds version detection earlier in the piece and branches on the set gnssModel instead to create separate setup methods for Ublox 6, Ublox 7/8/9, and Ublox10. Additionally, adds a macro to make the code much shorter and more readable. * Make trunk happy * Make trunk happy --------- Co-authored-by: Ben Meadors --- src/gps/GPS.cpp | 400 ++++++++++++++++++------------------------------ src/gps/GPS.h | 8 +- src/gps/ubx.h | 7 + 3 files changed, 159 insertions(+), 256 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index cd357c8cfa..e4a945acce 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -526,268 +526,144 @@ bool GPS::setup() delay(250); _serial_gps->write("$PAIR513*3D\r\n"); // save configuration + } else if (gnssModel == GNSS_MODEL_UBLOX6) { + clearBuffer(); + SEND_UBX_PACKET(0x06, 0x02, _message_DISABLE_TXT_INFO, "Unable to disable text info messages.\n", 500); + SEND_UBX_PACKET(0x06, 0x39, _message_JAM_6_7, "Unable to enable interference resistance.\n", 500); + SEND_UBX_PACKET(0x06, 0x23, _message_NAVX5, "Unable to configure NAVX5 settings.\n", 500); + + // Turn off unwanted NMEA messages, set update rate + SEND_UBX_PACKET(0x06, 0x08, _message_1HZ, "Unable to set GPS update rate.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_GLL, "Unable to disable NMEA GLL.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_GSA, "Unable to Enable NMEA GSA.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_GSV, "Unable to disable NMEA GSV.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_VTG, "Unable to disable NMEA VTG.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_RMC, "Unable to enable NMEA RMC.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_GGA, "Unable to enable NMEA GGA.\n", 500); - } else if (gnssModel == GNSS_MODEL_UBLOX) { - // Configure GNSS system to GPS+SBAS+GLONASS (Module may restart after this command) - // We need set it because by default it is GPS only, and we want to use GLONASS too - // Also we need SBAS for better accuracy and extra features - // ToDo: Dynamic configure GNSS systems depending of LoRa region - - if (strncmp(info.hwVersion, "000A0000", 8) != 0) { - if (strncmp(info.hwVersion, "00040007", 8) != 0) { - // The original ublox Neo-6 is GPS only and doesn't support the UBX-CFG-GNSS message - // Max7 seems to only support GPS *or* GLONASS - // Neo-7 is supposed to support GPS *and* GLONASS but NAKs the CFG-GNSS command to do it - // So treat all the u-blox 7 series as GPS only - // M8 can support 3 constallations at once so turn on GPS, GLONASS and Galileo (or BeiDou) - - if (strncmp(info.hwVersion, "00070000", 8) == 0) { - LOG_DEBUG("Setting GPS+SBAS\n"); - msglen = makeUBXPacket(0x06, 0x3e, sizeof(_message_GNSS_7), _message_GNSS_7); - _serial_gps->write(UBXscratch, msglen); - } else { - msglen = makeUBXPacket(0x06, 0x3e, sizeof(_message_GNSS_8), _message_GNSS_8); - _serial_gps->write(UBXscratch, msglen); - } - - if (getACK(0x06, 0x3e, 800) == GNSS_RESPONSE_NAK) { - // It's not critical if the module doesn't acknowledge this configuration. - LOG_INFO("Unable to reconfigure GNSS - defaults maintained. Is this module GPS-only?\n"); - } else { - if (strncmp(info.hwVersion, "00070000", 8) == 0) { - LOG_INFO("GNSS configured for GPS+SBAS. Pause for 0.75s before sending next command.\n"); - } else { - LOG_INFO( - "GNSS configured for GPS+SBAS+GLONASS+Galileo. Pause for 0.75s before sending next command.\n"); - } - // Documentation say, we need wait atleast 0.5s after reconfiguration of GNSS module, before sending next - // commands for the M8 it tends to be more... 1 sec should be enough ;>) - delay(1000); - } - } - // Disable Text Info messages - msglen = makeUBXPacket(0x06, 0x02, sizeof(_message_DISABLE_TXT_INFO), _message_DISABLE_TXT_INFO); - clearBuffer(); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x02, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to disable text info messages.\n"); - } - // ToDo add M10 tests for below - if (strncmp(info.hwVersion, "00080000", 8) == 0) { - msglen = makeUBXPacket(0x06, 0x39, sizeof(_message_JAM_8), _message_JAM_8); - clearBuffer(); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x39, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable interference resistance.\n"); - } - - msglen = makeUBXPacket(0x06, 0x23, sizeof(_message_NAVX5_8), _message_NAVX5_8); - clearBuffer(); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x23, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to configure NAVX5_8 settings.\n"); - } - } else { - msglen = makeUBXPacket(0x06, 0x39, sizeof(_message_JAM_6_7), _message_JAM_6_7); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x39, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable interference resistance.\n"); - } - - msglen = makeUBXPacket(0x06, 0x23, sizeof(_message_NAVX5), _message_NAVX5); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x23, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to configure NAVX5 settings.\n"); - } - } - // Turn off unwanted NMEA messages, set update rate - - msglen = makeUBXPacket(0x06, 0x08, sizeof(_message_1HZ), _message_1HZ); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x08, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to set GPS update rate.\n"); - } - - msglen = makeUBXPacket(0x06, 0x01, sizeof(_message_GLL), _message_GLL); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x01, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to disable NMEA GLL.\n"); - } - - msglen = makeUBXPacket(0x06, 0x01, sizeof(_message_GSA), _message_GSA); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x01, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to Enable NMEA GSA.\n"); - } + clearBuffer(); + SEND_UBX_PACKET(0x06, 0x11, _message_CFG_RXM_ECO, "Unable to enable powersaving ECO mode for Neo-6.\n", 500); + SEND_UBX_PACKET(0x06, 0x3B, _message_CFG_PM2, "Unable to enable powersaving details for GPS.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_AID, "Unable to disable UBX-AID.\n", 500); - msglen = makeUBXPacket(0x06, 0x01, sizeof(_message_GSV), _message_GSV); + msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE); + _serial_gps->write(UBXscratch, msglen); + if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) { + LOG_WARN("Unable to save GNSS module configuration.\n"); + } else { + LOG_INFO("GNSS module configuration saved!\n"); + } + } else if (gnssModel == GNSS_MODEL_UBLOX7 || gnssModel == GNSS_MODEL_UBLOX8 || gnssModel == GNSS_MODEL_UBLOX9) { + if (gnssModel == GNSS_MODEL_UBLOX7) { + LOG_DEBUG("Setting GPS+SBAS\n"); + msglen = makeUBXPacket(0x06, 0x3e, sizeof(_message_GNSS_7), _message_GNSS_7); _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x01, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to disable NMEA GSV.\n"); - } - - msglen = makeUBXPacket(0x06, 0x01, sizeof(_message_VTG), _message_VTG); + } else { // 8,9 + msglen = makeUBXPacket(0x06, 0x3e, sizeof(_message_GNSS_8), _message_GNSS_8); _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x01, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to disable NMEA VTG.\n"); - } + } - msglen = makeUBXPacket(0x06, 0x01, sizeof(_message_RMC), _message_RMC); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x01, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable NMEA RMC.\n"); + if (getACK(0x06, 0x3e, 800) == GNSS_RESPONSE_NAK) { + // It's not critical if the module doesn't acknowledge this configuration. + LOG_INFO("Unable to reconfigure GNSS - defaults maintained. Is this module GPS-only?\n"); + } else { + if (gnssModel == GNSS_MODEL_UBLOX7) { + LOG_INFO("GNSS configured for GPS+SBAS.\n"); + } else { // 8,9 + LOG_INFO("GNSS configured for GPS+SBAS+GLONASS+Galileo.\n"); } + // Documentation say, we need wait atleast 0.5s after reconfiguration of GNSS module, before sending next + // commands for the M8 it tends to be more... 1 sec should be enough ;>) + delay(1000); + } - msglen = makeUBXPacket(0x06, 0x01, sizeof(_message_GGA), _message_GGA); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x01, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable NMEA GGA.\n"); - } + // Disable Text Info messages //6,7,8,9 + clearBuffer(); + SEND_UBX_PACKET(0x06, 0x02, _message_DISABLE_TXT_INFO, "Unable to disable text info messages.\n", 500); - if (uBloxProtocolVersion >= 18) { - msglen = makeUBXPacket(0x06, 0x86, sizeof(_message_PMS), _message_PMS); - clearBuffer(); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x86, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable powersaving for GPS.\n"); - } - msglen = makeUBXPacket(0x06, 0x3B, sizeof(_message_CFG_PM2), _message_CFG_PM2); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x3B, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable powersaving details for GPS.\n"); - } - // For M8 we want to enable NMEA vserion 4.10 so we can see the additional sats. - if (strncmp(info.hwVersion, "00080000", 8) == 0) { - msglen = makeUBXPacket(0x06, 0x17, sizeof(_message_NMEA), _message_NMEA); - clearBuffer(); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x17, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable NMEA 4.10.\n"); - } - } - } else { - if (strncmp(info.hwVersion, "00040007", 8) == 0) { // This PSM mode is only for Neo-6 - msglen = makeUBXPacket(0x06, 0x11, 0x2, _message_CFG_RXM_ECO); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x11, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable powersaving ECO mode for Neo-6.\n"); - } - msglen = makeUBXPacket(0x06, 0x3B, sizeof(_message_CFG_PM2), _message_CFG_PM2); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x3B, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable powersaving details for GPS.\n"); - } - msglen = makeUBXPacket(0x06, 0x01, sizeof(_message_AID), _message_AID); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x01, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to disable UBX-AID.\n"); - } - } else { - msglen = makeUBXPacket(0x06, 0x11, 0x2, _message_CFG_RXM_PSM); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x11, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable powersaving mode for GPS.\n"); - } - - msglen = makeUBXPacket(0x06, 0x3B, sizeof(_message_CFG_PM2), _message_CFG_PM2); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x3B, 500) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable powersaving details for GPS.\n"); - } - } - } - } else { - // LOG_INFO("u-blox M10 hardware found.\n"); - delay(1000); - // First disable all NMEA messages in RAM layer - msglen = makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_DISABLE_NMEA_RAM), _message_VALSET_DISABLE_NMEA_RAM); - clearBuffer(); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to disable NMEA messages for M10 GPS RAM.\n"); - } - delay(250); - // Next disable unwanted NMEA messages in BBR layer - msglen = makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_DISABLE_NMEA_BBR), _message_VALSET_DISABLE_NMEA_BBR); + if (gnssModel == GNSS_MODEL_UBLOX8) { // 8 clearBuffer(); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to disable NMEA messages for M10 GPS BBR.\n"); - } - delay(250); - // Disable Info txt messages in RAM layer - msglen = - makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_DISABLE_TXT_INFO_RAM), _message_VALSET_DISABLE_TXT_INFO_RAM); + SEND_UBX_PACKET(0x06, 0x39, _message_JAM_8, "Unable to enable interference resistance.\n", 500); + clearBuffer(); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to disable Info messages for M10 GPS RAM.\n"); - } - delay(250); - // Next disable Info txt messages in BBR layer - msglen = - makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_DISABLE_TXT_INFO_BBR), _message_VALSET_DISABLE_TXT_INFO_BBR); + SEND_UBX_PACKET(0x06, 0x23, _message_NAVX5_8, "Unable to configure NAVX5_8 settings.\n", 500); + } else { // 6,7,9 + SEND_UBX_PACKET(0x06, 0x39, _message_JAM_6_7, "Unable to enable interference resistance.\n", 500); + SEND_UBX_PACKET(0x06, 0x23, _message_NAVX5, "Unable to configure NAVX5 settings.\n", 500); + } + // Turn off unwanted NMEA messages, set update rate + SEND_UBX_PACKET(0x06, 0x08, _message_1HZ, "Unable to set GPS update rate.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_GLL, "Unable to disable NMEA GLL.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_GSA, "Unable to Enable NMEA GSA.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_GSV, "Unable to disable NMEA GSV.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_VTG, "Unable to disable NMEA VTG.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_RMC, "Unable to enable NMEA RMC.\n", 500); + SEND_UBX_PACKET(0x06, 0x01, _message_GGA, "Unable to enable NMEA GGA.\n", 500); + + if (uBloxProtocolVersion >= 18) { clearBuffer(); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to disable Info messages for M10 GPS BBR.\n"); - } - // Do M10 configuration for Power Management. + SEND_UBX_PACKET(0x06, 0x86, _message_PMS, "Unable to enable powersaving for GPS.\n", 500); + SEND_UBX_PACKET(0x06, 0x3B, _message_CFG_PM2, "Unable to enable powersaving details for GPS.\n", 500); - msglen = makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_PM_RAM), _message_VALSET_PM_RAM); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable powersaving for M10 GPS RAM.\n"); - } - msglen = makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_PM_BBR), _message_VALSET_PM_BBR); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable powersaving for M10 GPS BBR.\n"); - } - - delay(250); - msglen = makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_ITFM_RAM), _message_VALSET_ITFM_RAM); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable Jamming detection M10 GPS RAM.\n"); - } - msglen = makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_ITFM_BBR), _message_VALSET_ITFM_BBR); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable Jamming detection M10 GPS BBR.\n"); + // For M8 we want to enable NMEA vserion 4.10 so we can see the additional sats. + if (gnssModel == GNSS_MODEL_UBLOX8) { + clearBuffer(); + SEND_UBX_PACKET(0x06, 0x17, _message_NMEA, "Unable to enable NMEA 4.10.\n", 500); } + } else { + SEND_UBX_PACKET(0x06, 0x11, _message_CFG_RXM_PSM, "Unable to enable powersaving mode for GPS.\n", 500); + SEND_UBX_PACKET(0x06, 0x3B, _message_CFG_PM2, "Unable to enable powersaving details for GPS.\n", 500); + } - // Here is where the init commands should go to do further M10 initialization. - delay(250); - msglen = makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_DISABLE_SBAS_RAM), _message_VALSET_DISABLE_SBAS_RAM); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to disable SBAS M10 GPS RAM.\n"); - } - delay(750); // will cause a receiver restart so wait a bit - msglen = makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_DISABLE_SBAS_BBR), _message_VALSET_DISABLE_SBAS_BBR); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to disable SBAS M10 GPS BBR.\n"); - } - delay(750); // will cause a receiver restart so wait a bit - // Done with initialization, Now enable wanted NMEA messages in BBR layer so they will survive a periodic sleep. - msglen = makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_ENABLE_NMEA_BBR), _message_VALSET_ENABLE_NMEA_BBR); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable messages for M10 GPS BBR.\n"); - } - delay(250); - // Next enable wanted NMEA messages in RAM layer - msglen = makeUBXPacket(0x06, 0x8A, sizeof(_message_VALSET_ENABLE_NMEA_RAM), _message_VALSET_ENABLE_NMEA_RAM); - _serial_gps->write(UBXscratch, msglen); - if (getACK(0x06, 0x8A, 300) != GNSS_RESPONSE_OK) { - LOG_WARN("Unable to enable messages for M10 GPS RAM.\n"); - } - // As the M10 has no flash, the best we can do to preserve the config is to set it in RAM and BBR. - // BBR will survive a restart, and power off for a while, but modules with small backup - // batteries or super caps will not retain the config for a long power off time. + msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE); + _serial_gps->write(UBXscratch, msglen); + if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) { + LOG_WARN("Unable to save GNSS module configuration.\n"); + } else { + LOG_INFO("GNSS module configuration saved!\n"); } + } else if (gnssModel == GNSS_MODEL_UBLOX10) { + delay(1000); + clearBuffer(); + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_NMEA_RAM, "Unable to disable NMEA messages in M10 RAM.\n", 300); + delay(750); + clearBuffer(); + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_NMEA_BBR, "Unable to disable NMEA messages in M10 BBR.\n", 300); + delay(750); + clearBuffer(); + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_TXT_INFO_RAM, + "Unable to disable Info messages for M10 GPS RAM.\n", 300); + delay(750); + // Next disable Info txt messages in BBR layer + clearBuffer(); + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_TXT_INFO_BBR, + "Unable to disable Info messages for M10 GPS BBR.\n", 300); + delay(750); + // Do M10 configuration for Power Management. + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_PM_RAM, "Unable to enable powersaving for M10 GPS RAM.\n", 300); + delay(750); + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_PM_BBR, "Unable to enable powersaving for M10 GPS BBR.\n", 300); + delay(750); + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_ITFM_RAM, "Unable to enable Jamming detection M10 GPS RAM.\n", 300); + delay(750); + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_ITFM_BBR, "Unable to enable Jamming detection M10 GPS BBR.\n", 300); + delay(750); + // Here is where the init commands should go to do further M10 initialization. + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_SBAS_RAM, "Unable to disable SBAS M10 GPS RAM.\n", 300); + delay(750); // will cause a receiver restart so wait a bit + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_SBAS_BBR, "Unable to disable SBAS M10 GPS BBR.\n", 300); + delay(750); // will cause a receiver restart so wait a bit + + // Done with initialization, Now enable wanted NMEA messages in BBR layer so they will survive a periodic sleep. + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_ENABLE_NMEA_BBR, "Unable to enable messages for M10 GPS BBR.\n", 300); + delay(750); + // Next enable wanted NMEA messages in RAM layer + SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_ENABLE_NMEA_RAM, "Unable to enable messages for M10 GPS RAM.\n", 500); + delay(750); + + // As the M10 has no flash, the best we can do to preserve the config is to set it in RAM and BBR. + // BBR will survive a restart, and power off for a while, but modules with small backup + // batteries or super caps will not retain the config for a long power off time. msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE); _serial_gps->write(UBXscratch, msglen); if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) { @@ -950,7 +826,8 @@ void GPS::setPowerPMU(bool on) void GPS::setPowerUBLOX(bool on, uint32_t sleepMs) { // Abort: if not UBLOX hardware - if (gnssModel != GNSS_MODEL_UBLOX) + if (!(gnssModel == GNSS_MODEL_UBLOX6 || gnssModel == GNSS_MODEL_UBLOX7 || gnssModel == GNSS_MODEL_UBLOX8 || + gnssModel == GNSS_MODEL_UBLOX9 || gnssModel == GNSS_MODEL_UBLOX10)) return; // If waking @@ -973,7 +850,7 @@ void GPS::setPowerUBLOX(bool on, uint32_t sleepMs) } // Determine hardware version - if (strncmp(info.hwVersion, "000A0000", 8) != 0) { + if (gnssModel == GNSS_MODEL_UBLOX10) { // Encode the sleep time in millis into the packet for (int i = 0; i < 4; i++) gps->_message_PMREQ[0 + i] = sleepMs >> (i * 8); @@ -1032,7 +909,9 @@ void GPS::down() // Check whether the GPS hardware is capable of GPS_SOFTSLEEP // If not, fallback to GPS_HARDSLEEP instead bool softsleepSupported = false; - if (gnssModel == GNSS_MODEL_UBLOX) // U-blox is supported via PMREQ + // U-blox is supported via PMREQ + if (gnssModel == GNSS_MODEL_UBLOX6 || gnssModel == GNSS_MODEL_UBLOX7 || gnssModel == GNSS_MODEL_UBLOX8 || + gnssModel == GNSS_MODEL_UBLOX9 || gnssModel == GNSS_MODEL_UBLOX10) softsleepSupported = true; #ifdef PIN_GPS_STANDBY // L76B, L76K and clones have a standby pin softsleepSupported = true; @@ -1107,7 +986,9 @@ int32_t GPS::runOnce() // if we have received valid NMEA claim we are connected setConnected(); } else { - if ((config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) && (gnssModel == GNSS_MODEL_UBLOX)) { + if ((config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) && + (gnssModel == GNSS_MODEL_UBLOX6 || gnssModel == GNSS_MODEL_UBLOX7 || gnssModel == GNSS_MODEL_UBLOX8 || + gnssModel == GNSS_MODEL_UBLOX9 || gnssModel == GNSS_MODEL_UBLOX10)) { // reset the GPS on next bootup if (devicestate.did_gps_reset && scheduling.elapsedSearchMs() > 60 * 1000UL && !hasFlow()) { LOG_DEBUG("GPS is not communicating, trying factory reset on next bootup.\n"); @@ -1336,9 +1217,9 @@ GnssModel_t GPS::probe(int serialSpeed) strncpy((char *)buffer, &(info.extension[i][4]), sizeof(buffer)); // LOG_DEBUG("GetModel:%s\n", (char *)buffer); if (strlen((char *)buffer)) { - LOG_INFO("UBlox GNSS probe succeeded, using UBlox %s GNSS Module\n", (char *)buffer); + LOG_INFO("%s detected, using GNSS_MODEL_UBLOX\n", (char *)buffer); } else { - LOG_INFO("UBlox GNSS probe succeeded, using UBlox GNSS Module\n"); + LOG_INFO("Generic Ublox detected, using GNSS_MODEL_UBLOX\n"); } } else if (!strncmp(info.extension[i], "PROTVER", 7)) { char *ptr = nullptr; @@ -1353,9 +1234,20 @@ GnssModel_t GPS::probe(int serialSpeed) } } } + if (strncmp(info.hwVersion, "00040007", 8) == 0) { + return GNSS_MODEL_UBLOX6; + } else if (strncmp(info.hwVersion, "00070000", 8) == 0) { + return GNSS_MODEL_UBLOX7; + } else if (strncmp(info.hwVersion, "00080000", 8) == 0) { + return GNSS_MODEL_UBLOX8; + } else if (strncmp(info.hwVersion, "00190000", 8) == 0) { + return GNSS_MODEL_UBLOX9; + } else if (strncmp(info.hwVersion, "000A0000", 8) == 0) { + return GNSS_MODEL_UBLOX10; + } } - return GNSS_MODEL_UBLOX; + return GNSS_MODEL_UNKNOWN; } GPS *GPS::createGps() diff --git a/src/gps/GPS.h b/src/gps/GPS.h index 3423edb686..48aecc8b9d 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -26,7 +26,11 @@ struct uBloxGnssModelInfo { typedef enum { GNSS_MODEL_ATGM336H, GNSS_MODEL_MTK, - GNSS_MODEL_UBLOX, + GNSS_MODEL_UBLOX6, + GNSS_MODEL_UBLOX7, + GNSS_MODEL_UBLOX8, + GNSS_MODEL_UBLOX9, + GNSS_MODEL_UBLOX10, GNSS_MODEL_UC6580, GNSS_MODEL_UNKNOWN, GNSS_MODEL_MTK_L76B, @@ -310,4 +314,4 @@ class GPS : private concurrency::OSThread }; extern GPS *gps; -#endif // Exclude GPS +#endif // Exclude GPS \ No newline at end of file diff --git a/src/gps/ubx.h b/src/gps/ubx.h index 0852c331d0..64e45f1602 100644 --- a/src/gps/ubx.h +++ b/src/gps/ubx.h @@ -1,3 +1,10 @@ +#define SEND_UBX_PACKET(TYPE, ID, DATA, ERRMSG, TIMEOUT) \ + msglen = makeUBXPacket(TYPE, ID, sizeof(DATA), DATA); \ + _serial_gps->write(UBXscratch, msglen); \ + if (getACK(TYPE, ID, TIMEOUT) != GNSS_RESPONSE_OK) { \ + LOG_WARN(#ERRMSG); \ + } + // Power Management uint8_t GPS::_message_PMREQ[] PROGMEM = { From fe41abad73ce6b0d643e24f6e9796c7aaa70aa80 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 22 Sep 2024 16:09:46 -0500 Subject: [PATCH 247/322] Consider the LoRa header when checking packet length --- src/mesh/RadioInterface.h | 1 + src/mesh/Router.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesh/RadioInterface.h b/src/mesh/RadioInterface.h index f1016e3d87..d0d20926c8 100644 --- a/src/mesh/RadioInterface.h +++ b/src/mesh/RadioInterface.h @@ -10,6 +10,7 @@ #define MAX_TX_QUEUE 16 // max number of packets which can be waiting for transmission #define MAX_RHPACKETLEN 256 +#define LORA_HEADER_LENGTH 16 #define PACKET_FLAGS_HOP_LIMIT_MASK 0x07 #define PACKET_FLAGS_WANT_ACK_MASK 0x08 diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 3cf30519b5..a6b9467611 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -475,7 +475,7 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p) } } */ - if (numbytes > MAX_RHPACKETLEN) + if (numbytes + LORA_HEADER_LENGTH > MAX_RHPACKETLEN) return meshtastic_Routing_Error_TOO_LARGE; // printBytes("plaintext", bytes, numbytes); @@ -499,7 +499,7 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p) p->decoded.portnum != meshtastic_PortNum_TRACEROUTE_APP && p->decoded.portnum != meshtastic_PortNum_NODEINFO_APP && p->decoded.portnum != meshtastic_PortNum_ROUTING_APP && p->decoded.portnum != meshtastic_PortNum_POSITION_APP) { LOG_DEBUG("Using PKI!\n"); - if (numbytes + 12 > MAX_RHPACKETLEN) + if (numbytes + LORA_HEADER_LENGTH + 12 > MAX_RHPACKETLEN) return meshtastic_Routing_Error_TOO_LARGE; if (p->pki_encrypted && !memfll(p->public_key.bytes, 0, 32) && memcmp(p->public_key.bytes, node->user.public_key.bytes, 32) != 0) { From 2cd41d9f152d1674228388d3bbd3ccae78b3cdc9 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Mon, 23 Sep 2024 18:22:06 +0800 Subject: [PATCH 248/322] Minor fix (#4666) * Minor fixes It turns out setting a map value with the index notation causes an lookup that can be avoided with emplace. Apply this to one line in the StoreForward module. Fix also Cppcheck-determined highly minor performance increase by passing gpiochipname as a const reference :) The amount of cycles used on this laptop while learning about these callouts from cppcheck is unlikely to ever be more than the cycles saved by the fixes ;) * Update PortduinoGlue.cpp --- src/modules/esp32/StoreForwardModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/esp32/StoreForwardModule.cpp b/src/modules/esp32/StoreForwardModule.cpp index c696d342ac..db09a0bfd3 100644 --- a/src/modules/esp32/StoreForwardModule.cpp +++ b/src/modules/esp32/StoreForwardModule.cpp @@ -127,7 +127,7 @@ uint32_t StoreForwardModule::getNumAvailablePackets(NodeNum dest, uint32_t last_ { uint32_t count = 0; if (lastRequest.find(dest) == lastRequest.end()) { - lastRequest[dest] = 0; + lastRequest.emplace(dest, 0); } for (uint32_t i = lastRequest[dest]; i < this->packetHistoryTotalCount; i++) { if (this->packetHistory[i].time && (this->packetHistory[i].time > last_time)) { From 7b84a21b5515dde5d2aecda28734292e496821a0 Mon Sep 17 00:00:00 2001 From: Jason Murray <15822260+scruplelesswizard@users.noreply.github.com> Date: Mon, 23 Sep 2024 05:34:19 -0700 Subject: [PATCH 249/322] Revert "Update classes on protobufs update" (#4824) * Revert "Update classes on protobufs update" * remove quotes to fix trunk. --------- Co-authored-by: Tom Fifield --- .github/workflows/update_protobufs.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index eb1ca3648d..7ce767370c 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -1,10 +1,5 @@ name: Update protobufs and regenerate classes -on: - pull_request: - branches: - - master - paths: - - protobufs/** +on: workflow_dispatch jobs: update-protobufs: @@ -16,6 +11,10 @@ jobs: with: submodules: true + - name: Update submodule + run: | + git submodule update --remote protobufs + - name: Download nanopb run: | wget https://jpa.kapsi.fi/nanopb/download/nanopb-0.4.8-linux-x86.tar.gz @@ -26,11 +25,10 @@ jobs: run: | ./bin/regen-protos.sh - - name: Commit changes - uses: EndBug/add-and-commit@v9 + - name: Create pull request + uses: peter-evans/create-pull-request@v7 with: - add: src/mesh - author_name: CI Bot - author_email: meshtastic-ci-bot@users.noreply.github.com - default_author: github_actor - message: Update classes from protobufs + title: Update protobufs and classes + add-paths: | + protobufs + src/mesh From db2f2dd44d7b45a601e52e5a8d6be794bd0b5a73 Mon Sep 17 00:00:00 2001 From: Todd Herbert Date: Tue, 17 Sep 2024 22:12:12 +1200 Subject: [PATCH 250/322] Implement optional second I2C bus for NRF52840 Enabled at compile-time if WIRE_INFERFACES_COUNT defined as 2 --- src/detect/ScanI2CTwoWire.cpp | 6 +++--- src/gps/RTC.cpp | 8 ++++---- src/input/cardKbI2cImpl.cpp | 2 +- src/input/kbI2cBase.cpp | 2 +- src/main.cpp | 4 ++++ 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 4ccea9e434..95fcc3c5d6 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -162,13 +162,13 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) Melopero_RV3028 rtc; #endif -#ifdef I2C_SDA1 +#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) if (port == I2CPort::WIRE1) { i2cBus = &Wire1; } else { #endif i2cBus = &Wire; -#ifdef I2C_SDA1 +#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) } #endif @@ -423,7 +423,7 @@ TwoWire *ScanI2CTwoWire::fetchI2CBus(ScanI2C::DeviceAddress address) const if (address.port == ScanI2C::I2CPort::WIRE) { return &Wire; } else { -#ifdef I2C_SDA1 +#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) return &Wire1; #else return &Wire; diff --git a/src/gps/RTC.cpp b/src/gps/RTC.cpp index 7282842425..98dea4674e 100644 --- a/src/gps/RTC.cpp +++ b/src/gps/RTC.cpp @@ -29,7 +29,7 @@ void readFromRTC() if (rtc_found.address == RV3028_RTC) { uint32_t now = millis(); Melopero_RV3028 rtc; -#ifdef I2C_SDA1 +#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) rtc.initI2C(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire); #else rtc.initI2C(); @@ -58,7 +58,7 @@ void readFromRTC() uint32_t now = millis(); PCF8563_Class rtc; -#ifdef I2C_SDA1 +#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) rtc.begin(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire); #else rtc.begin(); @@ -150,7 +150,7 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate) #ifdef RV3028_RTC if (rtc_found.address == RV3028_RTC) { Melopero_RV3028 rtc; -#ifdef I2C_SDA1 +#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) rtc.initI2C(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire); #else rtc.initI2C(); @@ -164,7 +164,7 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate) if (rtc_found.address == PCF8563_RTC) { PCF8563_Class rtc; -#ifdef I2C_SDA1 +#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) rtc.begin(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire); #else rtc.begin(); diff --git a/src/input/cardKbI2cImpl.cpp b/src/input/cardKbI2cImpl.cpp index 8aaebcb45a..1f7fd284d7 100644 --- a/src/input/cardKbI2cImpl.cpp +++ b/src/input/cardKbI2cImpl.cpp @@ -16,7 +16,7 @@ void CardKbI2cImpl::init() uint8_t i2caddr_asize = 3; auto i2cScanner = std::unique_ptr(new ScanI2CTwoWire()); -#if defined(I2C_SDA1) +#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) i2cScanner->scanPort(ScanI2C::I2CPort::WIRE1, i2caddr_scan, i2caddr_asize); #endif i2cScanner->scanPort(ScanI2C::I2CPort::WIRE, i2caddr_scan, i2caddr_asize); diff --git a/src/input/kbI2cBase.cpp b/src/input/kbI2cBase.cpp index 2692fc80dc..a25a85d824 100644 --- a/src/input/kbI2cBase.cpp +++ b/src/input/kbI2cBase.cpp @@ -33,7 +33,7 @@ int32_t KbI2cBase::runOnce() if (!i2cBus) { switch (cardkb_found.port) { case ScanI2C::WIRE1: -#ifdef I2C_SDA1 +#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) LOG_DEBUG("Using I2C Bus 1 (the second one)\n"); i2cBus = &Wire1; if (cardkb_found.address == BBQ10_KB_ADDR) { diff --git a/src/main.cpp b/src/main.cpp index 4158c1b2e4..d008715c03 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -381,6 +381,8 @@ void setup() Wire1.begin(); #elif defined(I2C_SDA1) && !defined(ARCH_RP2040) Wire1.begin(I2C_SDA1, I2C_SCL1); +#elif defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2) + Wire1.begin(); #endif #if defined(I2C_SDA) && defined(ARCH_RP2040) @@ -448,6 +450,8 @@ void setup() #elif defined(I2C_SDA1) && !defined(ARCH_RP2040) Wire1.begin(I2C_SDA1, I2C_SCL1); i2cScanner->scanPort(ScanI2C::I2CPort::WIRE1); +#elif defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2) + i2cScanner->scanPort(ScanI2C::I2CPort::WIRE1); #endif #if defined(I2C_SDA) && defined(ARCH_RP2040) From 19c777dde67c00f264453855b2edacf9669ce5f8 Mon Sep 17 00:00:00 2001 From: Todd Herbert Date: Tue, 17 Sep 2024 22:17:53 +1200 Subject: [PATCH 251/322] Add I2C bus to Heltec T114 header pins SDA: P0.13 SCL: P0.16 Uses bus 1, leaving bus 0 routed to the unpopulated footprint for the RTC (general future-proofing) --- variants/heltec_mesh_node_t114/variant.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/variants/heltec_mesh_node_t114/variant.h b/variants/heltec_mesh_node_t114/variant.h index 454e669313..6a7c85b92d 100644 --- a/variants/heltec_mesh_node_t114/variant.h +++ b/variants/heltec_mesh_node_t114/variant.h @@ -92,13 +92,22 @@ No longer populated on PCB #define PIN_SERIAL2_TX (0 + 10) // #define PIN_SERIAL2_EN (0 + 17) -/** - Wire Interfaces - */ -#define WIRE_INTERFACES_COUNT 1 +/* + * I2C + */ + +#define WIRE_INTERFACES_COUNT 2 + +// I2C bus 0 +// Routed to footprint for PCF8563TS RTC +// Not populated on T114 V1, maybe in future? +#define PIN_WIRE_SDA (0 + 26) // P0.26 +#define PIN_WIRE_SCL (0 + 27) // P0.27 -#define PIN_WIRE_SDA (26) -#define PIN_WIRE_SCL (27) +// I2C bus 1 +// Available on header pins, for general use +#define PIN_WIRE1_SDA (0 + 13) // P0.13 +#define PIN_WIRE1_SCL (0 + 16) // P0.16 // QSPI Pins #define PIN_QSPI_SCK (32 + 14) From cceb2db70737b631bb98b725686ae66e2c6e0d22 Mon Sep 17 00:00:00 2001 From: Todd Herbert Date: Wed, 18 Sep 2024 03:28:23 +1200 Subject: [PATCH 252/322] Tidier macros --- src/configuration.h | 10 ++++++++++ src/detect/ScanI2CTwoWire.cpp | 6 +++--- src/gps/RTC.cpp | 8 ++++---- src/input/cardKbI2cImpl.cpp | 2 +- src/input/kbI2cBase.cpp | 2 +- src/main.cpp | 2 +- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index 213f7f632e..3976a105de 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -210,6 +210,16 @@ along with this program. If not, see . #define MINIMUM_SAFE_FREE_HEAP 1500 #endif +#ifndef WIRE_INTERFACES_COUNT +// Officially an NRF52 macro +// Repurposed cross-platform to identify devices using Wire1 +#if defined(I2C_SDA1) || defined(PIN_WIRE_SDA) +#define WIRE_INTERFACES_COUNT 2 +#elif HAS_WIRE +#define WIRE_INTERFACES_COUNT 1 +#endif +#endif + /* Step #3: mop up with disabled values for HAS_ options not handled by the above two */ #ifndef HAS_WIFI diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 95fcc3c5d6..eb1bae31a2 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -162,13 +162,13 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) Melopero_RV3028 rtc; #endif -#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) +#if WIRE_INTERFACES_COUNT == 2 if (port == I2CPort::WIRE1) { i2cBus = &Wire1; } else { #endif i2cBus = &Wire; -#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) +#if WIRE_INTERFACES_COUNT == 2 } #endif @@ -423,7 +423,7 @@ TwoWire *ScanI2CTwoWire::fetchI2CBus(ScanI2C::DeviceAddress address) const if (address.port == ScanI2C::I2CPort::WIRE) { return &Wire; } else { -#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) +#if WIRE_INTERFACES_COUNT == 2 return &Wire1; #else return &Wire; diff --git a/src/gps/RTC.cpp b/src/gps/RTC.cpp index 98dea4674e..b6cab5a6e7 100644 --- a/src/gps/RTC.cpp +++ b/src/gps/RTC.cpp @@ -29,7 +29,7 @@ void readFromRTC() if (rtc_found.address == RV3028_RTC) { uint32_t now = millis(); Melopero_RV3028 rtc; -#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) +#if WIRE_INTERFACES_COUNT == 2 rtc.initI2C(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire); #else rtc.initI2C(); @@ -58,7 +58,7 @@ void readFromRTC() uint32_t now = millis(); PCF8563_Class rtc; -#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) +#if WIRE_INTERFACES_COUNT == 2 rtc.begin(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire); #else rtc.begin(); @@ -150,7 +150,7 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate) #ifdef RV3028_RTC if (rtc_found.address == RV3028_RTC) { Melopero_RV3028 rtc; -#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) +#if WIRE_INTERFACES_COUNT == 2 rtc.initI2C(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire); #else rtc.initI2C(); @@ -164,7 +164,7 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate) if (rtc_found.address == PCF8563_RTC) { PCF8563_Class rtc; -#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) +#if WIRE_INTERFACES_COUNT == 2 rtc.begin(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire); #else rtc.begin(); diff --git a/src/input/cardKbI2cImpl.cpp b/src/input/cardKbI2cImpl.cpp index 1f7fd284d7..f1df6b1377 100644 --- a/src/input/cardKbI2cImpl.cpp +++ b/src/input/cardKbI2cImpl.cpp @@ -16,7 +16,7 @@ void CardKbI2cImpl::init() uint8_t i2caddr_asize = 3; auto i2cScanner = std::unique_ptr(new ScanI2CTwoWire()); -#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) +#if WIRE_INTERFACES_COUNT == 2 i2cScanner->scanPort(ScanI2C::I2CPort::WIRE1, i2caddr_scan, i2caddr_asize); #endif i2cScanner->scanPort(ScanI2C::I2CPort::WIRE, i2caddr_scan, i2caddr_asize); diff --git a/src/input/kbI2cBase.cpp b/src/input/kbI2cBase.cpp index a25a85d824..1d8154bcf4 100644 --- a/src/input/kbI2cBase.cpp +++ b/src/input/kbI2cBase.cpp @@ -33,7 +33,7 @@ int32_t KbI2cBase::runOnce() if (!i2cBus) { switch (cardkb_found.port) { case ScanI2C::WIRE1: -#if defined(I2C_SDA1) || (defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2)) +#if WIRE_INTERFACES_COUNT == 2 LOG_DEBUG("Using I2C Bus 1 (the second one)\n"); i2cBus = &Wire1; if (cardkb_found.address == BBQ10_KB_ADDR) { diff --git a/src/main.cpp b/src/main.cpp index d008715c03..f28a69144b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -381,7 +381,7 @@ void setup() Wire1.begin(); #elif defined(I2C_SDA1) && !defined(ARCH_RP2040) Wire1.begin(I2C_SDA1, I2C_SCL1); -#elif defined(NRF52840_XXAA) && (WIRE_INTERFACES_COUNT == 2) +#elif WIRE_INTERFACES_COUNT == 2 Wire1.begin(); #endif From 7dfe42defc64cba97a7ca356fee7ad942cb80ab8 Mon Sep 17 00:00:00 2001 From: Todd Herbert Date: Thu, 19 Sep 2024 02:49:24 +1200 Subject: [PATCH 253/322] Swap SDA and SCL SDA=P0.16, SCL=P0.13 --- variants/heltec_mesh_node_t114/variant.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/heltec_mesh_node_t114/variant.h b/variants/heltec_mesh_node_t114/variant.h index 6a7c85b92d..2cea3ef2fd 100644 --- a/variants/heltec_mesh_node_t114/variant.h +++ b/variants/heltec_mesh_node_t114/variant.h @@ -106,8 +106,8 @@ No longer populated on PCB // I2C bus 1 // Available on header pins, for general use -#define PIN_WIRE1_SDA (0 + 13) // P0.13 -#define PIN_WIRE1_SCL (0 + 16) // P0.16 +#define PIN_WIRE1_SDA (0 + 16) // P0.16 +#define PIN_WIRE1_SCL (0 + 13) // P0.13 // QSPI Pins #define PIN_QSPI_SCK (32 + 14) From 83bbffd6d87bd120011990408c17440a9d112842 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 23 Sep 2024 08:58:14 -0500 Subject: [PATCH 254/322] Refactor and consolidate time window logic (#4826) * Refactor and consolidate windowing logic * Trunk * Fixes * More * Fix braces and remove unused now variables. There was a brace in src/mesh/RadioLibInterface.cpp that was breaking compile on some architectures. Additionally, there were some brace errors in src/modules/Telemetry/AirQualityTelemetry.cpp src/modules/Telemetry/EnvironmentTelemetry.cpp src/mesh/wifi/WiFiAPClient.cpp Move throttle include in WifiAPClient.cpp to top. Add Default.h to sleep.cpp rest of files just remove unused now variables. * Remove a couple more meows --------- Co-authored-by: Tom Fifield --- src/Power.cpp | 4 +++- src/SerialConsole.cpp | 6 ++++-- src/gps/GPS.cpp | 19 +++++++++---------- src/gps/RTC.cpp | 3 ++- src/graphics/EInkDynamicDisplay.cpp | 9 ++++----- src/graphics/Screen.cpp | 8 +++++--- src/input/ExpressLRSFiveWay.cpp | 9 ++++----- src/input/ScanAndSelect.cpp | 5 +++-- src/input/SerialKeyboard.cpp | 3 ++- src/main.cpp | 3 ++- src/mesh/LR11x0Interface.cpp | 10 ++++++---- src/mesh/PacketHistory.cpp | 14 ++++++-------- src/mesh/PhoneAPI.cpp | 5 +++-- src/mesh/RadioLibInterface.cpp | 5 +++-- src/mesh/SX126xInterface.cpp | 12 +++++++----- src/mesh/SX128xInterface.cpp | 9 +++++---- src/mesh/StreamAPI.cpp | 6 +++--- src/mesh/Throttle.cpp | 8 ++++++++ src/mesh/Throttle.h | 1 + src/mesh/wifi/WiFiAPClient.cpp | 5 +++-- src/modules/CannedMessageModule.cpp | 3 ++- src/modules/DetectionSensorModule.cpp | 9 ++++++--- src/modules/NeighborInfoModule.cpp | 4 +++- src/modules/NodeInfoModule.cpp | 8 ++++---- src/modules/PositionModule.cpp | 2 +- src/modules/PowerStressModule.cpp | 3 ++- src/modules/RangeTestModule.cpp | 3 ++- src/modules/RemoteHardwareModule.cpp | 6 +++--- src/modules/SerialModule.cpp | 10 +++++----- src/modules/Telemetry/AirQualityTelemetry.cpp | 10 +++++----- .../Telemetry/EnvironmentTelemetry.cpp | 14 +++++++------- src/modules/Telemetry/PowerTelemetry.cpp | 14 +++++++------- .../Telemetry/Sensor/NAU7802Sensor.cpp | 3 ++- src/modules/esp32/StoreForwardModule.cpp | 6 +++++- src/mqtt/MQTT.cpp | 3 ++- src/sleep.cpp | 5 ++++- 36 files changed, 143 insertions(+), 104 deletions(-) diff --git a/src/Power.cpp b/src/Power.cpp index 61a6c987d4..b3a67abd5d 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -13,6 +13,7 @@ #include "power.h" #include "NodeDB.h" #include "PowerFSM.h" +#include "Throttle.h" #include "buzz/buzz.h" #include "configuration.h" #include "main.h" @@ -30,6 +31,7 @@ #if HAS_WIFI #include #endif + #endif #ifndef DELAY_FOREVER @@ -244,7 +246,7 @@ class AnalogBatteryLevel : public HasBatteryLevel config.power.adc_multiplier_override > 0 ? config.power.adc_multiplier_override : ADC_MULTIPLIER; // Do not call analogRead() often. const uint32_t min_read_interval = 5000; - if (millis() - last_read_time_ms > min_read_interval) { + if (!Throttle::isWithinTimespanMs(last_read_time_ms, min_read_interval)) { last_read_time_ms = millis(); uint32_t raw = 0; diff --git a/src/SerialConsole.cpp b/src/SerialConsole.cpp index b911e15dad..2c11337715 100644 --- a/src/SerialConsole.cpp +++ b/src/SerialConsole.cpp @@ -1,6 +1,8 @@ #include "SerialConsole.h" +#include "Default.h" #include "NodeDB.h" #include "PowerFSM.h" +#include "Throttle.h" #include "configuration.h" #include "time.h" @@ -47,7 +49,7 @@ SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port), con #if defined(ARCH_NRF52) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(ARCH_RP2040) time_t timeout = millis(); while (!Port) { - if ((millis() - timeout) < 5000) { + if (Throttle::isWithinTimespanMs(timeout, FIVE_SECONDS_MS)) { delay(100); } else { break; @@ -73,7 +75,7 @@ void SerialConsole::flush() bool SerialConsole::checkIsConnected() { uint32_t now = millis(); - return (now - lastContactMsec) < SERIAL_CONNECTION_TIMEOUT; + return Throttle::isWithinTimespanMs(lastContactMsec, SERIAL_CONNECTION_TIMEOUT); } /** diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index e4a945acce..a2730a918a 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -6,6 +6,7 @@ #include "NodeDB.h" #include "PowerMon.h" #include "RTC.h" +#include "Throttle.h" #include "main.h" // pmu_found #include "sleep.h" @@ -207,7 +208,7 @@ GPS_RESPONSE GPS::getACKCas(uint8_t class_id, uint8_t msg_id, uint32_t waitMilli // ACK-NACK| 0xBA | 0xCE | 0x04 | 0x00 | 0x05 | 0x00 | 0xXX | 0xXX | 0x00 | 0x00 | 0xXX | 0xXX | 0xXX | 0xXX | // ACK-ACK | 0xBA | 0xCE | 0x04 | 0x00 | 0x05 | 0x01 | 0xXX | 0xXX | 0x00 | 0x00 | 0xXX | 0xXX | 0xXX | 0xXX | - while (millis() - startTime < waitMillis) { + while (Throttle::isWithinTimespanMs(startTime, waitMillis)) { if (_serial_gps->available()) { buffer[bufferPos++] = _serial_gps->read(); @@ -276,7 +277,7 @@ GPS_RESPONSE GPS::getACK(uint8_t class_id, uint8_t msg_id, uint32_t waitMillis) buf[9] += buf[8]; } - while (millis() - startTime < waitMillis) { + while (Throttle::isWithinTimespanMs(startTime, waitMillis)) { if (ack > 9) { #ifdef GPS_DEBUG LOG_DEBUG("\n"); @@ -333,7 +334,7 @@ int GPS::getACK(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t uint32_t startTime = millis(); uint16_t needRead; - while (millis() - startTime < waitMillis) { + while (Throttle::isWithinTimespanMs(startTime, waitMillis)) { if (_serial_gps->available()) { int c = _serial_gps->read(); switch (ubxFrameCounter) { @@ -1421,16 +1422,15 @@ bool GPS::lookForTime() #ifdef GNSS_AIROHA uint8_t fix = reader.fixQuality(); - uint32_t now = millis(); if (fix > 0) { if (lastFixStartMsec > 0) { - if ((now - lastFixStartMsec) < GPS_FIX_HOLD_TIME) { + if (Throttle::isWithinTimespanMs(lastFixStartMsec, GPS_FIX_HOLD_TIME)) { return false; } else { clearBuffer(); } } else { - lastFixStartMsec = now; + lastFixStartMsec = millis(); return false; } } else { @@ -1474,16 +1474,15 @@ bool GPS::lookForLocation() #ifdef GNSS_AIROHA if ((config.position.gps_update_interval * 1000) >= (GPS_FIX_HOLD_TIME * 2)) { uint8_t fix = reader.fixQuality(); - uint32_t now = millis(); if (fix > 0) { if (lastFixStartMsec > 0) { - if ((now - lastFixStartMsec) < GPS_FIX_HOLD_TIME) { + if (Throttle::isWithinTimespanMs(lastFixStartMsec, GPS_FIX_HOLD_TIME)) { return false; } else { clearBuffer(); } } else { - lastFixStartMsec = now; + lastFixStartMsec = millis(); return false; } } else { @@ -1713,4 +1712,4 @@ void GPS::toggleGpsMode() enable(); } } -#endif // Exclude GPS +#endif // Exclude GPS \ No newline at end of file diff --git a/src/gps/RTC.cpp b/src/gps/RTC.cpp index b6cab5a6e7..d9ac56b743 100644 --- a/src/gps/RTC.cpp +++ b/src/gps/RTC.cpp @@ -2,6 +2,7 @@ #include "configuration.h" #include "detect/ScanI2C.h" #include "main.h" +#include #include #include @@ -127,7 +128,7 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate) } else if (q == RTCQualityGPS) { shouldSet = true; LOG_DEBUG("Reapplying GPS time: %ld secs\n", printableEpoch); - } else if (q == RTCQualityNTP && (now - lastSetMsec) > (12 * 60 * 60 * 1000UL)) { + } else if (q == RTCQualityNTP && !Throttle::isWithinTimespanMs(lastSetMsec, (12 * 60 * 60 * 1000UL))) { // Every 12 hrs we will slam in a new NTP or Phone GPS / NTP time, to correct for local RTC clock drift shouldSet = true; LOG_DEBUG("Reapplying external time to correct clock drift %ld secs\n", printableEpoch); diff --git a/src/graphics/EInkDynamicDisplay.cpp b/src/graphics/EInkDynamicDisplay.cpp index c31941a603..ca994b2c90 100644 --- a/src/graphics/EInkDynamicDisplay.cpp +++ b/src/graphics/EInkDynamicDisplay.cpp @@ -1,3 +1,4 @@ +#include "Throttle.h" #include "configuration.h" #if defined(USE_EINK) && defined(USE_EINK_DYNAMICDISPLAY) @@ -231,15 +232,13 @@ void EInkDynamicDisplay::checkForPromotion() // Is it too soon for another frame of this type? void EInkDynamicDisplay::checkRateLimiting() { - uint32_t now = millis(); - // Sanity check: millis() overflow - just let the update run.. - if (previousRunMs > now) + if (previousRunMs > millis()) return; // Skip update: too soon for BACKGROUND if (frameFlags == BACKGROUND) { - if (now - previousRunMs < EINK_LIMIT_RATE_BACKGROUND_SEC * 1000) { + if (Throttle::isWithinTimespanMs(previousRunMs, EINK_LIMIT_RATE_BACKGROUND_SEC * 1000)) { refresh = SKIPPED; reason = EXCEEDED_RATELIMIT_FULL; return; @@ -252,7 +251,7 @@ void EInkDynamicDisplay::checkRateLimiting() // Skip update: too soon for RESPONSIVE if (frameFlags & RESPONSIVE) { - if (now - previousRunMs < EINK_LIMIT_RATE_RESPONSIVE_SEC * 1000) { + if (Throttle::isWithinTimespanMs(previousRunMs, EINK_LIMIT_RATE_RESPONSIVE_SEC * 1000)) { refresh = SKIPPED; reason = EXCEEDED_RATELIMIT_FAST; LOG_DEBUG("refresh=SKIPPED, reason=EXCEEDED_RATELIMIT_FAST, frameFlags=0x%x\n", frameFlags); diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 5ccf22aa2b..a87df67d7a 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -22,6 +22,7 @@ along with this program. If not, see . #include "Screen.h" #include "../userPrefs.h" #include "PowerMon.h" +#include "Throttle.h" #include "configuration.h" #if HAS_SCREEN #include @@ -117,6 +118,7 @@ static bool heartbeat = false; #define SCREEN_HEIGHT display->getHeight() #include "graphics/ScreenFonts.h" +#include #define getStringCenteredX(s) ((SCREEN_WIDTH - display->getStringWidth(s)) / 2) @@ -1949,7 +1951,7 @@ int32_t Screen::runOnce() if (showingNormalScreen) { // standard screen loop handling here if (config.display.auto_screen_carousel_secs > 0 && - (millis() - lastScreenTransition) > (config.display.auto_screen_carousel_secs * 1000)) { + !Throttle::isWithinTimespanMs(lastScreenTransition, config.display.auto_screen_carousel_secs * 1000)) { // If an E-Ink display struggles with fast refresh, force carousel to use full refresh instead // Carousel is potentially a major source of E-Ink display wear @@ -2442,8 +2444,8 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 // Draw our hardware ID to assist with bluetooth pairing. Either prefix with Info or S&F Logo if (moduleConfig.store_forward.enabled) { #ifdef ARCH_ESP32 - if (millis() - storeForwardModule->lastHeartbeat > - (storeForwardModule->heartbeatInterval * 1200)) { // no heartbeat, overlap a bit + if (!Throttle::isWithinTimespanMs(storeForwardModule->lastHeartbeat, + (storeForwardModule->heartbeatInterval * 1200))) { // no heartbeat, overlap a bit #if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ defined(USE_ST7789) || defined(HX8357_CS)) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) diff --git a/src/input/ExpressLRSFiveWay.cpp b/src/input/ExpressLRSFiveWay.cpp index c444800ba2..af4433daea 100644 --- a/src/input/ExpressLRSFiveWay.cpp +++ b/src/input/ExpressLRSFiveWay.cpp @@ -1,5 +1,5 @@ - #include "ExpressLRSFiveWay.h" +#include "Throttle.h" #ifdef INPUTBROKER_EXPRESSLRSFIVEWAY_TYPE @@ -76,11 +76,10 @@ void ExpressLRSFiveWay::update(int *keyValue, bool *keyLongPressed) *keyValue = NO_PRESS; int newKey = readKey(); - uint32_t now = millis(); if (keyInProcess == NO_PRESS) { // New key down if (newKey != NO_PRESS) { - keyDownStart = now; + keyDownStart = millis(); // DBGLN("down=%u", newKey); } } else { @@ -88,7 +87,7 @@ void ExpressLRSFiveWay::update(int *keyValue, bool *keyLongPressed) if (newKey == NO_PRESS) { // DBGLN("up=%u", keyInProcess); if (!isLongPressed) { - if ((now - keyDownStart) > KEY_DEBOUNCE_MS) { + if (!Throttle::isWithinTimespanMs(keyDownStart, KEY_DEBOUNCE_MS)) { *keyValue = keyInProcess; *keyLongPressed = false; } @@ -101,7 +100,7 @@ void ExpressLRSFiveWay::update(int *keyValue, bool *keyLongPressed) } // else still pressing, waiting for long if not already signaled else if (!isLongPressed) { - if ((now - keyDownStart) > KEY_LONG_PRESS_MS) { + if (!Throttle::isWithinTimespanMs(keyDownStart, KEY_LONG_PRESS_MS)) { *keyValue = keyInProcess; *keyLongPressed = true; isLongPressed = true; diff --git a/src/input/ScanAndSelect.cpp b/src/input/ScanAndSelect.cpp index d693d768cb..65ca7e332b 100644 --- a/src/input/ScanAndSelect.cpp +++ b/src/input/ScanAndSelect.cpp @@ -6,6 +6,7 @@ #include "ScanAndSelect.h" #include "modules/CannedMessageModule.h" +#include // Config static const char name[] = "scanAndSelect"; // should match "allow input source" string @@ -75,7 +76,7 @@ int32_t ScanAndSelectInput::runOnce() else { // Duration enough for long press // Long press not yet fired (prevent repeat firing while held) - if (!longPressFired && now - downSinceMs > durationLongMs) { + if (!longPressFired && Throttle::isWithinTimespanMs(downSinceMs, durationLongMs)) { longPressFired = true; longPress(); } @@ -91,7 +92,7 @@ int32_t ScanAndSelectInput::runOnce() // Long press event didn't already fire if (held && !longPressFired) { // Duration enough for short press - if (now - downSinceMs > durationShortMs) { + if (!Throttle::isWithinTimespanMs(downSinceMs, durationShortMs)) { shortPress(); } } diff --git a/src/input/SerialKeyboard.cpp b/src/input/SerialKeyboard.cpp index 7b7a2f3ece..4827e89951 100644 --- a/src/input/SerialKeyboard.cpp +++ b/src/input/SerialKeyboard.cpp @@ -1,5 +1,6 @@ #include "SerialKeyboard.h" #include "configuration.h" +#include #ifdef INPUTBROKER_SERIAL_TYPE #define CANNED_MESSAGE_MODULE_ENABLE 1 // in case it's not set in the variant file @@ -73,7 +74,7 @@ int32_t SerialKeyboard::runOnce() // Serial.print ("X"); // Serial.println (shiftRegister2, BIN); - if (millis() - lastPressTime > 500) { + if (!Throttle::isWithinTimespanMs(lastPressTime, 500)) { quickPress = 0; } diff --git a/src/main.cpp b/src/main.cpp index f28a69144b..1924c0a48a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,6 +18,7 @@ #include "Led.h" #include "RTC.h" #include "SPILock.h" +#include "Throttle.h" #include "concurrency/OSThread.h" #include "concurrency/Periodic.h" #include "detect/ScanI2C.h" @@ -1237,7 +1238,7 @@ void loop() #ifdef DEBUG_STACK static uint32_t lastPrint = 0; - if (millis() - lastPrint > 10 * 1000L) { + if (!Throttle::isWithinTimespanMs(lastPrint, 10 * 1000L)) { lastPrint = millis(); meshtastic::printThreadInfo("main"); } diff --git a/src/mesh/LR11x0Interface.cpp b/src/mesh/LR11x0Interface.cpp index c0742f2417..e237c354fd 100644 --- a/src/mesh/LR11x0Interface.cpp +++ b/src/mesh/LR11x0Interface.cpp @@ -1,7 +1,9 @@ #include "LR11x0Interface.h" +#include "Throttle.h" #include "configuration.h" #include "error.h" #include "mesh/NodeDB.h" + #ifdef ARCH_PORTDUINO #include "PortduinoGlue.h" #endif @@ -275,15 +277,15 @@ template bool LR11x0Interface::isActivelyReceiving() bool detected = (irq & (RADIOLIB_LR11X0_IRQ_SYNC_WORD_HEADER_VALID | RADIOLIB_LR11X0_IRQ_PREAMBLE_DETECTED)); // Handle false detections if (detected) { - uint32_t now = millis(); if (!activeReceiveStart) { - activeReceiveStart = now; - } else if ((now - activeReceiveStart > 2 * preambleTimeMsec) && !(irq & RADIOLIB_LR11X0_IRQ_SYNC_WORD_HEADER_VALID)) { + activeReceiveStart = millis(); + } else if (!Throttle::isWithinTimespanMs(activeReceiveStart, 2 * preambleTimeMsec) && + !(irq & RADIOLIB_LR11X0_IRQ_SYNC_WORD_HEADER_VALID)) { // The HEADER_VALID flag should be set by now if it was really a packet, so ignore PREAMBLE_DETECTED flag activeReceiveStart = 0; LOG_DEBUG("Ignore false preamble detection.\n"); return false; - } else if (now - activeReceiveStart > maxPacketTimeMsec) { + } else if (!Throttle::isWithinTimespanMs(activeReceiveStart, maxPacketTimeMsec)) { // We should have gotten an RX_DONE IRQ by now if it was really a packet, so ignore HEADER_VALID flag activeReceiveStart = 0; LOG_DEBUG("Ignore false header detection.\n"); diff --git a/src/mesh/PacketHistory.cpp b/src/mesh/PacketHistory.cpp index 26a73a3fe8..ed1c3c59c8 100644 --- a/src/mesh/PacketHistory.cpp +++ b/src/mesh/PacketHistory.cpp @@ -5,6 +5,7 @@ #ifdef ARCH_PORTDUINO #include "platform/portduino/PortduinoGlue.h" #endif +#include "Throttle.h" PacketHistory::PacketHistory() { @@ -22,18 +23,17 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd return false; // Not a floodable message ID, so we don't care } - uint32_t now = millis(); - PacketRecord r; r.id = p->id; r.sender = getFrom(p); - r.rxTimeMsec = now; + r.rxTimeMsec = millis(); auto found = recentPackets.find(r); bool seenRecently = (found != recentPackets.end()); // found not equal to .end() means packet was seen recently - if (seenRecently && (now - found->rxTimeMsec) >= FLOOD_EXPIRE_TIME) { // Check whether found packet has already expired - recentPackets.erase(found); // Erase and pretend packet has not been seen recently + if (seenRecently && + !Throttle::isWithinTimespanMs(found->rxTimeMsec, FLOOD_EXPIRE_TIME)) { // Check whether found packet has already expired + recentPackets.erase(found); // Erase and pretend packet has not been seen recently found = recentPackets.end(); seenRecently = false; } @@ -64,12 +64,10 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd */ void PacketHistory::clearExpiredRecentPackets() { - uint32_t now = millis(); - LOG_DEBUG("recentPackets size=%ld\n", recentPackets.size()); for (auto it = recentPackets.begin(); it != recentPackets.end();) { - if ((now - it->rxTimeMsec) >= FLOOD_EXPIRE_TIME) { + if (!Throttle::isWithinTimespanMs(it->rxTimeMsec, FLOOD_EXPIRE_TIME)) { it = recentPackets.erase(it); // erase returns iterator pointing to element immediately following the one erased } else { ++it; diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 121687c49a..2ed7a69db4 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -25,6 +25,7 @@ #if !MESHTASTIC_EXCLUDE_MQTT #include "mqtt/MQTT.h" #endif +#include "Throttle.h" #include PhoneAPI::PhoneAPI() @@ -561,12 +562,12 @@ bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p) { printPacket("PACKET FROM PHONE", &p); if (p.decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP && lastPortNumToRadio[p.decoded.portnum] && - (millis() - lastPortNumToRadio[p.decoded.portnum]) < (THIRTY_SECONDS_MS)) { + Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], THIRTY_SECONDS_MS)) { LOG_WARN("Rate limiting portnum %d\n", p.decoded.portnum); sendNotification(meshtastic_LogRecord_Level_WARNING, p.id, "TraceRoute can only be sent once every 30 seconds"); return false; } else if (p.decoded.portnum == meshtastic_PortNum_POSITION_APP && lastPortNumToRadio[p.decoded.portnum] && - (millis() - lastPortNumToRadio[p.decoded.portnum]) < (FIVE_SECONDS_MS)) { + Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], FIVE_SECONDS_MS)) { LOG_WARN("Rate limiting portnum %d\n", p.decoded.portnum); sendNotification(meshtastic_LogRecord_Level_WARNING, p.id, "Position can only be sent once every 5 seconds"); return false; diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index f4874d4c32..aa4ffe29a7 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -3,6 +3,7 @@ #include "NodeDB.h" #include "PowerMon.h" #include "SPILock.h" +#include "Throttle.h" #include "configuration.h" #include "error.h" #include "main.h" @@ -41,7 +42,7 @@ void LockingArduinoHal::spiTransfer(uint8_t *out, size_t len, uint8_t *in) uint32_t start = millis(); while (digitalRead(busy)) { - if (millis() - start >= 2000) { + if (!Throttle::isWithinTimespanMs(start, 2000)) { LOG_ERROR("GPIO mid-transfer timeout, is it connected?"); return; } @@ -114,7 +115,7 @@ bool RadioLibInterface::canSendImmediately() } // If we've been trying to send the same packet more than one minute and we haven't gotten a // TX IRQ from the radio, the radio is probably broken. - if (busyTx && (millis() - lastTxStart > 60000)) { + if (busyTx && !Throttle::isWithinTimespanMs(lastTxStart, 60000)) { LOG_ERROR("Hardware Failure! busyTx for more than 60s\n"); RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_TRANSMIT_FAILED); // reboot in 5 seconds when this condition occurs. diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index 6d23206bd9..2c6096062c 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -6,6 +6,8 @@ #include "PortduinoGlue.h" #endif +#include "Throttle.h" + // Particular boards might define a different max power based on what their hardware can do, default to max power output if not // specified (may be dangerous if using external PA and SX126x power config forgotten) #ifndef SX126X_MAX_POWER @@ -319,15 +321,15 @@ template bool SX126xInterface::isActivelyReceiving() bool detected = (irq & (RADIOLIB_SX126X_IRQ_HEADER_VALID | RADIOLIB_SX126X_IRQ_PREAMBLE_DETECTED)); // Handle false detections if (detected) { - uint32_t now = millis(); if (!activeReceiveStart) { - activeReceiveStart = now; - } else if ((now - activeReceiveStart > 2 * preambleTimeMsec) && !(irq & RADIOLIB_SX126X_IRQ_HEADER_VALID)) { + activeReceiveStart = millis(); + } else if (!Throttle::isWithinTimespanMs(activeReceiveStart, 2 * preambleTimeMsec) && + !(irq & RADIOLIB_SX126X_IRQ_HEADER_VALID)) { // The HEADER_VALID flag should be set by now if it was really a packet, so ignore PREAMBLE_DETECTED flag activeReceiveStart = 0; LOG_DEBUG("Ignore false preamble detection.\n"); return false; - } else if (now - activeReceiveStart > maxPacketTimeMsec) { + } else if (!Throttle::isWithinTimespanMs(activeReceiveStart, maxPacketTimeMsec)) { // We should have gotten an RX_DONE IRQ by now if it was really a packet, so ignore HEADER_VALID flag activeReceiveStart = 0; LOG_DEBUG("Ignore false header detection.\n"); @@ -359,4 +361,4 @@ template bool SX126xInterface::sleep() #endif return true; -} +} \ No newline at end of file diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index 9ff9ac2d70..270356e26c 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -1,4 +1,5 @@ #include "SX128xInterface.h" +#include "Throttle.h" #include "configuration.h" #include "error.h" #include "mesh/NodeDB.h" @@ -294,15 +295,15 @@ template bool SX128xInterface::isActivelyReceiving() // Handle false detections if (detected) { - uint32_t now = millis(); if (!activeReceiveStart) { - activeReceiveStart = now; - } else if ((now - activeReceiveStart > 2 * preambleTimeMsec) && !(irq & RADIOLIB_SX128X_IRQ_HEADER_VALID)) { + activeReceiveStart = millis(); + } else if (!Throttle::isWithinTimespanMs(activeReceiveStart, 2 * preambleTimeMsec) && + !(irq & RADIOLIB_SX128X_IRQ_HEADER_VALID)) { // The HEADER_VALID flag should be set by now if it was really a packet, so ignore PREAMBLE_DETECTED flag activeReceiveStart = 0; LOG_DEBUG("Ignore false preamble detection.\n"); return false; - } else if (now - activeReceiveStart > maxPacketTimeMsec) { + } else if (Throttle::isWithinTimespanMs(activeReceiveStart, maxPacketTimeMsec)) { // We should have gotten an RX_DONE IRQ by now if it was really a packet, so ignore HEADER_VALID flag activeReceiveStart = 0; LOG_DEBUG("Ignore false header detection.\n"); diff --git a/src/mesh/StreamAPI.cpp b/src/mesh/StreamAPI.cpp index 9f59aa971c..c3d85ed338 100644 --- a/src/mesh/StreamAPI.cpp +++ b/src/mesh/StreamAPI.cpp @@ -1,6 +1,7 @@ #include "StreamAPI.h" #include "PowerFSM.h" #include "RTC.h" +#include "Throttle.h" #include "configuration.h" #define START1 0x94 @@ -20,10 +21,9 @@ int32_t StreamAPI::runOncePart() */ int32_t StreamAPI::readStream() { - uint32_t now = millis(); if (!stream->available()) { // Nothing available this time, if the computer has talked to us recently, poll often, otherwise let CPU sleep a long time - bool recentRx = (now - lastRxMsec) < 2000; + bool recentRx = Throttle::isWithinTimespanMs(lastRxMsec, 2000); return recentRx ? 5 : 250; } else { while (stream->available()) { // Currently we never want to block @@ -71,7 +71,7 @@ int32_t StreamAPI::readStream() } // we had bytes available this time, so assume we might have them next time also - lastRxMsec = now; + lastRxMsec = millis(); return 0; } } diff --git a/src/mesh/Throttle.cpp b/src/mesh/Throttle.cpp index d8f23f9dc0..f278cc8431 100644 --- a/src/mesh/Throttle.cpp +++ b/src/mesh/Throttle.cpp @@ -24,4 +24,12 @@ bool Throttle::execute(uint32_t *lastExecutionMs, uint32_t minumumIntervalMs, vo onDefer(); } return false; +} + +/// @brief Check if the last execution time is within the interval +/// @param lastExecutionMs The last execution time in milliseconds +/// @param timeSpanMs The interval in milliseconds of the timespan +bool Throttle::isWithinTimespanMs(uint32_t lastExecutionMs, uint32_t timeSpanMs) +{ + return (millis() - lastExecutionMs) < timeSpanMs; } \ No newline at end of file diff --git a/src/mesh/Throttle.h b/src/mesh/Throttle.h index 8115595a46..8b4bb5d305 100644 --- a/src/mesh/Throttle.h +++ b/src/mesh/Throttle.h @@ -6,4 +6,5 @@ class Throttle { public: static bool execute(uint32_t *lastExecutionMs, uint32_t minumumIntervalMs, void (*func)(void), void (*onDefer)(void) = NULL); + static bool isWithinTimespanMs(uint32_t lastExecutionMs, uint32_t intervalMs); }; \ No newline at end of file diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 07b03222ec..d1169dc3ba 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -23,6 +23,7 @@ static void WiFiEvent(WiFiEvent_t event); #endif #ifndef DISABLE_NTP +#include "Throttle.h" #include #endif @@ -142,7 +143,7 @@ static int32_t reconnectWiFi() } #ifndef DISABLE_NTP - if (WiFi.isConnected() && (((millis() - lastrun_ntp) > 43200000) || (lastrun_ntp == 0))) { // every 12 hours + if (WiFi.isConnected() && (!Throttle::isWithinTimespanMs(lastrun_ntp, 43200000) || (lastrun_ntp == 0))) { // every 12 hours LOG_DEBUG("Updating NTP time from %s\n", config.network.ntp_server); if (timeClient.update()) { LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed\n"); @@ -420,4 +421,4 @@ uint8_t getWifiDisconnectReason() { return wifiDisconnectReason; } -#endif +#endif \ No newline at end of file diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 322bca4921..21659d7949 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -27,6 +27,7 @@ #endif #include "graphics/ScreenFonts.h" +#include // Remove Canned message screen if no action is taken for some milliseconds #define INACTIVATE_AFTER_MS 20000 @@ -422,7 +423,7 @@ int32_t CannedMessageModule::runOnce() this->notifyObservers(&e); } else if (((this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) || (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT)) && - ((millis() - this->lastTouchMillis) > INACTIVATE_AFTER_MS)) { + !Throttle::isWithinTimespanMs(this->lastTouchMillis, INACTIVATE_AFTER_MS)) { // Reset module e.action = UIFrameEvent::Action::REGENERATE_FRAMESET; // We want to change the list of frames shown on-screen this->currentMessageIndex = -1; diff --git a/src/modules/DetectionSensorModule.cpp b/src/modules/DetectionSensorModule.cpp index 20d91a381b..670fd32080 100644 --- a/src/modules/DetectionSensorModule.cpp +++ b/src/modules/DetectionSensorModule.cpp @@ -5,6 +5,7 @@ #include "PowerFSM.h" #include "configuration.h" #include "main.h" +#include DetectionSensorModule *detectionSensorModule; #define GPIO_POLLING_INTERVAL 100 @@ -49,7 +50,8 @@ int32_t DetectionSensorModule::runOnce() // LOG_DEBUG("Detection Sensor Module: Current pin state: %i\n", digitalRead(moduleConfig.detection_sensor.monitor_pin)); - if ((millis() - lastSentToMesh) >= Default::getConfiguredOrDefaultMs(moduleConfig.detection_sensor.minimum_broadcast_secs) && + if (!Throttle::isWithinTimespanMs(lastSentToMesh, + Default::getConfiguredOrDefaultMs(moduleConfig.detection_sensor.minimum_broadcast_secs)) && hasDetectionEvent()) { sendDetectionMessage(); return DELAYED_INTERVAL; @@ -58,8 +60,9 @@ int32_t DetectionSensorModule::runOnce() // of heartbeat. We only do this if the minimum broadcast interval is greater than zero, otherwise we'll only broadcast state // change detections. else if (moduleConfig.detection_sensor.state_broadcast_secs > 0 && - (millis() - lastSentToMesh) >= Default::getConfiguredOrDefaultMs(moduleConfig.detection_sensor.state_broadcast_secs, - default_telemetry_broadcast_interval_secs)) { + !Throttle::isWithinTimespanMs(lastSentToMesh, + Default::getConfiguredOrDefaultMs(moduleConfig.detection_sensor.state_broadcast_secs, + default_telemetry_broadcast_interval_secs))) { sendCurrentStateMessage(); return DELAYED_INTERVAL; } diff --git a/src/modules/NeighborInfoModule.cpp b/src/modules/NeighborInfoModule.cpp index 218fb8801d..a3a3b9bb43 100644 --- a/src/modules/NeighborInfoModule.cpp +++ b/src/modules/NeighborInfoModule.cpp @@ -3,6 +3,7 @@ #include "MeshService.h" #include "NodeDB.h" #include "RTC.h" +#include NeighborInfoModule *neighborInfoModule; @@ -87,7 +88,8 @@ void NeighborInfoModule::cleanUpNeighbors() NodeNum my_node_id = nodeDB->getNodeNum(); for (auto it = neighbors.rbegin(); it != neighbors.rend();) { // We will remove a neighbor if we haven't heard from them in twice the broadcast interval - if ((now - it->last_rx_time > it->node_broadcast_interval_secs * 2) && (it->node_id != my_node_id)) { + if (!Throttle::isWithinTimespanMs(it->last_rx_time, it->node_broadcast_interval_secs * 2) && + (it->node_id != my_node_id)) { LOG_DEBUG("Removing neighbor with node ID 0x%x\n", it->node_id); it = std::vector::reverse_iterator( neighbors.erase(std::next(it).base())); // Erase the element and update the iterator diff --git a/src/modules/NodeInfoModule.cpp b/src/modules/NodeInfoModule.cpp index cb047a4dc0..41f008fb06 100644 --- a/src/modules/NodeInfoModule.cpp +++ b/src/modules/NodeInfoModule.cpp @@ -6,6 +6,7 @@ #include "Router.h" #include "configuration.h" #include "main.h" +#include NodeInfoModule *nodeInfoModule; @@ -67,13 +68,12 @@ meshtastic_MeshPacket *NodeInfoModule::allocReply() LOG_DEBUG("Skip sending NodeInfo due to > 40 percent channel util.\n"); return NULL; } - uint32_t now = millis(); // If we sent our NodeInfo less than 5 min. ago, don't send it again as it may be still underway. - if (!shorterTimeout && lastSentToMesh && (now - lastSentToMesh) < (5 * 60 * 1000)) { + if (!shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 5 * 60 * 1000)) { LOG_DEBUG("Skip sending NodeInfo since we just sent it less than 5 minutes ago.\n"); ignoreRequest = true; // Mark it as ignored for MeshModule return NULL; - } else if (shorterTimeout && lastSentToMesh && (now - lastSentToMesh) < (60 * 1000)) { + } else if (shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 60 * 1000)) { LOG_DEBUG("Skip sending actively requested NodeInfo since we just sent it less than 60 seconds ago.\n"); ignoreRequest = true; // Mark it as ignored for MeshModule return NULL; @@ -82,7 +82,7 @@ meshtastic_MeshPacket *NodeInfoModule::allocReply() meshtastic_User &u = owner; LOG_INFO("sending owner %s/%s/%s\n", u.id, u.long_name, u.short_name); - lastSentToMesh = now; + lastSentToMesh = millis(); return allocDataProtobuf(u); } } diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index cb6a58b2e0..4ba09385df 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -145,7 +145,7 @@ void PositionModule::trySetRtc(meshtastic_Position p, bool isLocal, bool forceUp bool PositionModule::hasQualityTimesource() { bool setFromPhoneOrNtpToday = - lastSetFromPhoneNtpOrGps == 0 ? false : (millis() - lastSetFromPhoneNtpOrGps) <= (SEC_PER_DAY * 1000UL); + lastSetFromPhoneNtpOrGps == 0 ? false : Throttle::isWithinTimespanMs(lastSetFromPhoneNtpOrGps, SEC_PER_DAY * 1000UL); #if MESHTASTIC_EXCLUDE_GPS bool hasGpsOrRtc = (rtc_found.address != ScanI2C::ADDRESS_NONE.address); #else diff --git a/src/modules/PowerStressModule.cpp b/src/modules/PowerStressModule.cpp index 4c9f0df885..48159ba549 100644 --- a/src/modules/PowerStressModule.cpp +++ b/src/modules/PowerStressModule.cpp @@ -9,6 +9,7 @@ #include "main.h" #include "sleep.h" #include "target_specific.h" +#include extern void printInfo(); @@ -114,7 +115,7 @@ int32_t PowerStressModule::runOnce() break; case meshtastic_PowerStressMessage_Opcode_CPU_FULLON: { uint32_t start_msec = millis(); - while ((millis() - start_msec) < (uint32_t)sleep_msec) + while (Throttle::isWithinTimespanMs(start_msec, sleep_msec)) ; // Don't let CPU idle at all sleep_msec = 0; // we already slept break; diff --git a/src/modules/RangeTestModule.cpp b/src/modules/RangeTestModule.cpp index 8154a661ee..b02494ef3a 100644 --- a/src/modules/RangeTestModule.cpp +++ b/src/modules/RangeTestModule.cpp @@ -19,6 +19,7 @@ #include "configuration.h" #include "gps/GeoCoord.h" #include +#include RangeTestModule *rangeTestModule; RangeTestModuleRadio *rangeTestModuleRadio; @@ -79,7 +80,7 @@ int32_t RangeTestModule::runOnce() } // If we have been running for more than 8 hours, turn module back off - if (millis() - started > 28800000) { + if (!Throttle::isWithinTimespanMs(started, 28800000)) { LOG_INFO("Range Test Module - Disabling after 8 hours\n"); return disable(); } else { diff --git a/src/modules/RemoteHardwareModule.cpp b/src/modules/RemoteHardwareModule.cpp index 0242b59bcc..f6b8b2e908 100644 --- a/src/modules/RemoteHardwareModule.cpp +++ b/src/modules/RemoteHardwareModule.cpp @@ -5,6 +5,7 @@ #include "Router.h" #include "configuration.h" #include "main.h" +#include #define NUM_GPIOS 64 @@ -118,11 +119,10 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const meshtastic_MeshPacket &r int32_t RemoteHardwareModule::runOnce() { if (moduleConfig.remote_hardware.enabled && watchGpios) { - uint32_t now = millis(); - if (now - lastWatchMsec >= WATCH_INTERVAL_MSEC) { + if (!Throttle::isWithinTimespanMs(lastWatchMsec, WATCH_INTERVAL_MSEC)) { uint64_t curVal = digitalReads(watchGpios); - lastWatchMsec = now; + lastWatchMsec = millis(); if (curVal != previousWatch) { previousWatch = curVal; diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index f0ba64f65a..a4dbb072ff 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -7,6 +7,7 @@ #include "Router.h" #include "configuration.h" #include +#include /* SerialModule @@ -97,8 +98,7 @@ SerialModuleRadio::SerialModuleRadio() : MeshModule("SerialModuleRadio") */ bool SerialModule::checkIsConnected() { - uint32_t now = millis(); - return (now - lastContactMsec) < SERIAL_CONNECTION_TIMEOUT; + return Throttle::isWithinTimespanMs(lastContactMsec, SERIAL_CONNECTION_TIMEOUT); } int32_t SerialModule::runOnce() @@ -182,13 +182,13 @@ int32_t SerialModule::runOnce() return runOncePart(); } else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA) && HAS_GPS) { // in NMEA mode send out GGA every 2 seconds, Don't read from Port - if (millis() - lastNmeaTime > 2000) { + if (!Throttle::isWithinTimespanMs(lastNmeaTime, 2000)) { lastNmeaTime = millis(); printGGA(outbuf, sizeof(outbuf), localPosition); serialPrint->printf("%s", outbuf); } } else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_CALTOPO) && HAS_GPS) { - if (millis() - lastNmeaTime > 10000) { + if (!Throttle::isWithinTimespanMs(lastNmeaTime, 10000)) { lastNmeaTime = millis(); uint32_t readIndex = 0; const meshtastic_NodeInfoLite *tempNodeInfo = nodeDB->readNextMeshNode(readIndex); @@ -500,7 +500,7 @@ void SerialModule::processWXSerial() LOG_INFO("WS85 : %i %.1fg%.1f %.1fv %.1fv\n", atoi(windDir), strtof(windVel, nullptr), strtof(windGust, nullptr), batVoltageF, capVoltageF); } - if (gotwind && millis() - lastAveraged > averageIntervalMillis) { + if (gotwind && !Throttle::isWithinTimespanMs(lastAveraged, averageIntervalMillis)) { // calulate averages and send to the mesh float velAvg = 1.0 * velSum / velCount; diff --git a/src/modules/Telemetry/AirQualityTelemetry.cpp b/src/modules/Telemetry/AirQualityTelemetry.cpp index 56d308cfae..0b6be1b7ef 100644 --- a/src/modules/Telemetry/AirQualityTelemetry.cpp +++ b/src/modules/Telemetry/AirQualityTelemetry.cpp @@ -12,6 +12,7 @@ #include "Router.h" #include "detect/ScanI2CTwoWire.h" #include "main.h" +#include int32_t AirQualityTelemetryModule::runOnce() { @@ -60,15 +61,14 @@ int32_t AirQualityTelemetryModule::runOnce() if (!moduleConfig.telemetry.air_quality_enabled) return disable(); - uint32_t now = millis(); if (((lastSentToMesh == 0) || - ((now - lastSentToMesh) >= Default::getConfiguredOrDefaultMsScaled(moduleConfig.telemetry.air_quality_interval, - default_telemetry_broadcast_interval_secs, - numOnlineNodes))) && + !Throttle::isWithinTimespanMs(lastSentToMesh, Default::getConfiguredOrDefaultMsScaled( + moduleConfig.telemetry.air_quality_interval, + default_telemetry_broadcast_interval_secs, numOnlineNodes))) && airTime->isTxAllowedChannelUtil(config.device.role != meshtastic_Config_DeviceConfig_Role_SENSOR) && airTime->isTxAllowedAirUtil()) { sendTelemetry(); - lastSentToMesh = now; + lastSentToMesh = millis(); } else if (service->isToPhoneQueueEmpty()) { // Just send to phone when it's not our time to send to mesh yet // Only send while queue is empty (phone assumed connected) diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 31cb2f838c..f94f7956bc 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -64,6 +64,7 @@ T1000xSensor t1000xSensor; #define DISPLAY_RECEIVEID_MEASUREMENTS_ON_SCREEN true #include "graphics/ScreenFonts.h" +#include int32_t EnvironmentTelemetryModule::runOnce() { @@ -155,21 +156,20 @@ int32_t EnvironmentTelemetryModule::runOnce() result = bme680Sensor.runTrigger(); } - uint32_t now = millis(); if (((lastSentToMesh == 0) || - ((now - lastSentToMesh) >= - Default::getConfiguredOrDefaultMsScaled(moduleConfig.telemetry.environment_update_interval, - default_telemetry_broadcast_interval_secs, numOnlineNodes))) && + !Throttle::isWithinTimespanMs(lastSentToMesh, Default::getConfiguredOrDefaultMsScaled( + moduleConfig.telemetry.environment_update_interval, + default_telemetry_broadcast_interval_secs, numOnlineNodes))) && airTime->isTxAllowedChannelUtil(config.device.role != meshtastic_Config_DeviceConfig_Role_SENSOR) && airTime->isTxAllowedAirUtil()) { sendTelemetry(); - lastSentToMesh = now; - } else if (((lastSentToPhone == 0) || ((now - lastSentToPhone) >= sendToPhoneIntervalMs)) && + lastSentToMesh = millis(); + } else if (((lastSentToPhone == 0) || !Throttle::isWithinTimespanMs(lastSentToPhone, sendToPhoneIntervalMs)) && (service->isToPhoneQueueEmpty())) { // Just send to phone when it's not our time to send to mesh yet // Only send while queue is empty (phone assumed connected) sendTelemetry(NODENUM_BROADCAST, true); - lastSentToPhone = now; + lastSentToPhone = millis(); } } return min(sendToPhoneIntervalMs, result); diff --git a/src/modules/Telemetry/PowerTelemetry.cpp b/src/modules/Telemetry/PowerTelemetry.cpp index 318acf4560..a493042a09 100644 --- a/src/modules/Telemetry/PowerTelemetry.cpp +++ b/src/modules/Telemetry/PowerTelemetry.cpp @@ -19,6 +19,7 @@ #define DISPLAY_RECEIVEID_MEASUREMENTS_ON_SCREEN true #include "graphics/ScreenFonts.h" +#include int32_t PowerTelemetryModule::runOnce() { @@ -69,20 +70,19 @@ int32_t PowerTelemetryModule::runOnce() if (!moduleConfig.telemetry.power_measurement_enabled) return disable(); - uint32_t now = millis(); if (((lastSentToMesh == 0) || - ((now - lastSentToMesh) >= Default::getConfiguredOrDefaultMsScaled(moduleConfig.telemetry.power_update_interval, - default_telemetry_broadcast_interval_secs, - numOnlineNodes))) && + !Throttle::isWithinTimespanMs(lastSentToMesh, Default::getConfiguredOrDefaultMsScaled( + moduleConfig.telemetry.power_update_interval, + default_telemetry_broadcast_interval_secs, numOnlineNodes))) && airTime->isTxAllowedAirUtil()) { sendTelemetry(); - lastSentToMesh = now; - } else if (((lastSentToPhone == 0) || ((now - lastSentToPhone) >= sendToPhoneIntervalMs)) && + lastSentToMesh = millis(); + } else if (((lastSentToPhone == 0) || !Throttle::isWithinTimespanMs(lastSentToPhone, sendToPhoneIntervalMs)) && (service->isToPhoneQueueEmpty())) { // Just send to phone when it's not our time to send to mesh yet // Only send while queue is empty (phone assumed connected) sendTelemetry(NODENUM_BROADCAST, true); - lastSentToPhone = now; + lastSentToPhone = millis(); } } return min(sendToPhoneIntervalMs, result); diff --git a/src/modules/Telemetry/Sensor/NAU7802Sensor.cpp b/src/modules/Telemetry/Sensor/NAU7802Sensor.cpp index d7dcbd09f0..59f310a245 100644 --- a/src/modules/Telemetry/Sensor/NAU7802Sensor.cpp +++ b/src/modules/Telemetry/Sensor/NAU7802Sensor.cpp @@ -7,6 +7,7 @@ #include "NAU7802Sensor.h" #include "SafeFile.h" #include "TelemetrySensor.h" +#include #include #include @@ -40,7 +41,7 @@ bool NAU7802Sensor::getMetrics(meshtastic_Telemetry *measurement) uint32_t start = millis(); while (!nau7802.available()) { delay(100); - if (millis() - start > 1000) { + if (!Throttle::isWithinTimespanMs(start, 1000)) { nau7802.powerDown(); return false; } diff --git a/src/modules/esp32/StoreForwardModule.cpp b/src/modules/esp32/StoreForwardModule.cpp index db09a0bfd3..51ec2a942d 100644 --- a/src/modules/esp32/StoreForwardModule.cpp +++ b/src/modules/esp32/StoreForwardModule.cpp @@ -17,6 +17,7 @@ #include "NodeDB.h" #include "RTC.h" #include "Router.h" +#include "Throttle.h" #include "airtime.h" #include "configuration.h" #include "memGet.h" @@ -29,6 +30,9 @@ StoreForwardModule *storeForwardModule; +uint32_t lastHeartbeat = 0; +uint32_t heartbeatInterval = 60; // Default to 60 seconds, adjust as needed + int32_t StoreForwardModule::runOnce() { #ifdef ARCH_ESP32 @@ -42,7 +46,7 @@ int32_t StoreForwardModule::runOnce() this->busy = false; } } - } else if (this->heartbeat && (millis() - lastHeartbeat > (heartbeatInterval * 1000)) && + } else if (this->heartbeat && (!Throttle::isWithinTimespanMs(lastHeartbeat, heartbeatInterval * 1000)) && airTime->isTxAllowedChannelUtil(true)) { lastHeartbeat = millis(); LOG_INFO("*** Sending heartbeat\n"); diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 6840700e52..56af9f663a 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -21,6 +21,7 @@ #include "Default.h" #include "serialization/JSON.h" #include "serialization/MeshPacketSerializer.h" +#include #include const int reconnectMax = 5; @@ -610,7 +611,7 @@ void MQTT::perhapsReportToMap() if (!moduleConfig.mqtt.map_reporting_enabled || !(moduleConfig.mqtt.proxy_to_client_enabled || isConnectedDirectly())) return; - if (millis() - last_report_to_map < map_publish_interval_msecs) { + if (Throttle::isWithinTimespanMs(last_report_to_map, map_publish_interval_msecs)) { return; } else { if (map_position_precision == 0 || (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)) { diff --git a/src/sleep.cpp b/src/sleep.cpp index d553bf23d7..0e35f848a5 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -5,6 +5,7 @@ #endif #include "ButtonThread.h" +#include "Default.h" #include "Led.h" #include "MeshRadio.h" #include "MeshService.h" @@ -28,6 +29,7 @@ esp_sleep_source_t wakeCause; // the reason we booted this time #endif +#include "Throttle.h" #ifndef INCLUDE_vTaskSuspend #define INCLUDE_vTaskSuspend 0 @@ -168,7 +170,8 @@ static void waitEnterSleep(bool skipPreflight = false) while (!doPreflightSleep()) { delay(100); // Kinda yucky - wait until radio says say we can shutdown (finished in process sends/receives) - if (millis() - now > 30 * 1000) { // If we wait too long just report an error and go to sleep + if (!Throttle::isWithinTimespanMs(now, + THIRTY_SECONDS_MS)) { // If we wait too long just report an error and go to sleep RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_SLEEP_ENTER_WAIT); assert(0); // FIXME - for now we just restart, need to fix bug #167 break; From d91cda94c14810514a48221fff8a7b613be953bd Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 23 Sep 2024 09:20:32 -0500 Subject: [PATCH 255/322] Rename message length headers and set payload max to 255 (#4827) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Rename message length headers and set payload max to 255 * Add MESHTASTIC_PKC_OVERHEAD * compare to MESHTASTIC_HEADER_LENGTH --------- Co-authored-by: Thomas Göttgens --- src/mesh/RadioInterface.cpp | 4 ++-- src/mesh/RadioInterface.h | 7 ++++--- src/mesh/Router.cpp | 14 +++++++------- src/modules/RangeTestModule.cpp | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 7b6b4f5fab..6fca67188c 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -151,7 +151,7 @@ const RegionInfo regions[] = { const RegionInfo *myRegion; bool RadioInterface::uses_default_frequency_slot = true; -static uint8_t bytes[MAX_RHPACKETLEN]; +static uint8_t bytes[MAX_LORA_PAYLOAD_LEN + 1]; void initRegion() { @@ -326,7 +326,7 @@ void printPacket(const char *prefix, const meshtastic_MeshPacket *p) RadioInterface::RadioInterface() { - assert(sizeof(PacketHeader) == 16); // make sure the compiler did what we expected + assert(sizeof(PacketHeader) == MESHTASTIC_HEADER_LENGTH); // make sure the compiler did what we expected } bool RadioInterface::reconfigure() diff --git a/src/mesh/RadioInterface.h b/src/mesh/RadioInterface.h index d0d20926c8..1298614415 100644 --- a/src/mesh/RadioInterface.h +++ b/src/mesh/RadioInterface.h @@ -9,8 +9,9 @@ #define MAX_TX_QUEUE 16 // max number of packets which can be waiting for transmission -#define MAX_RHPACKETLEN 256 -#define LORA_HEADER_LENGTH 16 +#define MAX_LORA_PAYLOAD_LEN 255 // max length of 255 per Semtech's datasheets on SX12xx +#define MESHTASTIC_HEADER_LENGTH 16 +#define MESHTASTIC_PKC_OVERHEAD 12 #define PACKET_FLAGS_HOP_LIMIT_MASK 0x07 #define PACKET_FLAGS_WANT_ACK_MASK 0x08 @@ -90,7 +91,7 @@ class RadioInterface /** * A temporary buffer used for sending/receiving packets, sized to hold the biggest buffer we might need * */ - uint8_t radiobuf[MAX_RHPACKETLEN]; + uint8_t radiobuf[MAX_LORA_PAYLOAD_LEN + 1]; /** * Enqueue a received packet for the registered receiver diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index a6b9467611..a993ee7c0f 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -36,8 +36,8 @@ static MemoryDynamic staticPool; Allocator &packetPool = staticPool; -static uint8_t bytes[MAX_RHPACKETLEN]; -static uint8_t ScratchEncrypted[MAX_RHPACKETLEN]; +static uint8_t bytes[MAX_LORA_PAYLOAD_LEN + 1]; +static uint8_t ScratchEncrypted[MAX_LORA_PAYLOAD_LEN + 1]; /** * Constructor @@ -330,13 +330,13 @@ bool perhapsDecode(meshtastic_MeshPacket *p) // Attempt PKI decryption first if (p->channel == 0 && p->to == nodeDB->getNodeNum() && p->to > 0 && p->to != NODENUM_BROADCAST && nodeDB->getMeshNode(p->from) != nullptr && nodeDB->getMeshNode(p->from)->user.public_key.size > 0 && - nodeDB->getMeshNode(p->to)->user.public_key.size > 0 && rawSize > 12) { + nodeDB->getMeshNode(p->to)->user.public_key.size > 0 && rawSize > MESHTASTIC_PKC_OVERHEAD) { LOG_DEBUG("Attempting PKI decryption\n"); if (crypto->decryptCurve25519(p->from, p->id, rawSize, ScratchEncrypted, bytes)) { LOG_INFO("PKI Decryption worked!\n"); memset(&p->decoded, 0, sizeof(p->decoded)); - rawSize -= 12; + rawSize -= MESHTASTIC_PKC_OVERHEAD; if (pb_decode_from_bytes(bytes, rawSize, &meshtastic_Data_msg, &p->decoded) && p->decoded.portnum != meshtastic_PortNum_UNKNOWN_APP) { decrypted = true; @@ -475,7 +475,7 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p) } } */ - if (numbytes + LORA_HEADER_LENGTH > MAX_RHPACKETLEN) + if (numbytes + MESHTASTIC_HEADER_LENGTH > MAX_LORA_PAYLOAD_LEN) return meshtastic_Routing_Error_TOO_LARGE; // printBytes("plaintext", bytes, numbytes); @@ -499,7 +499,7 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p) p->decoded.portnum != meshtastic_PortNum_TRACEROUTE_APP && p->decoded.portnum != meshtastic_PortNum_NODEINFO_APP && p->decoded.portnum != meshtastic_PortNum_ROUTING_APP && p->decoded.portnum != meshtastic_PortNum_POSITION_APP) { LOG_DEBUG("Using PKI!\n"); - if (numbytes + LORA_HEADER_LENGTH + 12 > MAX_RHPACKETLEN) + if (numbytes + MESHTASTIC_HEADER_LENGTH + MESHTASTIC_PKC_OVERHEAD > MAX_LORA_PAYLOAD_LEN) return meshtastic_Routing_Error_TOO_LARGE; if (p->pki_encrypted && !memfll(p->public_key.bytes, 0, 32) && memcmp(p->public_key.bytes, node->user.public_key.bytes, 32) != 0) { @@ -508,7 +508,7 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p) return meshtastic_Routing_Error_PKI_FAILED; } crypto->encryptCurve25519(p->to, getFrom(p), p->id, numbytes, bytes, ScratchEncrypted); - numbytes += 12; + numbytes += MESHTASTIC_PKC_OVERHEAD; memcpy(p->encrypted.bytes, ScratchEncrypted, numbytes); p->channel = 0; p->pki_encrypted = true; diff --git a/src/modules/RangeTestModule.cpp b/src/modules/RangeTestModule.cpp index b02494ef3a..c98f15d40e 100644 --- a/src/modules/RangeTestModule.cpp +++ b/src/modules/RangeTestModule.cpp @@ -115,7 +115,7 @@ void RangeTestModuleRadio::sendPayload(NodeNum dest, bool wantReplies) packetSequence++; - static char heartbeatString[MAX_RHPACKETLEN]; + static char heartbeatString[MAX_LORA_PAYLOAD_LEN + 1]; snprintf(heartbeatString, sizeof(heartbeatString), "seq %u", packetSequence); p->decoded.payload.size = strlen(heartbeatString); // You must specify how many bytes are in the reply From dfbd8dbe215c30546f4bbc458f18ddcc60ef580f Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 23 Sep 2024 13:56:26 -0500 Subject: [PATCH 256/322] Check for null before printing debug (#4835) --- src/mesh/NodeDB.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index af3870fb82..06c1a7f350 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -664,9 +664,10 @@ void NodeDB::pickNewNodeNum() while (((found = getMeshNode(nodeNum)) && memcmp(found->user.macaddr, ourMacAddr, sizeof(ourMacAddr)) != 0) || (nodeNum == NODENUM_BROADCAST || nodeNum < NUM_RESERVED)) { NodeNum candidate = random(NUM_RESERVED, LONG_MAX); // try a new random choice - LOG_WARN("NOTE! Our desired nodenum 0x%x is invalid or in use, by MAC ending in 0x%02x%02x vs our 0x%02x%02x, so " - "trying for 0x%x\n", - nodeNum, found->user.macaddr[4], found->user.macaddr[5], ourMacAddr[4], ourMacAddr[5], candidate); + if (found) + LOG_WARN("NOTE! Our desired nodenum 0x%x is invalid or in use, by MAC ending in 0x%02x%02x vs our 0x%02x%02x, so " + "trying for 0x%x\n", + nodeNum, found->user.macaddr[4], found->user.macaddr[5], ourMacAddr[4], ourMacAddr[5], candidate); nodeNum = candidate; } LOG_DEBUG("Using nodenum 0x%x \n", nodeNum); From 67f363b659a8ca75d685f4ce44d41b26531057de Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 23 Sep 2024 23:14:20 +0200 Subject: [PATCH 257/322] fix merge --- src/mesh/PhoneAPI.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/mesh/PhoneAPI.h b/src/mesh/PhoneAPI.h index 3418928d8c..17fd98beb2 100644 --- a/src/mesh/PhoneAPI.h +++ b/src/mesh/PhoneAPI.h @@ -147,11 +147,6 @@ class PhoneAPI */ virtual void onNowHasData(uint32_t fromRadioNum) {} - /** - * Subclasses can use this to find out when a client drops the link - */ - virtual void handleDisconnect(); - /// begin a new connection void handleStartConfig(); From a84276ccfaded7de4c8e8e46bc9db28bd85ab8ee Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 24 Sep 2024 14:07:49 +0200 Subject: [PATCH 258/322] try-fix crash --- src/modules/ExternalNotificationModule.cpp | 2 +- src/modules/ExternalNotificationModule.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index 652db04d3d..3e6c7d9510 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -177,7 +177,7 @@ int32_t ExternalNotificationModule::runOnce() } #endif // now let the PWM buzzer play - if (moduleConfig.external_notification.use_pwm) { + if (moduleConfig.external_notification.use_pwm && config.device.buzzer_gpio) { if (rtttl::isPlaying()) { rtttl::play(); } else if (isNagging && (nagCycleCutoff >= millis())) { diff --git a/src/modules/ExternalNotificationModule.h b/src/modules/ExternalNotificationModule.h index 08e72c35a9..ed1ebae8b9 100644 --- a/src/modules/ExternalNotificationModule.h +++ b/src/modules/ExternalNotificationModule.h @@ -32,7 +32,7 @@ class ExternalNotificationModule : public SinglePortModule, private concurrency: public: ExternalNotificationModule(); - uint32_t nagCycleCutoff = UINT32_MAX; + uint32_t nagCycleCutoff = 1; void setExternalOn(uint8_t index = 0); void setExternalOff(uint8_t index = 0); From 10b3de65ca88e87fed8d23bd170f1261e7f3c7a3 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 24 Sep 2024 14:08:47 +0200 Subject: [PATCH 259/322] lib update: fix neighbors --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index a1083198b5..863f9fa84c 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit a1083198b5e6ebd32fedaf1dc487c7fd2477789c +Subproject commit 863f9fa84c5da66da1931bba576721bf60dbe94f From 7b3e3df0594e910926f2a84c0332f68895944d33 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 27 Sep 2024 15:14:22 +0200 Subject: [PATCH 260/322] fix GPIO0 mode after I2S audio --- src/modules/ExternalNotificationModule.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index 3e6c7d9510..e8356c2145 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -98,6 +98,13 @@ int32_t ExternalNotificationModule::runOnce() LOG_INFO("%d ", i); } LOG_INFO("\n"); +#ifdef HAS_I2S + // GPIO0 is used as mclk for I2S audio and set to OUTPUT by the sound library + // T-Deck uses GPIO0 as trackball button, so restore the mode +#if defined(T_DECK) || (defined(BUTTON_PIN) && BUTTON_PIN == 0) + pinMode(0, INPUT); +#endif +#endif isNagging = false; return INT32_MAX; // save cycles till we're needed again } From e9dad0e3b5c819ea9529ec10c90ae5b205e63ffe Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 27 Sep 2024 15:20:31 +0200 Subject: [PATCH 261/322] lib update: audio fix --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 863f9fa84c..ffe0361124 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 863f9fa84c5da66da1931bba576721bf60dbe94f +Subproject commit ffe0361124e8e8c14b09ccfdf35d62219f963fff From 26e62bc55898c11b624f9c95d67df471ba2cb466 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 3 Oct 2024 18:17:27 +0200 Subject: [PATCH 262/322] lib update: fixes and improvements --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index ffe0361124..6b760f5373 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit ffe0361124e8e8c14b09ccfdf35d62219f963fff +Subproject commit 6b760f5373b91de1d8234922a446f7232d5247d0 From db4fb1bc1e97cd3759b9f5e0db970fb485a9c3e6 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 8 Oct 2024 09:18:32 +0200 Subject: [PATCH 263/322] extra --- variants/t-deck/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 2210be1db0..fdf7d59479 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -2,6 +2,7 @@ [env:t-deck] extends = esp32s3_base board = t-deck +board_level = extra board_build.partitions = default_16MB.csv ; just for test board_check = true upload_protocol = esptool From 449226143a736006266df80cbe6fb05ca3243374 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 8 Oct 2024 09:24:31 +0200 Subject: [PATCH 264/322] added ILI9342 (from master) --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ff90d0d1a2..31595f658c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -725,8 +725,8 @@ void setup() #ifdef PORTDUINO if (settingsMap[displayPanel] != no_screen) { DisplayDriverConfig displayConfig; - static char *panels[] = {"NOSCREEN", "X11", "ST7789", "ST7735", "ST7735S", - "ST7796", "ILI9341", "ILI9486", "ILI9488", "HX8357D"}; + static char *panels[] = {"NOSCREEN", "X11", "ST7789", "ST7735", "ST7735S", "ST7796", + "ILI9341", "ILI9342", "ILI9486", "ILI9488", "HX8357D"}; static char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"}; #ifdef USE_X11 if (settingsMap[displayPanel] == x11) { From 97a602ebc28944168041d3bc7d6913919df39b48 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 11 Oct 2024 15:19:24 +0200 Subject: [PATCH 265/322] device-ui persistency --- src/mesh/NodeDB.cpp | 8 ++++++++ src/mesh/NodeDB.h | 1 + src/mesh/PhoneAPI.cpp | 10 ++++++++-- src/mesh/PhoneAPI.h | 1 + src/modules/AdminModule.cpp | 29 +++++++++++++++++++++++++++-- src/modules/AdminModule.h | 2 ++ 6 files changed, 47 insertions(+), 4 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 8924f3cde7..bf406d64e8 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -53,6 +53,7 @@ NodeDB *nodeDB = nullptr; EXT_RAM_BSS_ATTR meshtastic_DeviceState devicestate; meshtastic_MyNodeInfo &myNodeInfo = devicestate.my_node; meshtastic_LocalConfig config; +meshtastic_DeviceUIConfig uiconfig{.screen_timeout = 30}; meshtastic_LocalModuleConfig moduleConfig; meshtastic_ChannelFile channelFile; meshtastic_OEMStore oemStore; @@ -687,6 +688,7 @@ void NodeDB::pickNewNodeNum() static const char *prefFileName = "/prefs/db.proto"; static const char *configFileName = "/prefs/config.proto"; +static const char *uiconfigFileName = "/prefs/uiconfig.proto"; static const char *moduleConfigFileName = "/prefs/module.proto"; static const char *channelFileName = "/prefs/channels.proto"; static const char *oemConfigFile = "/oem/oem.proto"; @@ -797,6 +799,12 @@ void NodeDB::loadFromDisk() hasOemStore = true; } + state = loadProto(uiconfigFileName, meshtastic_DeviceUIConfig_size, sizeof(meshtastic_DeviceUIConfig), + &meshtastic_DeviceUIConfig_msg, &uiconfig); + if (state == LoadFileResult::LOAD_SUCCESS) { + LOG_INFO("Loaded UIConfig\n"); + } + // 2.4.X - configuration migration to update new default intervals if (moduleConfig.version < 23) { LOG_DEBUG("ModuleConfig version %d is stale, upgrading to new default intervals\n", moduleConfig.version); diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 1be61759a1..d91c68722f 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -30,6 +30,7 @@ extern meshtastic_DeviceState devicestate; extern meshtastic_ChannelFile channelFile; extern meshtastic_MyNodeInfo &myNodeInfo; extern meshtastic_LocalConfig config; +extern meshtastic_DeviceUIConfig uiconfig; extern meshtastic_LocalModuleConfig moduleConfig; extern meshtastic_OEMStore oemStore; extern meshtastic_User &owner; diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index ad4a1f33db..2d3567d742 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -52,7 +52,7 @@ void PhoneAPI::handleStartConfig() } // even if we were already connected - restart our state machine - state = STATE_SEND_MY_INFO; + state = STATE_SEND_UIDATA; pauseBluetoothLogging = true; filesManifest = getFiles("/", 10); LOG_DEBUG("Got %d files in manifest\n", filesManifest.size()); @@ -190,7 +190,12 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) case STATE_SEND_NOTHING: LOG_INFO("getFromRadio=STATE_SEND_NOTHING\n"); break; - + case STATE_SEND_UIDATA: + LOG_INFO("getFromRadio=STATE_SEND_UIDATA\n"); + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_deviceuiConfig_tag; + fromRadioScratch.deviceuiConfig = uiconfig; + state = STATE_SEND_MY_INFO; + break; case STATE_SEND_MY_INFO: LOG_INFO("getFromRadio=STATE_SEND_MY_INFO\n"); // If the user has specified they don't want our node to share its location, make sure to tell the phone @@ -499,6 +504,7 @@ bool PhoneAPI::available() switch (state) { case STATE_SEND_NOTHING: return false; + case STATE_SEND_UIDATA: case STATE_SEND_MY_INFO: case STATE_SEND_CHANNELS: case STATE_SEND_CONFIG: diff --git a/src/mesh/PhoneAPI.h b/src/mesh/PhoneAPI.h index 2b145176a6..5b92d45d1b 100644 --- a/src/mesh/PhoneAPI.h +++ b/src/mesh/PhoneAPI.h @@ -34,6 +34,7 @@ class PhoneAPI { enum State { STATE_SEND_NOTHING, // Initial state, don't send anything until the client starts asking for config + STATE_SEND_UIDATA, // send stored data for device-ui STATE_SEND_MY_INFO, // send our my info record STATE_SEND_OWN_NODEINFO, STATE_SEND_METADATA, diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 0368dffa37..b0e0c47225 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -175,6 +175,11 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta LOG_INFO("Client is setting ham mode\n"); handleSetHamMode(r->set_ham_mode); break; + case meshtastic_AdminMessage_get_ui_config_request_tag: { + LOG_INFO("Client is getting device-ui config\n"); + handleGetDeviceUIConfig(mp); + break; + } /** * Other @@ -234,6 +239,11 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta reboot(DEFAULT_REBOOT_SECONDS); break; } + case meshtastic_AdminMessage_store_ui_config_tag: { + LOG_INFO("Storing device-ui config\n"); + handleStoreDeviceUIConfig(r->store_ui_config); + break; + } case meshtastic_AdminMessage_begin_edit_settings_tag: { LOG_INFO("Beginning transaction for editing settings\n"); hasOpenEditTransaction = true; @@ -960,6 +970,14 @@ void AdminModule::handleGetChannel(const meshtastic_MeshPacket &req, uint32_t ch } } +void AdminModule::handleGetDeviceUIConfig(const meshtastic_MeshPacket &req) +{ + meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default; + r.which_payload_variant = meshtastic_AdminMessage_get_ui_config_response_tag; + r.store_ui_config = uiconfig; + myReply = allocDataProtobuf(r); +} + void AdminModule::reboot(int32_t seconds) { LOG_INFO("Rebooting in %d seconds\n", seconds); @@ -980,6 +998,11 @@ void AdminModule::saveChanges(int saveWhat, bool shouldReboot) } } +void AdminModule::handleStoreDeviceUIConfig(const meshtastic_DeviceUIConfig &uicfg) +{ + nodeDB->saveProto("/prefs/uiconfig.proto", meshtastic_DeviceUIConfig_size, &meshtastic_DeviceUIConfig_msg, &uicfg); +} + void AdminModule::handleSetHamMode(const meshtastic_HamParameters &p) { // Set call sign and override lora limitations for licensed use @@ -1046,7 +1069,8 @@ bool AdminModule::messageIsResponse(const meshtastic_AdminMessage *r) r->which_payload_variant == meshtastic_AdminMessage_get_ringtone_response_tag || r->which_payload_variant == meshtastic_AdminMessage_get_device_connection_status_response_tag || r->which_payload_variant == meshtastic_AdminMessage_get_node_remote_hardware_pins_response_tag || - r->which_payload_variant == meshtastic_NodeRemoteHardwarePinsResponse_node_remote_hardware_pins_tag) + r->which_payload_variant == meshtastic_NodeRemoteHardwarePinsResponse_node_remote_hardware_pins_tag || + r->which_payload_variant == meshtastic_AdminMessage_get_ui_config_response_tag) return true; else return false; @@ -1062,7 +1086,8 @@ bool AdminModule::messageIsRequest(const meshtastic_AdminMessage *r) r->which_payload_variant == meshtastic_AdminMessage_get_device_metadata_request_tag || r->which_payload_variant == meshtastic_AdminMessage_get_ringtone_request_tag || r->which_payload_variant == meshtastic_AdminMessage_get_device_connection_status_request_tag || - r->which_payload_variant == meshtastic_AdminMessage_get_node_remote_hardware_pins_request_tag) + r->which_payload_variant == meshtastic_AdminMessage_get_node_remote_hardware_pins_request_tag || + r->which_payload_variant == meshtastic_AdminMessage_get_ui_config_request_tag) return true; else return false; diff --git a/src/modules/AdminModule.h b/src/modules/AdminModule.h index d6c0a7343d..0743cd7ae3 100644 --- a/src/modules/AdminModule.h +++ b/src/modules/AdminModule.h @@ -41,6 +41,7 @@ class AdminModule : public ProtobufModule, public Obser void handleGetDeviceMetadata(const meshtastic_MeshPacket &req); void handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &req); void handleGetNodeRemoteHardwarePins(const meshtastic_MeshPacket &req); + void handleGetDeviceUIConfig(const meshtastic_MeshPacket &req); /** * Setters */ @@ -50,6 +51,7 @@ class AdminModule : public ProtobufModule, public Obser void handleSetModuleConfig(const meshtastic_ModuleConfig &c); void handleSetChannel(); void handleSetHamMode(const meshtastic_HamParameters &req); + void handleStoreDeviceUIConfig(const meshtastic_DeviceUIConfig &uicfg); void reboot(int32_t seconds); void setPassKey(meshtastic_AdminMessage *res); From 9f15ef50e6e0f48d5882605db987bfccc223d28f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 11 Oct 2024 16:30:42 +0200 Subject: [PATCH 266/322] review update --- src/mesh/NodeDB.cpp | 2 +- src/mesh/PhoneAPI.cpp | 19 ++++++++++--------- src/modules/AdminModule.cpp | 1 + 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index d8d7849402..7b6d7fb318 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -53,7 +53,7 @@ NodeDB *nodeDB = nullptr; EXT_RAM_BSS_ATTR meshtastic_DeviceState devicestate; meshtastic_MyNodeInfo &myNodeInfo = devicestate.my_node; meshtastic_LocalConfig config; -meshtastic_DeviceUIConfig uiconfig{.screen_timeout = 30}; +meshtastic_DeviceUIConfig uiconfig{.screen_brightness = 153, .screen_timeout = 30}; meshtastic_LocalModuleConfig moduleConfig; meshtastic_ChannelFile channelFile; meshtastic_OEMStore oemStore; diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 2d3567d742..1df1316579 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -52,7 +52,7 @@ void PhoneAPI::handleStartConfig() } // even if we were already connected - restart our state machine - state = STATE_SEND_UIDATA; + state = STATE_SEND_MY_INFO; pauseBluetoothLogging = true; filesManifest = getFiles("/", 10); LOG_DEBUG("Got %d files in manifest\n", filesManifest.size()); @@ -190,23 +190,24 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) case STATE_SEND_NOTHING: LOG_INFO("getFromRadio=STATE_SEND_NOTHING\n"); break; - case STATE_SEND_UIDATA: - LOG_INFO("getFromRadio=STATE_SEND_UIDATA\n"); - fromRadioScratch.which_payload_variant = meshtastic_FromRadio_deviceuiConfig_tag; - fromRadioScratch.deviceuiConfig = uiconfig; - state = STATE_SEND_MY_INFO; - break; case STATE_SEND_MY_INFO: LOG_INFO("getFromRadio=STATE_SEND_MY_INFO\n"); // If the user has specified they don't want our node to share its location, make sure to tell the phone // app not to send locations on our behalf. fromRadioScratch.which_payload_variant = meshtastic_FromRadio_my_info_tag; fromRadioScratch.my_info = myNodeInfo; - state = STATE_SEND_OWN_NODEINFO; + state = STATE_SEND_UIDATA; service->refreshLocalMeshNode(); // Update my NodeInfo because the client will be asking for it soon. break; + case STATE_SEND_UIDATA: + LOG_INFO("getFromRadio=STATE_SEND_UIDATA\n"); + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_deviceuiConfig_tag; + fromRadioScratch.deviceuiConfig = uiconfig; + state = STATE_SEND_OWN_NODEINFO; + break; + case STATE_SEND_OWN_NODEINFO: { LOG_INFO("getFromRadio=STATE_SEND_OWN_NODEINFO\n"); auto us = nodeDB->readNextMeshNode(readIndex); @@ -504,8 +505,8 @@ bool PhoneAPI::available() switch (state) { case STATE_SEND_NOTHING: return false; - case STATE_SEND_UIDATA: case STATE_SEND_MY_INFO: + case STATE_SEND_UIDATA: case STATE_SEND_CHANNELS: case STATE_SEND_CONFIG: case STATE_SEND_MODULECONFIG: diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index b0e0c47225..c0d463bdcc 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -178,6 +178,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta case meshtastic_AdminMessage_get_ui_config_request_tag: { LOG_INFO("Client is getting device-ui config\n"); handleGetDeviceUIConfig(mp); + handled = true; break; } From d1cb129a097867d8ae3f7a655bb9b7b684ce7bf6 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 11 Oct 2024 16:38:02 +0200 Subject: [PATCH 267/322] fix request, add handled --- src/modules/AdminModule.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index c0d463bdcc..852e99626c 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -243,6 +243,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta case meshtastic_AdminMessage_store_ui_config_tag: { LOG_INFO("Storing device-ui config\n"); handleStoreDeviceUIConfig(r->store_ui_config); + handled = true; break; } case meshtastic_AdminMessage_begin_edit_settings_tag: { @@ -975,7 +976,7 @@ void AdminModule::handleGetDeviceUIConfig(const meshtastic_MeshPacket &req) { meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default; r.which_payload_variant = meshtastic_AdminMessage_get_ui_config_response_tag; - r.store_ui_config = uiconfig; + r.get_ui_config_response = uiconfig; myReply = allocDataProtobuf(r); } From 339bbdbf372a77650eb88b95dfe1315cc62f86b2 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 14 Oct 2024 15:42:05 +0200 Subject: [PATCH 268/322] fix merge issue --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index c4d91278e2..a43e592a10 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -744,7 +744,7 @@ void setup() SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); LOG_DEBUG("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)\n", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); SPI.setFrequency(4000000); - +#endif #if HAS_TFT #ifdef PORTDUINO if (settingsMap[displayPanel] != no_screen) { From 56ab05289275e602e8a866d0bd3b6255609eb463 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 15 Oct 2024 01:31:26 +0200 Subject: [PATCH 269/322] fix merge issue --- src/mesh/NodeDB.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 7a91f3d388..6b7056448d 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -791,12 +791,6 @@ void NodeDB::loadFromDisk() } } - state = loadProto(oemConfigFile, meshtastic_OEMStore_size, sizeof(meshtastic_OEMStore), &meshtastic_OEMStore_msg, &oemStore); - if (state == LoadFileResult::LOAD_SUCCESS) { - LOG_INFO("Loaded OEMStore"); - hasOemStore = true; - } - state = loadProto(uiconfigFileName, meshtastic_DeviceUIConfig_size, sizeof(meshtastic_DeviceUIConfig), &meshtastic_DeviceUIConfig_msg, &uiconfig); if (state == LoadFileResult::LOAD_SUCCESS) { From 3e3ec710b64b7106025945bffde4c886ad418877 Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:55:11 +0200 Subject: [PATCH 270/322] remove newline --- src/detect/ScanI2CTwoWire.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 5d2d34d961..4640a7db9d 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -241,9 +241,9 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) } break; - SCAN_SIMPLE_CASE(TDECK_KB_ADDR, TDECKKB, "T-Deck keyboard found\n"); - SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10 keyboard found\n"); - SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found\n"); + SCAN_SIMPLE_CASE(TDECK_KB_ADDR, TDECKKB, "T-Deck keyboard found"); + SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10 keyboard found"); + SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found"); #ifdef HAS_NCP5623 SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623 RGB LED found"); #endif @@ -465,4 +465,4 @@ size_t ScanI2CTwoWire::countDevices() const { return foundDevices.size(); } -#endif \ No newline at end of file +#endif From 4121abc576ca2dab73fe4aaf66e23718f3a4080c Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 16 Oct 2024 22:30:00 +0200 Subject: [PATCH 271/322] remove newlines from debug log --- src/graphics/TFTDisplay.cpp | 2 +- src/main.cpp | 8 ++++---- src/mesh/NodeDB.cpp | 2 +- src/mesh/PhoneAPI.cpp | 2 +- src/mesh/api/PacketAPI.cpp | 10 +++++----- src/modules/AdminModule.cpp | 4 ++-- variants/rak2560/RAK9154Sensor.cpp | 16 ++++++++-------- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index d9592fdb51..986d081bdf 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -378,7 +378,7 @@ class LGFX : public lgfx::LGFX_Device _panel_instance = new lgfx::Panel_HX8357D; else { _panel_instance = new lgfx::Panel_NULL; - LOG_ERROR("Unknown display panel configured!\n"); + LOG_ERROR("Unknown display panel configured!"); } auto buscfg = _bus_instance.config(); diff --git a/src/main.cpp b/src/main.cpp index a43e592a10..07167cb3a4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -742,7 +742,7 @@ void setup() #else // ESP32 SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); - LOG_DEBUG("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)\n", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); + LOG_DEBUG("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); SPI.setFrequency(4000000); #endif #if HAS_TFT @@ -817,7 +817,7 @@ void setup() PacketAPI::create(PacketServer::init()); deviceScreen->init(new PacketClient); } else { - LOG_INFO("Running without TFT display!\n"); + LOG_INFO("Running without TFT display!"); } #else deviceScreen = &DeviceScreen::create(); @@ -1239,8 +1239,8 @@ void setup() #endif #ifdef ARDUINO_ARCH_ESP32 - LOG_DEBUG("Free heap : %7d bytes\n", ESP.getFreeHeap()); - LOG_DEBUG("Free PSRAM : %7d bytes\n", ESP.getFreePsram()); + LOG_DEBUG("Free heap : %7d bytes", ESP.getFreeHeap()); + LOG_DEBUG("Free PSRAM : %7d bytes", ESP.getFreePsram()); #endif } #endif diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6b7056448d..e5bd441ea4 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -794,7 +794,7 @@ void NodeDB::loadFromDisk() state = loadProto(uiconfigFileName, meshtastic_DeviceUIConfig_size, sizeof(meshtastic_DeviceUIConfig), &meshtastic_DeviceUIConfig_msg, &uiconfig); if (state == LoadFileResult::LOAD_SUCCESS) { - LOG_INFO("Loaded UIConfig\n"); + LOG_INFO("Loaded UIConfig"); } // 2.4.X - configuration migration to update new default intervals diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 48e5976d50..58685b6b52 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -202,7 +202,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) break; case STATE_SEND_UIDATA: - LOG_INFO("getFromRadio=STATE_SEND_UIDATA\n"); + LOG_INFO("getFromRadio=STATE_SEND_UIDATA"); fromRadioScratch.which_payload_variant = meshtastic_FromRadio_deviceuiConfig_tag; fromRadioScratch.deviceuiConfig = uiconfig; state = STATE_SEND_OWN_NODEINFO; diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp index 348b329495..6c3604efd9 100644 --- a/src/mesh/api/PacketAPI.cpp +++ b/src/mesh/api/PacketAPI.cpp @@ -38,7 +38,7 @@ bool PacketAPI::receivePacket(void) meshtastic_ToRadio *mr; auto p = server->receivePacket()->move(); int id = p->getPacketId(); - LOG_DEBUG("Received packet id=%u\n", id); + LOG_DEBUG("Received packet id=%u", id); mr = (meshtastic_ToRadio *)&static_cast *>(p.get())->getData(); switch (mr->which_payload_variant) { @@ -50,22 +50,22 @@ bool PacketAPI::receivePacket(void) } case meshtastic_ToRadio_want_config_id_tag: { uint32_t config_nonce = mr->want_config_id; - LOG_INFO("Screen wants config, nonce=%u\n", config_nonce); + LOG_INFO("Screen wants config, nonce=%u", config_nonce); handleStartConfig(); break; } case meshtastic_ToRadio_heartbeat_tag: if (mr->heartbeat.dummy_field == 1) { if (nodeInfoModule) { - LOG_INFO("Broadcasting nodeinfo ping\n"); + LOG_INFO("Broadcasting nodeinfo ping"); nodeInfoModule->sendOurNodeInfo(NODENUM_BROADCAST, true, 0, true); } } else { - LOG_DEBUG("Got client heartbeat\n"); + LOG_DEBUG("Got client heartbeat"); } break; default: - LOG_ERROR("Error: unhandled meshtastic_ToRadio variant: %d\n", mr->which_payload_variant); + LOG_ERROR("Error: unhandled meshtastic_ToRadio variant: %d", mr->which_payload_variant); break; } } diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index f2d95c53a5..c1aa69fba0 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -176,7 +176,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta handleSetHamMode(r->set_ham_mode); break; case meshtastic_AdminMessage_get_ui_config_request_tag: { - LOG_INFO("Client is getting device-ui config\n"); + LOG_INFO("Client is getting device-ui config"); handleGetDeviceUIConfig(mp); handled = true; break; @@ -241,7 +241,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta break; } case meshtastic_AdminMessage_store_ui_config_tag: { - LOG_INFO("Storing device-ui config\n"); + LOG_INFO("Storing device-ui config"); handleStoreDeviceUIConfig(r->store_ui_config); handled = true; break; diff --git a/variants/rak2560/RAK9154Sensor.cpp b/variants/rak2560/RAK9154Sensor.cpp index 9f660947e8..5fb09c1307 100644 --- a/variants/rak2560/RAK9154Sensor.cpp +++ b/variants/rak2560/RAK9154Sensor.cpp @@ -37,11 +37,11 @@ static void onewire_evt(const uint8_t pid, const uint8_t sid, const SNHUBAPI_EVT break; case SNHUBAPI_EVT_ADD_SID: - // LOG_INFO("+ADD:SID:[%02x]\r\n", msg[0]); + // LOG_INFO("+ADD:SID:[%02x]", msg[0]); break; case SNHUBAPI_EVT_ADD_PID: - // LOG_INFO("+ADD:PID:[%02x]\r\n", msg[0]); + // LOG_INFO("+ADD:PID:[%02x]", msg[0]); #ifdef BOOT_DATA_REQ provision = msg[0]; #endif @@ -55,12 +55,12 @@ static void onewire_evt(const uint8_t pid, const uint8_t sid, const SNHUBAPI_EVT case SNHUBAPI_EVT_SDATA_REQ: - // LOG_INFO("+EVT:PID[%02x],IPSO[%02x]\r\n",pid,msg[0]); + // LOG_INFO("+EVT:PID[%02x],IPSO[%02x]",pid,msg[0]); // for( uint16_t i=1; i Date: Mon, 21 Oct 2024 00:20:10 +0200 Subject: [PATCH 272/322] playing with locks; but needs more testing --- variants/t-deck/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index fdf7d59479..a459cd0164 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -8,6 +8,7 @@ board_check = true upload_protocol = esptool build_flags = ${esp32_base.build_flags} -D T_DECK + -D CONFIG_DISABLE_HAL_LOCKS=1 ; "feels" to be a bit more stable without locks -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 From 6c597a460ca355539871ee46e2bb7fa3f83c1484 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 21 Oct 2024 02:33:56 +0200 Subject: [PATCH 273/322] diy mesh-tab initial files --- variants/diy/mesh-tab/variant.h | 49 +++++++++++++++++++++++ variants/diy/platformio.ini | 70 +++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 variants/diy/mesh-tab/variant.h diff --git a/variants/diy/mesh-tab/variant.h b/variants/diy/mesh-tab/variant.h new file mode 100644 index 0000000000..0a23a3c368 --- /dev/null +++ b/variants/diy/mesh-tab/variant.h @@ -0,0 +1,49 @@ +#ifndef _VARIANT_MESHTAB_DIY_ +#define _VARIANT_MESHTAB_DIY_ + +#define HAS_TOUCHSCREEN 1 + +#define SLEEP_TIME 120 + +// Analog pins +#define BATTERY_PIN 4 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage +// ratio of voltage divider = 2.0 +#define ADC_MULTIPLIER 2.11 // 2.0 + 10% for correction of display undervoltage. +#define ADC_CHANNEL ADC1_GPIO4_CHANNEL + +// LED +#define LED_PIN 21 + +// Button +#define BUTTON_PIN 0 + +// GPS +#define GPS_RX_PIN 18 +#define GPS_TX_PIN 17 + +// #define HAS_SDCARD 1 +#define SPI_MOSI 13 +#define SPI_SCK 12 +#define SPI_MISO 11 +#define SPI_CS 10 +#define SDCARD_CS 6 + +// LORA SPI +#define LORA_SCK 36 +#define LORA_MISO 37 +#define LORA_MOSI 35 +#define LORA_CS 39 + +// LORA MODULES +#define USE_SX1262 + +// LORA CONFIG +#define SX126X_CS LORA_CS +#define SX126X_DIO1 15 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_BUSY 40 +#define SX126X_RESET 14 +#define SX126X_RXEN 47 +#define SX126X_TXEN RADIOLIB_NC // Assuming that DIO2 is connected to TXEN pin + +#endif diff --git a/variants/diy/platformio.ini b/variants/diy/platformio.ini index f3c22b7a87..00ff88da2b 100644 --- a/variants/diy/platformio.ini +++ b/variants/diy/platformio.ini @@ -88,3 +88,73 @@ build_flags = -D ARDUINO_USB_MODE=0 -D ARDUINO_USB_CDC_ON_BOOT=1 -I variants/diy/t-energy-s3_e22 + +; esp32-s3 + ra-sh01 lora + 3.2" ILI9143 +[env:mesh-tab] +extends = esp32s3_base +board = um_feathers3 +board_level = extra +board_upload.flash_size = 16MB +board_build.partitions = default_16MB.csv +upload_protocol = esptool +build_flags = ${esp32s3_base.build_flags} + -D MESH_TAB + -D PRIVATE_HW + -D CONFIG_ARDUHAL_ESP_LOG + -D CONFIG_ARDUHAL_LOG_COLORS=1 + -D CONFIG_DISABLE_HAL_LOCKS=1 ; "feels" to be a bit more stable without locks + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 + -D MESHTASTIC_EXCLUDE_WEBSERVER=1 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 + -D LV_BUILD_TEST=0 + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D RADIOLIB_SPI_PARANOID=0 + -D MAX_NUM_NODES=250 + -D MAX_THREADS=40 + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D RAM_SIZE=1024 + -D LGFX_DRIVER_TEMPLATE + -D LGFX_DRIVER=LGFX_GENERIC + -D LGFX_PANEL=ILI9341 + -D LGFX_OFFSET_ROTATION=1 + -D LGFX_TOUCH=XPT2046 + -D LGFX_PIN_SCK=12 + -D LGFX_PIN_MOSI=13 + -D LGFX_PIN_MISO=11 + -D LGFX_PIN_DC=16 + -D LGFX_PIN_CS=10 + -D LGFX_PIN_RST=-1 + -D LGFX_PIN_BL=42 + -D LGFX_TOUCH_INT=41 + -D LGFX_TOUCH_CS=7 + -D LGFX_TOUCH_CLK=12 + -D LGFX_TOUCH_DO=11 + -D LGFX_TOUCH_DIN=13 + -D LGFX_TOUCH_X_MIN=300 + -D LGFX_TOUCH_X_MAX=3900 + -D LGFX_TOUCH_Y_MIN=400 + -D LGFX_TOUCH_Y_MAX=3900 + -D VIEW_320x240 + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 + -I variants/diy/mesh-tab +build_src_filter = ${esp32_base.build_src_filter} + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> + +<../lib/device-ui/locale> + +<../lib/device-ui/source> +lib_deps = ${esp32_base.lib_deps} + lovyan03/LovyanGFX@^1.1.16 + earlephilhower/ESP8266Audio@^1.9.7 + earlephilhower/ESP8266SAM@^1.0.1 From 407c12f28025d013a754ae0babc59aae1a9c5bbe Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 21 Oct 2024 02:34:41 +0200 Subject: [PATCH 274/322] board definition for mesh-tab (not yet used) --- boards/mesh-tab.json | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 boards/mesh-tab.json diff --git a/boards/mesh-tab.json b/boards/mesh-tab.json new file mode 100644 index 0000000000..75ac1b5a21 --- /dev/null +++ b/boards/mesh-tab.json @@ -0,0 +1,42 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "partitions": "default_16MB.csv", + "memory_type": "qio_qspi" + }, + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DARDUINO_USB_MODE=0", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [["0x303A", "0x1001"]], + "mcu": "esp32s3", + "variant": "mesh-tab" + }, + "connectivity": ["wifi", "bluetooth", "lora"], + "debug": { + "default_tool": "esp-builtin", + "onboard_tools": ["esp-builtin"], + "openocd_target": "esp32s3.cfg" + }, + "frameworks": ["arduino", "espidf"], + "name": "ESP32-S3 WROOM-1 N16R2 (16 MB FLASH, 2 MB PSRAM)", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://github.com/valzzu/Mesh-Tab", + "vendor": "Espressif" +} From 50087da13dd3389003cfd3dd4c5e9179eb6879fc Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 24 Oct 2024 01:16:15 +0200 Subject: [PATCH 275/322] use DISPLAY_SET_RESOLUTION to avoid hw dependency in code --- variants/seeed-sensecap-indicator/platformio.ini | 1 + variants/unphone/platformio.ini | 1 + 2 files changed, 2 insertions(+) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 6b5f919276..8c97bf09e5 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -56,6 +56,7 @@ build_flags = ${esp32_base.build_flags} -D MAX_NUM_NODES=250 -D HAS_SCREEN=0 -D HAS_TFT=1 + -D DISPLAY_SET_RESOLUTION -D USE_I2S_BUZZER -D RAM_SIZE=1024 -D LV_LVGL_H_INCLUDE_SIMPLE diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index 8f2168f27c..b41848e134 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -55,6 +55,7 @@ build_flags = ${esp32_base.build_flags} -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 + -D DISPLAY_SET_RESOLUTION -D RAM_SIZE=1024 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE From a73e6832be5c756d1489084d5714b0e58579862b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 24 Oct 2024 22:03:40 +0200 Subject: [PATCH 276/322] no telemetry for Indicator --- variants/seeed-sensecap-indicator/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 8c97bf09e5..8879dbdc54 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -38,6 +38,7 @@ board_check = true upload_protocol = esptool build_flags = ${esp32_base.build_flags} -D SENSECAP_INDICATOR + -D HAS_TELEMETRY=0 -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 From e781b38838b5ac585dfd27abe4fcbedfd53f652d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 24 Oct 2024 22:06:17 +0200 Subject: [PATCH 277/322] 16MB partition for Indicator --- variants/seeed-sensecap-indicator/platformio.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 8879dbdc54..84a12adc64 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -35,6 +35,8 @@ platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 board = seeed-sensecap-indicator board_check = true +board_level = extra +board_build.partitions = default_16MB.csv ; just for test upload_protocol = esptool build_flags = ${esp32_base.build_flags} -D SENSECAP_INDICATOR From 71d984e7634094f721015893fea2bbe051ddc4ed Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 25 Oct 2024 00:26:05 +0200 Subject: [PATCH 278/322] 8MB partition for Indicator --- variants/seeed-sensecap-indicator/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 84a12adc64..20a3b45b86 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -36,7 +36,7 @@ platform_packages = board = seeed-sensecap-indicator board_check = true board_level = extra -board_build.partitions = default_16MB.csv ; just for test +board_build.partitions = default_8MB.csv ; must be here for some reason, board.json is not enough !? upload_protocol = esptool build_flags = ${esp32_base.build_flags} -D SENSECAP_INDICATOR From f184ba53b76852523f5d67b4411a599016d4ebc6 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 25 Oct 2024 16:09:49 +0200 Subject: [PATCH 279/322] stability: add SPI lock before saving via littleFS --- src/main.cpp | 3 ++- src/mesh/NodeDB.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index a4159e11ab..0f2d36afd8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -663,6 +663,8 @@ void setup() rp2040Setup(); #endif + initSPI(); // needed here before reading from littleFS + // We do this as early as possible because this loads preferences from flash // but we need to do this after main cpu init (esp32setup), because we need the random seed set nodeDB = new NodeDB; @@ -726,7 +728,6 @@ void setup() #endif // Init our SPI controller (must be before screen and lora) - initSPI(); #ifdef ARCH_RP2040 #ifdef HW_SPI1_DEVICE SPI1.setSCK(LORA_SCK); diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 3720b23a64..509e843940 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -32,6 +32,7 @@ #if HAS_WIFI #include "mesh/wifi/WiFiAPClient.h" #endif +#include "SPILock.h" #include "modules/StoreForwardModule.h" #include #include @@ -885,6 +886,9 @@ void NodeDB::loadFromDisk() bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_t *fields, const void *dest_struct, bool fullAtomic) { +#ifdef ARCH_ESP32 + concurrency::LockGuard g(spiLock); +#endif bool okay = false; #ifdef FSCom auto f = SafeFile(filename, fullAtomic); From 42d22a911b9a2cdc0d739e2b8c0b0b246469241a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 26 Oct 2024 18:04:31 +0200 Subject: [PATCH 280/322] dummy for config transfer (#5154) --- src/main.cpp | 1 - src/mesh/PhoneAPI.cpp | 6 +++++- src/modules/AdminModule.cpp | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b92df83d44..99d3282b82 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1324,4 +1324,3 @@ void tft_task_handler(void *param = nullptr) } #endif - diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 58685b6b52..8a8838af1a 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -165,6 +165,7 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength) * * Our sending states progress in the following sequence (the client apps ASSUME THIS SEQUENCE, DO NOT CHANGE IT): STATE_SEND_MY_INFO, // send our my info record + STATE_SEND_UIDATA, STATE_SEND_OWN_NODEINFO, STATE_SEND_METADATA, STATE_SEND_CHANNELS @@ -280,9 +281,12 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) fromRadioScratch.config.which_payload_variant = meshtastic_Config_security_tag; fromRadioScratch.config.payload_variant.security = config.security; break; - case meshtastic_Config_sessionkey_tag: + case meshtastic_Config_sessionkey_tag: // NOOP! fromRadioScratch.config.which_payload_variant = meshtastic_Config_sessionkey_tag; break; + case meshtastic_Config_device_ui_tag: // NOOP! + fromRadioScratch.config.which_payload_variant = meshtastic_Config_device_ui_tag; + break; default: LOG_ERROR("Unknown config type %d", config_state); } diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index c1aa69fba0..fe7a0514d2 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -606,6 +606,9 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c) requiresReboot = false; break; + case meshtastic_Config_device_ui_tag: + // NOOP! This is handled by handleStoreDeviceUIConfig + break; } if (requiresReboot && !hasOpenEditTransaction) { disableBluetooth(); @@ -768,6 +771,10 @@ void AdminModule::handleGetConfig(const meshtastic_MeshPacket &req, const uint32 LOG_INFO("Getting config: Sessionkey"); res.get_config_response.which_payload_variant = meshtastic_Config_sessionkey_tag; break; + case meshtastic_AdminMessage_ConfigType_DEVICEUI_CONFIG: + // NOOP! This is handled by handleGetDeviceUIConfig + res.get_config_response.which_payload_variant = meshtastic_Config_device_ui_tag; + break; } // NOTE: The phone app needs to know the ls_secs value so it can properly expect sleep behavior. // So even if we internally use 0 to represent 'use default' we still need to send the value we are From 16f0a91724f3935e0cc568a2e3d3433368745a7a Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 24 Oct 2024 15:02:29 +0200 Subject: [PATCH 281/322] update indicator (due to compile and linker errors) --- variants/seeed-sensecap-indicator/platformio.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 20a3b45b86..4ba2936982 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -34,6 +34,7 @@ platform_packages = ; platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32 platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 board = seeed-sensecap-indicator +board_build.partitions = default_16MB.csv board_check = true board_level = extra board_build.partitions = default_8MB.csv ; must be here for some reason, board.json is not enough !? @@ -46,6 +47,7 @@ build_flags = ${esp32_base.build_flags} -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 -D MESHTASTIC_EXCLUDE_SCREEN=1 -D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 + -D HAS_TELEMETRY=0 -D CONFIG_ARDUHAL_LOG_COLORS -D RADIOLIB_DEBUG_SPI=0 -D RADIOLIB_DEBUG_PROTOCOL=0 From a922e06bd242653bfd816b32d537c5a3bd3b5d8d Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 29 Oct 2024 22:12:21 +0100 Subject: [PATCH 282/322] remove faulty partition line --- variants/seeed-sensecap-indicator/platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 4ba2936982..971db38226 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -34,7 +34,6 @@ platform_packages = ; platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32 platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 board = seeed-sensecap-indicator -board_build.partitions = default_16MB.csv board_check = true board_level = extra board_build.partitions = default_8MB.csv ; must be here for some reason, board.json is not enough !? From 1b4a8e647f5d06cf15aa984e9c17bbe04c0b58c1 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 30 Oct 2024 11:09:11 +0100 Subject: [PATCH 283/322] fix missing include --- src/mesh/http/ContentHelper.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesh/http/ContentHelper.h b/src/mesh/http/ContentHelper.h index a80c39f47f..e5d3a2f571 100644 --- a/src/mesh/http/ContentHelper.h +++ b/src/mesh/http/ContentHelper.h @@ -1,5 +1,6 @@ #include #include +#include #define BoolToString(x) ((x) ? "true" : "false") From 5de6e6a175dc4ae0d5bb828c4625bb2a6cd0d602 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 30 Oct 2024 21:37:23 +0100 Subject: [PATCH 284/322] update indicator board --- boards/seeed-sensecap-indicator.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/boards/seeed-sensecap-indicator.json b/boards/seeed-sensecap-indicator.json index 3fc57126f9..6ce8d36adc 100644 --- a/boards/seeed-sensecap-indicator.json +++ b/boards/seeed-sensecap-indicator.json @@ -15,10 +15,12 @@ ], "f_cpu": "240000000L", "f_flash": "80000000L", + "f_boot": "120000000L", + "boot": "qio", "flash_mode": "qio", "hwids": [["0x1A86", "0x7523"]], "mcu": "esp32s3", - "variant": "esp32s3r8" + "variant": "esp32s3" }, "connectivity": ["wifi", "bluetooth", "lora"], "debug": { From 06c7f51c00ca054f95c5076e94d3562a3124e141 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 1 Nov 2024 14:47:37 +0100 Subject: [PATCH 285/322] update mesh-tab ILI9143 TFT --- variants/diy/platformio.ini | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/variants/diy/platformio.ini b/variants/diy/platformio.ini index 00ff88da2b..9792271885 100644 --- a/variants/diy/platformio.ini +++ b/variants/diy/platformio.ini @@ -89,8 +89,9 @@ build_flags = -D ARDUINO_USB_CDC_ON_BOOT=1 -I variants/diy/t-energy-s3_e22 -; esp32-s3 + ra-sh01 lora + 3.2" ILI9143 -[env:mesh-tab] +; esp32-s3 N16R2 + ra-sh01 lora +; 3.2" TFT ILI9143 / XPT2046: https://www.aliexpress.com/item/1005006258575617.html +[env:mesh-tab-3.2-resistive] extends = esp32s3_base board = um_feathers3 board_level = extra @@ -102,7 +103,7 @@ build_flags = ${esp32s3_base.build_flags} -D PRIVATE_HW -D CONFIG_ARDUHAL_ESP_LOG -D CONFIG_ARDUHAL_LOG_COLORS=1 - -D CONFIG_DISABLE_HAL_LOCKS=1 ; "feels" to be a bit more stable without locks + -D CONFIG_DISABLE_HAL_LOCKS=1 -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 @@ -126,9 +127,14 @@ build_flags = ${esp32s3_base.build_flags} -D RAM_SIZE=1024 -D LGFX_DRIVER_TEMPLATE -D LGFX_DRIVER=LGFX_GENERIC + -D LGFX_SCREEN_WIDTH=240 + -D LGFX_SCREEN_HEIGHT=320 -D LGFX_PANEL=ILI9341 - -D LGFX_OFFSET_ROTATION=1 + -D LGFX_INVERT_COLOR=true + -D LGFX_RGB_ORDER=false + -D LGFX_ROTATION=1 -D LGFX_TOUCH=XPT2046 + -D SPI_FREQUENCY=60000000 ; if image is distorted then lower to 40 MHz -D LGFX_PIN_SCK=12 -D LGFX_PIN_MOSI=13 -D LGFX_PIN_MISO=11 @@ -136,6 +142,7 @@ build_flags = ${esp32s3_base.build_flags} -D LGFX_PIN_CS=10 -D LGFX_PIN_RST=-1 -D LGFX_PIN_BL=42 + -D LGFX_TOUCH_SPI_HOST=2 -D LGFX_TOUCH_INT=41 -D LGFX_TOUCH_CS=7 -D LGFX_TOUCH_CLK=12 @@ -145,6 +152,7 @@ build_flags = ${esp32s3_base.build_flags} -D LGFX_TOUCH_X_MAX=3900 -D LGFX_TOUCH_Y_MIN=400 -D LGFX_TOUCH_Y_MAX=3900 + -D LGFX_TOUCH_ROTATION=4 -D VIEW_320x240 -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 @@ -156,5 +164,3 @@ build_src_filter = ${esp32_base.build_src_filter} +<../lib/device-ui/source> lib_deps = ${esp32_base.lib_deps} lovyan03/LovyanGFX@^1.1.16 - earlephilhower/ESP8266Audio@^1.9.7 - earlephilhower/ESP8266SAM@^1.0.1 From 21ea3f34f8c0edd43b193e138cf20b4db5fc95e0 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 1 Nov 2024 18:04:01 +0100 Subject: [PATCH 286/322] fix naming --- variants/diy/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/diy/platformio.ini b/variants/diy/platformio.ini index 9792271885..46d847787f 100644 --- a/variants/diy/platformio.ini +++ b/variants/diy/platformio.ini @@ -91,7 +91,7 @@ build_flags = ; esp32-s3 N16R2 + ra-sh01 lora ; 3.2" TFT ILI9143 / XPT2046: https://www.aliexpress.com/item/1005006258575617.html -[env:mesh-tab-3.2-resistive] +[env:mesh-tab-3-2-resistive] extends = esp32s3_base board = um_feathers3 board_level = extra From d68650d1787f487b35496d61830773631159d664 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 4 Nov 2024 14:06:12 +0100 Subject: [PATCH 287/322] mesh-tab targets --- variants/diy/platformio.ini | 76 ---------- variants/mesh-tab/platformio.ini | 202 ++++++++++++++++++++++++++ variants/{diy => }/mesh-tab/variant.h | 0 3 files changed, 202 insertions(+), 76 deletions(-) create mode 100644 variants/mesh-tab/platformio.ini rename variants/{diy => }/mesh-tab/variant.h (100%) diff --git a/variants/diy/platformio.ini b/variants/diy/platformio.ini index 46d847787f..f3c22b7a87 100644 --- a/variants/diy/platformio.ini +++ b/variants/diy/platformio.ini @@ -88,79 +88,3 @@ build_flags = -D ARDUINO_USB_MODE=0 -D ARDUINO_USB_CDC_ON_BOOT=1 -I variants/diy/t-energy-s3_e22 - -; esp32-s3 N16R2 + ra-sh01 lora -; 3.2" TFT ILI9143 / XPT2046: https://www.aliexpress.com/item/1005006258575617.html -[env:mesh-tab-3-2-resistive] -extends = esp32s3_base -board = um_feathers3 -board_level = extra -board_upload.flash_size = 16MB -board_build.partitions = default_16MB.csv -upload_protocol = esptool -build_flags = ${esp32s3_base.build_flags} - -D MESH_TAB - -D PRIVATE_HW - -D CONFIG_ARDUHAL_ESP_LOG - -D CONFIG_ARDUHAL_LOG_COLORS=1 - -D CONFIG_DISABLE_HAL_LOCKS=1 - -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 - -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 - -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 - -D MESHTASTIC_EXCLUDE_WEBSERVER=1 - -D LV_LVGL_H_INCLUDE_SIMPLE - -D LV_CONF_INCLUDE_SIMPLE - -D LV_COMP_CONF_INCLUDE_SIMPLE - -D LV_USE_SYSMON=0 - -D LV_USE_PROFILER=0 - -D LV_USE_PERF_MONITOR=0 - -D LV_USE_MEM_MONITOR=0 - -D LV_USE_LOG=0 - -D LV_BUILD_TEST=0 - -D USE_LOG_DEBUG - -D LOG_DEBUG_INC=\"DebugConfiguration.h\" - -D RADIOLIB_SPI_PARANOID=0 - -D MAX_NUM_NODES=250 - -D MAX_THREADS=40 - -D HAS_SCREEN=0 - -D HAS_TFT=1 - -D RAM_SIZE=1024 - -D LGFX_DRIVER_TEMPLATE - -D LGFX_DRIVER=LGFX_GENERIC - -D LGFX_SCREEN_WIDTH=240 - -D LGFX_SCREEN_HEIGHT=320 - -D LGFX_PANEL=ILI9341 - -D LGFX_INVERT_COLOR=true - -D LGFX_RGB_ORDER=false - -D LGFX_ROTATION=1 - -D LGFX_TOUCH=XPT2046 - -D SPI_FREQUENCY=60000000 ; if image is distorted then lower to 40 MHz - -D LGFX_PIN_SCK=12 - -D LGFX_PIN_MOSI=13 - -D LGFX_PIN_MISO=11 - -D LGFX_PIN_DC=16 - -D LGFX_PIN_CS=10 - -D LGFX_PIN_RST=-1 - -D LGFX_PIN_BL=42 - -D LGFX_TOUCH_SPI_HOST=2 - -D LGFX_TOUCH_INT=41 - -D LGFX_TOUCH_CS=7 - -D LGFX_TOUCH_CLK=12 - -D LGFX_TOUCH_DO=11 - -D LGFX_TOUCH_DIN=13 - -D LGFX_TOUCH_X_MIN=300 - -D LGFX_TOUCH_X_MAX=3900 - -D LGFX_TOUCH_Y_MIN=400 - -D LGFX_TOUCH_Y_MAX=3900 - -D LGFX_TOUCH_ROTATION=4 - -D VIEW_320x240 - -D USE_PACKET_API - -I lib/device-ui/generated/ui_320x240 - -I variants/diy/mesh-tab -build_src_filter = ${esp32_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> - +<../lib/device-ui/resources> - +<../lib/device-ui/locale> - +<../lib/device-ui/source> -lib_deps = ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.16 diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini new file mode 100644 index 0000000000..10cc602f08 --- /dev/null +++ b/variants/mesh-tab/platformio.ini @@ -0,0 +1,202 @@ +; Base for Mesh-Tab device (esp32-s3 N16R2 + ra-sh01 lora) +; https://github.com/valzzu/Mesh-Tab +[mesh_tab_base] +extends = esp32s3_base +board = um_feathers3 +board_level = extra +board_upload.flash_size = 16MB +board_build.partitions = default_16MB.csv +upload_protocol = esptool +build_flags = ${esp32s3_base.build_flags} + -D MESH_TAB + -D PRIVATE_HW + -D CONFIG_ARDUHAL_ESP_LOG + -D CONFIG_ARDUHAL_LOG_COLORS=1 + -D CONFIG_DISABLE_HAL_LOCKS=1 + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 + -D MESHTASTIC_EXCLUDE_WEBSERVER=1 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 + -D LV_BUILD_TEST=0 + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D RADIOLIB_SPI_PARANOID=0 + -D MAX_NUM_NODES=250 + -D MAX_THREADS=40 + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D RAM_SIZE=1024 + -D LGFX_DRIVER_TEMPLATE + -D LGFX_DRIVER=LGFX_GENERIC + -D LGFX_PIN_SCK=12 + -D LGFX_PIN_MOSI=13 + -D LGFX_PIN_MISO=11 + -D LGFX_PIN_DC=16 + -D LGFX_PIN_CS=10 + -D LGFX_PIN_RST=-1 + -D LGFX_PIN_BL=42 + -D LGFX_TOUCH_INT=41 + -D VIEW_320x240 + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 + -I variants/mesh-tab +build_src_filter = ${esp32_base.build_src_filter} + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> + +<../lib/device-ui/locale> + +<../lib/device-ui/source> +lib_deps = ${esp32_base.lib_deps} + lovyan03/LovyanGFX@^1.1.16 + +; 3.2" IPS TFT ILI9341 / XPT2046: https://www.aliexpress.com/item/1005006258575617.html +[env:mesh-tab-3-2-IPS-resistive] +extends = mesh_tab_base +build_flags = ${mesh_tab_base.build_flags} + -D LGFX_SCREEN_WIDTH=240 + -D LGFX_SCREEN_HEIGHT=320 + -D LGFX_PANEL=ILI9341 + -D LGFX_INVERT_COLOR=true + -D LGFX_RGB_ORDER=false + -D LGFX_ROTATION=1 + -D LGFX_TOUCH=XPT2046 + -D SPI_FREQUENCY=60000000 ; if image is distorted then lower to 40 MHz + -D LGFX_TOUCH_SPI_HOST=2 + -D LGFX_TOUCH_CS=7 + -D LGFX_TOUCH_CLK=12 + -D LGFX_TOUCH_DO=11 + -D LGFX_TOUCH_DIN=13 + -D LGFX_TOUCH_X_MIN=300 + -D LGFX_TOUCH_X_MAX=3900 + -D LGFX_TOUCH_Y_MIN=400 + -D LGFX_TOUCH_Y_MAX=3900 + -D LGFX_TOUCH_ROTATION=4 + +; 3.5" IPS TFT ILI9488 / XPT2046: https://vi.aliexpress.com/item/1005006333922639.html +[env:mesh-tab-3-5-IPS-resistive] +extends = mesh_tab_base +build_flags = ${mesh_tab_base.build_flags} + -D LGFX_SCREEN_WIDTH=320 + -D LGFX_SCREEN_HEIGHT=480 + -D LGFX_PANEL=ILI9488 + -D LGFX_INVERT_COLOR=true + -D LGFX_RGB_ORDER=false + -D LGFX_DLEN_16BITS=true + -D LGFX_ROTATION=1 + -D LGFX_TOUCH=XPT2046 + -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz + -D LGFX_TOUCH_SPI_HOST=2 + -D LGFX_TOUCH_CS=7 + -D LGFX_TOUCH_CLK=12 + -D LGFX_TOUCH_DO=11 + -D LGFX_TOUCH_DIN=13 + -D LGFX_TOUCH_X_MIN=300 + -D LGFX_TOUCH_X_MAX=3900 + -D LGFX_TOUCH_Y_MIN=400 + -D LGFX_TOUCH_Y_MAX=3900 + -D LGFX_TOUCH_ROTATION=1 + +; 3.5" TN TFT ILI9341 / XPT2046: https://vi.aliexpress.com/item/32985467436.html +[env:mesh-tab-3-5-TN-resistive] +extends = mesh_tab_base +build_flags = ${mesh_tab_base.build_flags} + -D LGFX_SCREEN_WIDTH=320 + -D LGFX_SCREEN_HEIGHT=480 + -D LGFX_PANEL=ILI9488 + -D LGFX_INVERT_COLOR=true + -D LGFX_RGB_ORDER=false + -D LGFX_DLEN_16BITS=true + -D LGFX_ROTATION=1 + -D LGFX_TOUCH=XPT2046 + -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz + -D LGFX_TOUCH_SPI_HOST=2 + -D LGFX_TOUCH_CS=7 + -D LGFX_TOUCH_CLK=12 + -D LGFX_TOUCH_DO=11 + -D LGFX_TOUCH_DIN=13 + -D LGFX_TOUCH_X_MIN=300 + -D LGFX_TOUCH_X_MAX=3900 + -D LGFX_TOUCH_Y_MIN=400 + -D LGFX_TOUCH_Y_MAX=3900 + -D LGFX_TOUCH_ROTATION=1 + +; 3.2" IPS TFT ILI9341 / FT6236: https://vi.aliexpress.com/item/1005006624072350.html +[env:mesh-tab-3-2-IPS-capacitive] +extends = mesh_tab_base +build_flags = ${mesh_tab_base.build_flags} + -D LGFX_SCREEN_WIDTH=240 + -D LGFX_SCREEN_HEIGHT=320 + -D LGFX_PANEL=ILI9341 + -D LGFX_INVERT_COLOR=true + -D LGFX_RGB_ORDER=false + -D LGFX_ROTATION=1 + -D LGFX_TOUCH=FT5x06 + -D SPI_FREQUENCY=40000000 ; may go higher upto 60/80 MHz + -D LGFX_TOUCH_I2C_PORT=0 + -D LGFX_TOUCH_I2C_ADDR=0x38 + -D LGFX_TOUCH_I2C_SDA=8 + -D LGFX_TOUCH_I2C_SCL=9 + -D LGFX_TOUCH_RST=7 + -D LGFX_TOUCH_X_MIN=0 + -D LGFX_TOUCH_X_MAX=319 + -D LGFX_TOUCH_Y_MIN=0 + -D LGFX_TOUCH_Y_MAX=479 + -D LGFX_TOUCH_ROTATION=0 + -D LGFX_TOUCH_I2C_FREQ=1000000 + +; 3.5" IPS TFT ILI9488 / FT6236: https://vi.aliexpress.com/item/1005006893699919.html +[env:mesh-tab-3-5-IPS-capacitive] +extends = mesh_tab_base +build_flags = ${mesh_tab_base.build_flags} + -D LGFX_SCREEN_WIDTH=320 + -D LGFX_SCREEN_HEIGHT=480 + -D LGFX_PANEL=ILI9488 + -D LGFX_INVERT_COLOR=true + -D LGFX_RGB_ORDER=false + -D LGFX_DLEN_16BITS=true + -D LGFX_ROTATION=1 + -D LGFX_TOUCH=FT5x06 + -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz + -D LGFX_TOUCH_I2C_PORT=0 + -D LGFX_TOUCH_I2C_ADDR=0x38 + -D LGFX_TOUCH_I2C_SDA=8 + -D LGFX_TOUCH_I2C_SCL=9 + -D LGFX_TOUCH_RST=7 + -D LGFX_TOUCH_X_MIN=0 + -D LGFX_TOUCH_X_MAX=319 + -D LGFX_TOUCH_Y_MIN=0 + -D LGFX_TOUCH_Y_MAX=479 + -D LGFX_TOUCH_ROTATION=1 + -D LGFX_TOUCH_I2C_FREQ=1000000 + +; 4.0" IPS TFT ILI9488 / FT6236: https://vi.aliexpress.com/item/1005007082906950.html +[env:mesh-tab-4-0-IPS-capacitive] +extends = mesh_tab_base +build_flags = ${mesh_tab_base.build_flags} + -D LGFX_SCREEN_WIDTH=320 + -D LGFX_SCREEN_HEIGHT=480 + -D LGFX_PANEL=ILI9488 + -D LGFX_INVERT_COLOR=true + -D LGFX_RGB_ORDER=false + -D LGFX_DLEN_16BITS=true + -D LGFX_ROTATION=1 + -D LGFX_TOUCH=FT5x06 + -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz + -D LGFX_TOUCH_I2C_PORT=0 + -D LGFX_TOUCH_I2C_ADDR=0x38 + -D LGFX_TOUCH_I2C_SDA=8 + -D LGFX_TOUCH_I2C_SCL=9 + -D LGFX_TOUCH_RST=7 + -D LGFX_TOUCH_X_MIN=0 + -D LGFX_TOUCH_X_MAX=319 + -D LGFX_TOUCH_Y_MIN=0 + -D LGFX_TOUCH_Y_MAX=479 + -D LGFX_TOUCH_ROTATION=1 + -D LGFX_TOUCH_I2C_FREQ=1000000 diff --git a/variants/diy/mesh-tab/variant.h b/variants/mesh-tab/variant.h similarity index 100% rename from variants/diy/mesh-tab/variant.h rename to variants/mesh-tab/variant.h From 5d95edbc12dc2310d2a07c7e709c14cda7545b62 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 7 Nov 2024 15:05:26 +0100 Subject: [PATCH 288/322] try: disable duplicate locks --- variants/seeed-sensecap-indicator/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 971db38226..1399c76870 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -48,6 +48,7 @@ build_flags = ${esp32_base.build_flags} -D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 -D HAS_TELEMETRY=0 -D CONFIG_ARDUHAL_LOG_COLORS + -D CONFIG_DISABLE_HAL_LOCKS=1 -D RADIOLIB_DEBUG_SPI=0 -D RADIOLIB_DEBUG_PROTOCOL=0 -D RADIOLIB_DEBUG_BASIC=0 From 5b135ec3dc06fac3a35436fb2f83696c04f3c906 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 8 Nov 2024 23:06:46 +0100 Subject: [PATCH 289/322] fix nodeDB erase loop when free mem returns invalid value (0, -1). --- src/mesh/NodeDB.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index fe60d5e183..7c4c482bd7 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -1260,11 +1260,14 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n) if (oldestBoringIndex != -1) { oldestIndex = oldestBoringIndex; } - // Shove the remaining nodes down the chain - for (int i = oldestIndex; i < numMeshNodes - 1; i++) { - meshNodes->at(i) = meshNodes->at(i + 1); + + if (oldestIndex != -1) { + // Shove the remaining nodes down the chain + for (int i = oldestIndex; i < numMeshNodes - 1; i++) { + meshNodes->at(i) = meshNodes->at(i + 1); + } + (numMeshNodes)--; } - (numMeshNodes)--; } // add the node at the end lite = &meshNodes->at((numMeshNodes)++); From 79f36e68e7d58e575c595f1f0e971d83545452d5 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 9 Nov 2024 12:27:25 +0100 Subject: [PATCH 290/322] upgrade toolchain for nrf52 to gcc 9.3.1 --- arch/nrf52/nrf52.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index 4e3093c558..c5b3ea71ba 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -5,7 +5,7 @@ extends = arduino_base platform_packages = ; our custom Git version until they merge our PR framework-arduinoadafruitnrf52 @ https://github.com/geeksville/Adafruit_nRF52_Arduino.git - + toolchain-gccarmnoneeabi@~1.90301.0 build_type = debug build_flags = -include arch/nrf52/cpp_overrides/lfs_util.h From 8eb8c677e62794cea41f7ffcc715de0a5a4c7ae1 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 9 Nov 2024 13:06:05 +0100 Subject: [PATCH 291/322] try-fix (workaround) T-Deck audio crash --- src/AudioThread.h | 2 +- variants/dreamcatcher/platformio.ini | 2 +- variants/dreamcatcher/variant.h | 1 + variants/t-deck/platformio.ini | 4 ++-- variants/t-deck/variant.h | 1 + variants/t-watch-s3/platformio.ini | 2 +- variants/t-watch-s3/variant.h | 1 + 7 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/AudioThread.h b/src/AudioThread.h index bb23e8598e..6d560ec559 100644 --- a/src/AudioThread.h +++ b/src/AudioThread.h @@ -64,7 +64,7 @@ class AudioThread : public concurrency::OSThread void initOutput() { audioOut = new AudioOutputI2S(1, AudioOutputI2S::EXTERNAL_I2S); - audioOut->SetPinout(DAC_I2S_BCK, DAC_I2S_WS, DAC_I2S_DOUT); + audioOut->SetPinout(DAC_I2S_BCK, DAC_I2S_WS, DAC_I2S_DOUT, DAC_I2S_MCLK); audioOut->SetGain(0.2); }; diff --git a/variants/dreamcatcher/platformio.ini b/variants/dreamcatcher/platformio.ini index 46f9b9871b..c57849d960 100644 --- a/variants/dreamcatcher/platformio.ini +++ b/variants/dreamcatcher/platformio.ini @@ -11,7 +11,7 @@ build_flags = -DARDUINO_USB_CDC_ON_BOOT=1 lib_deps = ${esp32s3_base.lib_deps} - earlephilhower/ESP8266Audio@^1.9.7 + earlephilhower/ESP8266Audio@^1.9.9 earlephilhower/ESP8266SAM@^1.0.1 [env:dreamcatcher-2206] diff --git a/variants/dreamcatcher/variant.h b/variants/dreamcatcher/variant.h index eb95a95dde..c6a77266de 100644 --- a/variants/dreamcatcher/variant.h +++ b/variants/dreamcatcher/variant.h @@ -60,6 +60,7 @@ #define DAC_I2S_BCK 21 #define DAC_I2S_WS 9 #define DAC_I2S_DOUT 48 +#define DAC_I2S_MCLK 1 #define BIAS_T_ENABLE 7 // needs to be low #define BIAS_T_VALUE 0 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index a459cd0164..1bf7c3066a 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -15,7 +15,7 @@ build_flags = ${esp32_base.build_flags} -D MESHTASTIC_EXCLUDE_WEBSERVER=1 -D INPUTDRIVER_I2C_KBD_TYPE=0x55 -D INPUTDRIVER_ENCODER_TYPE=3 - -D INPUTDRIVER_ENCODER_LEFT=1 +; -D INPUTDRIVER_ENCODER_LEFT=1 ; disabled because it's used by I2S audio -D INPUTDRIVER_ENCODER_RIGHT=2 -D INPUTDRIVER_ENCODER_UP=3 -D INPUTDRIVER_ENCODER_DOWN=15 @@ -57,5 +57,5 @@ lib_deps = ${esp32_base.lib_deps} lovyan03/LovyanGFX@^1.1.16 bitbank2/bb_captouch@1.2.2 ; alternative touch library supporting GT911 - earlephilhower/ESP8266Audio@^1.9.7 + earlephilhower/ESP8266Audio@^1.9.9 earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index 53bb706244..b39212680d 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -75,6 +75,7 @@ #define DAC_I2S_BCK 7 #define DAC_I2S_WS 5 #define DAC_I2S_DOUT 6 +#define DAC_I2S_MCLK 1 // LoRa #define USE_SX1262 diff --git a/variants/t-watch-s3/platformio.ini b/variants/t-watch-s3/platformio.ini index 1f5fc278b3..26d1b8fb3a 100644 --- a/variants/t-watch-s3/platformio.ini +++ b/variants/t-watch-s3/platformio.ini @@ -14,5 +14,5 @@ lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@^1.1.9 lewisxhe/PCF8563_Library@1.0.1 adafruit/Adafruit DRV2605 Library@^1.2.2 - earlephilhower/ESP8266Audio@^1.9.7 + earlephilhower/ESP8266Audio@^1.9.9 earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h index 9f939d8594..45bd5f23c8 100644 --- a/variants/t-watch-s3/variant.h +++ b/variants/t-watch-s3/variant.h @@ -34,6 +34,7 @@ #define DAC_I2S_BCK 48 #define DAC_I2S_WS 15 #define DAC_I2S_DOUT 46 +#define DAC_I2S_MCLK 0 #define HAS_AXP2101 From e9461a06f5f2abe13d05d7afecc406455b164164 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 11 Nov 2024 19:41:28 +0100 Subject: [PATCH 292/322] update mesh-tab tft configs --- variants/mesh-tab/platformio.ini | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index 10cc602f08..fd1796b4af 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -103,19 +103,20 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_TOUCH_Y_MAX=3900 -D LGFX_TOUCH_ROTATION=1 -; 3.5" TN TFT ILI9341 / XPT2046: https://vi.aliexpress.com/item/32985467436.html +; 3.5" TN TFT ILI9488 / XPT2046: https://vi.aliexpress.com/item/32985467436.html [env:mesh-tab-3-5-TN-resistive] extends = mesh_tab_base build_flags = ${mesh_tab_base.build_flags} -D LGFX_SCREEN_WIDTH=320 -D LGFX_SCREEN_HEIGHT=480 - -D LGFX_PANEL=ILI9488 - -D LGFX_INVERT_COLOR=true + -D LGFX_PANEL=HX8357B + -D LV_COLOR_DEPTH=24 + -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz + -D LGFX_INVERT_COLOR=false -D LGFX_RGB_ORDER=false -D LGFX_DLEN_16BITS=true -D LGFX_ROTATION=1 -D LGFX_TOUCH=XPT2046 - -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz -D LGFX_TOUCH_SPI_HOST=2 -D LGFX_TOUCH_CS=7 -D LGFX_TOUCH_CLK=12 @@ -182,11 +183,11 @@ extends = mesh_tab_base build_flags = ${mesh_tab_base.build_flags} -D LGFX_SCREEN_WIDTH=320 -D LGFX_SCREEN_HEIGHT=480 - -D LGFX_PANEL=ILI9488 + -D LGFX_PANEL=HX8357B -D LGFX_INVERT_COLOR=true -D LGFX_RGB_ORDER=false -D LGFX_DLEN_16BITS=true - -D LGFX_ROTATION=1 + -D LGFX_ROTATION=4 -D LGFX_TOUCH=FT5x06 -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz -D LGFX_TOUCH_I2C_PORT=0 From 3f02ee43cb38ebdf8345b75b6a19c561e92a7c67 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 11 Nov 2024 20:02:18 +0100 Subject: [PATCH 293/322] set T-Deck audio to unused 48 (mem mclk) --- variants/t-deck/platformio.ini | 2 +- variants/t-deck/variant.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 1bf7c3066a..bd18111b62 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -15,7 +15,7 @@ build_flags = ${esp32_base.build_flags} -D MESHTASTIC_EXCLUDE_WEBSERVER=1 -D INPUTDRIVER_I2C_KBD_TYPE=0x55 -D INPUTDRIVER_ENCODER_TYPE=3 -; -D INPUTDRIVER_ENCODER_LEFT=1 ; disabled because it's used by I2S audio + -D INPUTDRIVER_ENCODER_LEFT=1 -D INPUTDRIVER_ENCODER_RIGHT=2 -D INPUTDRIVER_ENCODER_UP=3 -D INPUTDRIVER_ENCODER_DOWN=15 diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index b39212680d..72320fc244 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -75,7 +75,7 @@ #define DAC_I2S_BCK 7 #define DAC_I2S_WS 5 #define DAC_I2S_DOUT 6 -#define DAC_I2S_MCLK 1 +#define DAC_I2S_MCLK 48 // GPIO mclk mic // LoRa #define USE_SX1262 From 86792f79407f3f30a0949caba2cbceea86b9bbd5 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 11 Nov 2024 21:28:34 +0100 Subject: [PATCH 294/322] swap mclk to gpio 21 --- variants/t-deck/variant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index 72320fc244..d754834edb 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -75,7 +75,7 @@ #define DAC_I2S_BCK 7 #define DAC_I2S_WS 5 #define DAC_I2S_DOUT 6 -#define DAC_I2S_MCLK 48 // GPIO mclk mic +#define DAC_I2S_MCLK 21 // GPIO lrck mic // LoRa #define USE_SX1262 From 13f0a6de9e6376677cda4f0edc8e69444fbc41cb Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 12 Nov 2024 19:06:17 +0100 Subject: [PATCH 295/322] update meshtab voltage divider --- variants/mesh-tab/variant.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/mesh-tab/variant.h b/variants/mesh-tab/variant.h index 0a23a3c368..c45ebfcedc 100644 --- a/variants/mesh-tab/variant.h +++ b/variants/mesh-tab/variant.h @@ -7,8 +7,8 @@ // Analog pins #define BATTERY_PIN 4 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage -// ratio of voltage divider = 2.0 -#define ADC_MULTIPLIER 2.11 // 2.0 + 10% for correction of display undervoltage. +// ratio of voltage divider (100k, 220k) +#define ADC_MULTIPLIER 1.6 // 1.45 + 10% for correction of display undervoltage. #define ADC_CHANNEL ADC1_GPIO4_CHANNEL // LED From bece512056ee82c1d5eaf22d958c08953e0b152f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 14 Nov 2024 00:29:56 +0100 Subject: [PATCH 296/322] update mesh-tab ini --- variants/mesh-tab/platformio.ini | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index fd1796b4af..13325840dc 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -83,12 +83,13 @@ build_flags = ${mesh_tab_base.build_flags} [env:mesh-tab-3-5-IPS-resistive] extends = mesh_tab_base build_flags = ${mesh_tab_base.build_flags} + -D DISPLAY_SET_RESOLUTION -D LGFX_SCREEN_WIDTH=320 -D LGFX_SCREEN_HEIGHT=480 -D LGFX_PANEL=ILI9488 -D LGFX_INVERT_COLOR=true -D LGFX_RGB_ORDER=false - -D LGFX_DLEN_16BITS=true + -D LGFX_DLEN_16BITS=false -D LGFX_ROTATION=1 -D LGFX_TOUCH=XPT2046 -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz @@ -107,15 +108,15 @@ build_flags = ${mesh_tab_base.build_flags} [env:mesh-tab-3-5-TN-resistive] extends = mesh_tab_base build_flags = ${mesh_tab_base.build_flags} + -D DISPLAY_SET_RESOLUTION -D LGFX_SCREEN_WIDTH=320 -D LGFX_SCREEN_HEIGHT=480 -D LGFX_PANEL=HX8357B - -D LV_COLOR_DEPTH=24 - -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz + -D SPI_FREQUENCY=60000000 -D LGFX_INVERT_COLOR=false -D LGFX_RGB_ORDER=false - -D LGFX_DLEN_16BITS=true - -D LGFX_ROTATION=1 + -D LGFX_DLEN_16BITS=false + -D LGFX_ROTATION=4 -D LGFX_TOUCH=XPT2046 -D LGFX_TOUCH_SPI_HOST=2 -D LGFX_TOUCH_CS=7 @@ -156,12 +157,13 @@ build_flags = ${mesh_tab_base.build_flags} [env:mesh-tab-3-5-IPS-capacitive] extends = mesh_tab_base build_flags = ${mesh_tab_base.build_flags} + -D DISPLAY_SET_RESOLUTION -D LGFX_SCREEN_WIDTH=320 -D LGFX_SCREEN_HEIGHT=480 -D LGFX_PANEL=ILI9488 -D LGFX_INVERT_COLOR=true -D LGFX_RGB_ORDER=false - -D LGFX_DLEN_16BITS=true + -D LGFX_DLEN_16BITS=false -D LGFX_ROTATION=1 -D LGFX_TOUCH=FT5x06 -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz @@ -181,12 +183,13 @@ build_flags = ${mesh_tab_base.build_flags} [env:mesh-tab-4-0-IPS-capacitive] extends = mesh_tab_base build_flags = ${mesh_tab_base.build_flags} + -D DISPLAY_SET_RESOLUTION -D LGFX_SCREEN_WIDTH=320 -D LGFX_SCREEN_HEIGHT=480 -D LGFX_PANEL=HX8357B -D LGFX_INVERT_COLOR=true -D LGFX_RGB_ORDER=false - -D LGFX_DLEN_16BITS=true + -D LGFX_DLEN_16BITS=false -D LGFX_ROTATION=4 -D LGFX_TOUCH=FT5x06 -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz From c06b44694cc34ca77e5513e6c53375174dc8c054 Mon Sep 17 00:00:00 2001 From: virgil Date: Thu, 14 Nov 2024 18:21:24 +0800 Subject: [PATCH 297/322] Fixed the issue that indicator device uploads via rp2040 serial port in some cases. --- boards/seeed-sensecap-indicator.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/seeed-sensecap-indicator.json b/boards/seeed-sensecap-indicator.json index 6ce8d36adc..0a02fc8826 100644 --- a/boards/seeed-sensecap-indicator.json +++ b/boards/seeed-sensecap-indicator.json @@ -34,9 +34,9 @@ "flash_size": "8MB", "maximum_ram_size": 327680, "maximum_size": 8388608, - "require_upload_port": true, + "require_upload_port": false, "use_1200bps_touch": true, - "wait_for_upload_port": true, + "wait_for_upload_port": false, "speed": 921600 }, "url": "https://www.seeedstudio.com/Indicator-for-Meshtastic.html", From e697d2ceae510084c16d706c93dd96107137584b Mon Sep 17 00:00:00 2001 From: virgil Date: Thu, 14 Nov 2024 18:22:43 +0800 Subject: [PATCH 298/322] Fixed the issue that the touch I2C address definition was not effective. --- variants/seeed-sensecap-indicator/platformio.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 1399c76870..0fd006865d 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -75,7 +75,6 @@ build_flags = ${esp32_base.build_flags} -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D CUSTOM_TOUCH_DRIVER - -D FT6X36_ADDR=0x48 -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_INDICATOR -D VIEW_320x240 @@ -91,6 +90,6 @@ build_src_filter = ${esp32_base.build_src_filter} lib_deps = ${esp32s3_base.lib_deps} https://github.com/mverch67/LovyanGFX#develop ; file:///home/manuel/Documents/PlatformIO/Projects/LovyanGFX - bitbank2/bb_captouch@1.2.2 ; alternative touch library supporting FT6x36 + https://github.com/bitbank2/bb_captouch ; alternative touch library supporting FT6x36 earlephilhower/ESP8266Audio@^1.9.7 earlephilhower/ESP8266SAM@^1.0.1 From b932d43974543b707521babb152671c4b3edc336 Mon Sep 17 00:00:00 2001 From: virgil Date: Thu, 14 Nov 2024 18:23:44 +0800 Subject: [PATCH 299/322] Fixed the issue that the wifi configuration saved to RAM did not take effect. --- src/mesh/wifi/WiFiAPClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index faf5ce3de8..630a227d86 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -214,7 +214,7 @@ bool initWifi() #if !MESHTASTIC_EXCLUDE_WEBSERVER createSSLCert(); // For WebServer #endif - esp_wifi_set_storage(WIFI_STORAGE_RAM); // Disable flash storage for WiFi credentials + WiFi.persistent(false); // Disable flash storage for WiFi credentials #endif if (!*wifiPsw) // Treat empty password as no password wifiPsw = NULL; From 0b088e1c734def7489b00a421c7d6c57d91f1b40 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 14 Nov 2024 11:27:33 +0100 Subject: [PATCH 300/322] rotation fix; added ST7789 3.2" display --- variants/mesh-tab/platformio.ini | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index 13325840dc..49c9c6377e 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -56,6 +56,29 @@ build_src_filter = ${esp32_base.build_src_filter} lib_deps = ${esp32_base.lib_deps} lovyan03/LovyanGFX@^1.1.16 +; 3.2" TN TFT ST7789 / XPT2046: https://vi.aliexpress.com/item/1005005933490544.html +[env:mesh-tab-3-2-TN-resistive] +extends = mesh_tab_base +build_flags = ${mesh_tab_base.build_flags} + -D LGFX_SCREEN_WIDTH=240 + -D LGFX_SCREEN_HEIGHT=320 + -D LGFX_PANEL=ST7789 + -D LGFX_INVERT_COLOR=false + -D LGFX_RGB_ORDER=false + -D LGFX_ROTATION=1 + -D LGFX_TOUCH=XPT2046 + -D SPI_FREQUENCY=60000000 + -D LGFX_TOUCH_SPI_HOST=2 + -D LGFX_TOUCH_CS=7 + -D LGFX_TOUCH_CLK=12 + -D LGFX_TOUCH_DO=11 + -D LGFX_TOUCH_DIN=13 + -D LGFX_TOUCH_X_MIN=300 + -D LGFX_TOUCH_X_MAX=3900 + -D LGFX_TOUCH_Y_MIN=400 + -D LGFX_TOUCH_Y_MAX=3900 + -D LGFX_TOUCH_ROTATION=4 + ; 3.2" IPS TFT ILI9341 / XPT2046: https://www.aliexpress.com/item/1005006258575617.html [env:mesh-tab-3-2-IPS-resistive] extends = mesh_tab_base @@ -90,7 +113,7 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_INVERT_COLOR=true -D LGFX_RGB_ORDER=false -D LGFX_DLEN_16BITS=false - -D LGFX_ROTATION=1 + -D LGFX_ROTATION=2 -D LGFX_TOUCH=XPT2046 -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz -D LGFX_TOUCH_SPI_HOST=2 From 9a9172ff521cd406fb62a3ff401c25f33cb582dd Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 15 Nov 2024 16:36:01 +0100 Subject: [PATCH 301/322] dreamcatcher: assign GPIO44 to audio mclk --- variants/dreamcatcher/variant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/dreamcatcher/variant.h b/variants/dreamcatcher/variant.h index c6a77266de..7835979e1e 100644 --- a/variants/dreamcatcher/variant.h +++ b/variants/dreamcatcher/variant.h @@ -60,7 +60,7 @@ #define DAC_I2S_BCK 21 #define DAC_I2S_WS 9 #define DAC_I2S_DOUT 48 -#define DAC_I2S_MCLK 1 +#define DAC_I2S_MCLK 44 #define BIAS_T_ENABLE 7 // needs to be low #define BIAS_T_VALUE 0 From 7e7943920ca2c10c32f5ae58afea0ce1ac572419 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 16 Nov 2024 22:34:10 +0100 Subject: [PATCH 302/322] mesh-tab touch updates --- variants/mesh-tab/platformio.ini | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index 49c9c6377e..d616e8ac47 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -68,6 +68,7 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_ROTATION=1 -D LGFX_TOUCH=XPT2046 -D SPI_FREQUENCY=60000000 + -D LGFX_TOUCH_SPI_FREQ=2500000 -D LGFX_TOUCH_SPI_HOST=2 -D LGFX_TOUCH_CS=7 -D LGFX_TOUCH_CLK=12 @@ -91,6 +92,7 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_ROTATION=1 -D LGFX_TOUCH=XPT2046 -D SPI_FREQUENCY=60000000 ; if image is distorted then lower to 40 MHz + -D LGFX_TOUCH_SPI_FREQ=2500000 -D LGFX_TOUCH_SPI_HOST=2 -D LGFX_TOUCH_CS=7 -D LGFX_TOUCH_CLK=12 @@ -115,7 +117,8 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_DLEN_16BITS=false -D LGFX_ROTATION=2 -D LGFX_TOUCH=XPT2046 - -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz + -D SPI_FREQUENCY=40000000 ; may go higher upto 40/60/80 MHz + -D LGFX_TOUCH_SPI_FREQ=2500000 -D LGFX_TOUCH_SPI_HOST=2 -D LGFX_TOUCH_CS=7 -D LGFX_TOUCH_CLK=12 @@ -125,7 +128,7 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_TOUCH_X_MAX=3900 -D LGFX_TOUCH_Y_MIN=400 -D LGFX_TOUCH_Y_MAX=3900 - -D LGFX_TOUCH_ROTATION=1 + -D LGFX_TOUCH_ROTATION=0 ; 3.5" TN TFT ILI9488 / XPT2046: https://vi.aliexpress.com/item/32985467436.html [env:mesh-tab-3-5-TN-resistive] @@ -141,6 +144,7 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_DLEN_16BITS=false -D LGFX_ROTATION=4 -D LGFX_TOUCH=XPT2046 + -D LGFX_TOUCH_SPI_FREQ=2500000 -D LGFX_TOUCH_SPI_HOST=2 -D LGFX_TOUCH_CS=7 -D LGFX_TOUCH_CLK=12 @@ -150,7 +154,7 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_TOUCH_X_MAX=3900 -D LGFX_TOUCH_Y_MIN=400 -D LGFX_TOUCH_Y_MAX=3900 - -D LGFX_TOUCH_ROTATION=1 + -D LGFX_TOUCH_ROTATION=2 ; 3.2" IPS TFT ILI9341 / FT6236: https://vi.aliexpress.com/item/1005006624072350.html [env:mesh-tab-3-2-IPS-capacitive] From db2fcea4a14830a033a9a2bde2cd99c57bd8d1ed Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 17 Nov 2024 01:32:02 +0100 Subject: [PATCH 303/322] add mesh-tab powersave as default --- src/mesh/NodeDB.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 34743661d9..1cfd5ac0de 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -514,7 +514,7 @@ void NodeDB::initConfigIntervals() config.display.screen_on_secs = default_screen_on_secs; -#if defined(T_WATCH_S3) || defined(T_DECK) || defined(RAK14014) +#if defined(T_WATCH_S3) || defined(T_DECK) || defined(MESH_TAB) || defined(RAK14014) config.power.is_power_saving = true; config.display.screen_on_secs = 30; config.power.wait_bluetooth_secs = 30; From 87b82f5e00a1f9e0c11ae91151ea38e79b490106 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 17 Nov 2024 01:35:16 +0100 Subject: [PATCH 304/322] fix DIO1 wakeup --- variants/mesh-tab/variant.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/variants/mesh-tab/variant.h b/variants/mesh-tab/variant.h index c45ebfcedc..533c931bcb 100644 --- a/variants/mesh-tab/variant.h +++ b/variants/mesh-tab/variant.h @@ -17,6 +17,9 @@ // Button #define BUTTON_PIN 0 +// Button +#define PIN_BUZZER 5 + // GPS #define GPS_RX_PIN 18 #define GPS_TX_PIN 17 @@ -28,20 +31,26 @@ #define SPI_CS 10 #define SDCARD_CS 6 +// LORA MODULES +#define USE_SX1262 + // LORA SPI #define LORA_SCK 36 #define LORA_MISO 37 #define LORA_MOSI 35 #define LORA_CS 39 -// LORA MODULES -#define USE_SX1262 - // LORA CONFIG +#define LORA_DIO0 -1 // a No connect on the SX1262 module +#define LORA_RESET 14 +#define LORA_DIO1 15 // SX1262 IRQ +#define LORA_DIO2 40 // SX1262 BUSY +#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262 + #define SX126X_CS LORA_CS -#define SX126X_DIO1 15 +#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO2_AS_RF_SWITCH -#define SX126X_BUSY 40 +#define SX126X_BUSY LORA_DIO2 #define SX126X_RESET 14 #define SX126X_RXEN 47 #define SX126X_TXEN RADIOLIB_NC // Assuming that DIO2 is connected to TXEN pin From 9a5112cbca2f728476956992d7a3faa36d2a105c Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 17 Nov 2024 01:52:24 +0100 Subject: [PATCH 305/322] mesh-tab: enable alert message menu --- variants/mesh-tab/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index d616e8ac47..639b9f753c 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -33,6 +33,7 @@ build_flags = ${esp32s3_base.build_flags} -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 + -D USE_PIN_BUZZER -D RAM_SIZE=1024 -D LGFX_DRIVER_TEMPLATE -D LGFX_DRIVER=LGFX_GENERIC From 630568c090db214f8e2b04e9fb8d2dc718214f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 19 Nov 2024 11:46:22 +0100 Subject: [PATCH 306/322] Streamline board definitions for first tech preview. (#5390) * Streamline board definitions for first tech preview. TBD: Indicator Support * add point-of-checkin * use board/unphone.json --------- Co-authored-by: mverch67 --- arch/nrf52/nrf52.ini | 4 +- src/main.cpp | 1 - variants/picomputer-s3/platformio.ini | 32 +++++---- variants/portduino/platformio.ini | 70 +++++++------------ .../seeed-sensecap-indicator/platformio.ini | 43 ++++-------- variants/t-deck/platformio.ini | 37 +++++++--- variants/tlora_t3s3_v1/platformio.ini | 69 ------------------ variants/unphone/platformio.ini | 44 ++++-------- 8 files changed, 98 insertions(+), 202 deletions(-) diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index fd62a60064..9518991a62 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -1,10 +1,10 @@ [nrf52_base] ; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files -platform = platformio/nordicnrf52@^10.5.0 +platform = platformio/nordicnrf52@^10.6.0 extends = arduino_base platform_packages = ; our custom Git version until they merge our PR - framework-arduinoadafruitnrf52 @ https://github.com/geeksville/Adafruit_nRF52_Arduino.git + framework-arduinoadafruitnrf52 @ https://github.com/geeksville/Adafruit_nRF52_Arduino.git#4f591d0f71f75e5128fab9dc42ac72f1696cf89f toolchain-gccarmnoneeabi@~1.90301.0 build_type = debug build_flags = diff --git a/src/main.cpp b/src/main.cpp index 35c7974af1..c6a16c7ebc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -294,7 +294,6 @@ void setup() #endif powerMonInit(); - serialSinceMsec = millis(); LOG_INFO("\n\n//\\ E S H T /\\ S T / C\n"); diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index 8bffdcaa78..0016d61312 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -1,7 +1,8 @@ -[env:picomputer-s3-oled] +[env:picomputer-s3] extends = esp32s3_base board = bpi_picow_esp32_s3 - +board_check = true +board_level = extra ;OpenOCD flash method ;upload_protocol = esp-builtin ;Normal method @@ -14,17 +15,19 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.8 + lovyan03/LovyanGFX@^1.1.16 +build_src_filter = + ${esp32s3_base.build_src_filter} -[env:picomputer-s3] -extends = esp32s3_base -board = bpi_picow_esp32_s3 + +[env:picomputer-s3-tft] +extends = env:picomputer-s3 +board_level = main board_build.partitions = default_8MB.csv ; just for test -board_check = true -upload_protocol = esptool -build_flags = ${esp32_base.build_flags} - -D PICOMPUTER_S3 + +build_flags = + ${env:picomputer-s3.build_flags} -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 @@ -50,12 +53,11 @@ build_flags = ${esp32_base.build_flags} ; -D USE_DOUBLE_BUFFER -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 - -I variants/picomputer-s3 -build_src_filter = ${esp32_base.build_src_filter} + +build_src_filter = + ${env:picomputer-s3.build_src_filter} +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/resources> +<../lib/device-ui/locale> +<../lib/device-ui/source> -lib_deps = - ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.16 + diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index fcf687461d..78d81358e6 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -3,6 +3,7 @@ extends = portduino_base ; The pkg-config commands below optionally add link flags. ; the || : is just a "or run the null command" to avoid returning an error code build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino + -D ARCH_PORTDUINO -I /usr/include !pkg-config --libs libulfius --silence-errors || : !pkg-config --libs openssl --silence-errors || : @@ -10,26 +11,23 @@ board = cross_platform lib_deps = ${portduino_base.lib_deps} build_src_filter = ${portduino_base.build_src_filter} -[env:native-tft-debug] -extends = portduino_base -build_type = debug -build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 -linput -lxkbcommon - -D ARCH_PORTDUINO + +[env:native-tft] +extends = env:native +build_type = release +build_flags = ${portduino_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunction-sections -fdata-sections -Wl,--gc-sections -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 - -I variants/portduino - -I /usr/include - -D DEBUG_HEAP -D RAM_SIZE=16384 -D USE_X11=1 ; enables usage of X11 -D HAS_TFT=1 -D HAS_SCREEN=0 -; -D CALIBRATE_TOUCH=0 -D LV_BUILD_TEST=0 - -D LV_USE_LOG=1 - -D LV_USE_SYSMON=1 - -D LV_USE_PERF_MONITOR=1 - -D LV_USE_MEM_MONITOR=0 +; -D CALIBRATE_TOUCH=0 + -D LV_USE_LOG=0 + -D LV_USE_SYSMON=0 -D LV_USE_PROFILER=0 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 -D LV_USE_LIBINPUT=1 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE @@ -38,12 +36,8 @@ build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 -linput -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 -; The pkg-config commands below optionally add link flags. -; the || : is just a "or run the null command" to avoid returning an error code - !pkg-config --libs libulfius --silence-errors || : - !pkg-config --libs openssl --silence-errors || : -board = cross_platform -build_src_filter = ${portduino_base.build_src_filter} + +build_src_filter = ${env:native.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/generated/ui_320x240/fonts> @@ -52,26 +46,25 @@ build_src_filter = ${portduino_base.build_src_filter} +<../lib/device-ui/locale> +<../lib/device-ui/source> - -[env:native-tft-release] -extends = portduino_base -build_type = release -build_flags = ${portduino_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunction-sections -fdata-sections -Wl,--gc-sections - -D ARCH_PORTDUINO + +[env:native-tft-debug] +extends = env:native-tft +build_type = debug +board_level = extra +build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 -linput -lxkbcommon -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 - -I variants/portduino - -I /usr/include + -D DEBUG_HEAP -D RAM_SIZE=16384 -D USE_X11=1 ; enables usage of X11 -D HAS_TFT=1 -D HAS_SCREEN=0 - -D LV_BUILD_TEST=0 ; -D CALIBRATE_TOUCH=0 - -D LV_USE_LOG=0 - -D LV_USE_SYSMON=0 - -D LV_USE_PROFILER=0 - -D LV_USE_PERF_MONITOR=0 + -D LV_BUILD_TEST=0 + -D LV_USE_LOG=1 + -D LV_USE_SYSMON=1 + -D LV_USE_PERF_MONITOR=1 -D LV_USE_MEM_MONITOR=0 + -D LV_USE_PROFILER=0 -D LV_USE_LIBINPUT=1 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE @@ -80,16 +73,3 @@ build_flags = ${portduino_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunc -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 -; The pkg-config commands below optionally add link flags. -; the || : is just a "or run the null command" to avoid returning an error code - !pkg-config --libs libulfius --silence-errors || : - !pkg-config --libs openssl --silence-errors || : -board = cross_platform -build_src_filter = ${portduino_base.build_src_filter} - - - +<../lib/device-ui/generated/ui_320x240> - +<../lib/device-ui/generated/ui_320x240/fonts> - +<../lib/device-ui/resources> - +<../lib/device-ui/portduino> - +<../lib/device-ui/locale> - +<../lib/device-ui/source> \ No newline at end of file diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 0fd006865d..a6e75f9b19 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -6,6 +6,7 @@ platform_packages = board = seeed-sensecap-indicator board_check = true +board_level = extra upload_protocol = esptool build_flags = ${esp32_base.build_flags} @@ -24,22 +25,17 @@ build_flags = ${esp32_base.build_flags} lib_deps = ${esp32s3_base.lib_deps} https://github.com/mverch67/LovyanGFX#develop - earlephilhower/ESP8266Audio@^1.9.7 + earlephilhower/ESP8266Audio@^1.9.9 earlephilhower/ESP8266SAM@^1.0.1 [env:seeed-sensecap-indicator-tft] -extends = esp32s3_base -platform_packages = -; platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32 - platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 -board = seeed-sensecap-indicator -board_check = true -board_level = extra +extends = env:seeed-sensecap-indicator +board_level = main board_build.partitions = default_8MB.csv ; must be here for some reason, board.json is not enough !? -upload_protocol = esptool -build_flags = ${esp32_base.build_flags} - -D SENSECAP_INDICATOR + +build_flags = + ${env:seeed-sensecap-indicator.build_flags} -D HAS_TELEMETRY=0 -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 @@ -47,17 +43,7 @@ build_flags = ${esp32_base.build_flags} -D MESHTASTIC_EXCLUDE_SCREEN=1 -D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 -D HAS_TELEMETRY=0 - -D CONFIG_ARDUHAL_LOG_COLORS -D CONFIG_DISABLE_HAL_LOCKS=1 - -D RADIOLIB_DEBUG_SPI=0 - -D RADIOLIB_DEBUG_PROTOCOL=0 - -D RADIOLIB_DEBUG_BASIC=0 - -D RADIOLIB_VERBOSE_ASSERT=0 - -D RADIOLIB_SPI_PARANOID=0 - -D IO_EXPANDER=0x40 - -D IO_EXPANDER_IRQ=42 - ;-D IO_EXPANDER_DEBUG - -D USE_ARDUINO_HAL_GPIO -D MAX_NUM_NODES=250 -D HAS_SCREEN=0 -D HAS_TFT=1 @@ -81,15 +67,14 @@ build_flags = ${esp32_base.build_flags} ; -D USE_DOUBLE_BUFFER -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 - -I variants/seeed-sensecap-indicator -build_src_filter = ${esp32_base.build_src_filter} + +build_src_filter = + ${env:seeed-sensecap-indicator.build_src_filter} +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/resources> +<../lib/device-ui/locale> +<../lib/device-ui/source> -lib_deps = ${esp32s3_base.lib_deps} - https://github.com/mverch67/LovyanGFX#develop -; file:///home/manuel/Documents/PlatformIO/Projects/LovyanGFX - https://github.com/bitbank2/bb_captouch ; alternative touch library supporting FT6x36 - earlephilhower/ESP8266Audio@^1.9.7 - earlephilhower/ESP8266SAM@^1.0.1 + +lib_deps = + ${env:seeed-sensecap-indicator.lib_deps} + https://github.com/bitbank2/bb_captouch.git#8f2f06462ff597847921739376a299db93612417 ; alternative touch library supporting FT6x36 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index bd18111b62..f84fc08b93 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -3,11 +3,29 @@ extends = esp32s3_base board = t-deck board_level = extra -board_build.partitions = default_16MB.csv ; just for test board_check = true upload_protocol = esptool -build_flags = ${esp32_base.build_flags} - -D T_DECK + +build_flags = ${esp32s3_base.build_flags} + -DT_DECK + -DBOARD_HAS_PSRAM + -DMAX_THREADS=40 + -DGPS_POWER_TOGGLE + -Ivariants/t-deck + +lib_deps = ${esp32s3_base.lib_deps} + lovyan03/LovyanGFX@^1.1.16 + earlephilhower/ESP8266Audio@^1.9.9 + earlephilhower/ESP8266SAM@^1.0.1 + + +[env:t-deck-tft] +extends = env:t-deck +board_build.partitions = default_16MB.csv ; just for test +board_level = main + +build_flags = + ${env:t-deck.build_flags} -D CONFIG_DISABLE_HAL_LOCKS=1 ; "feels" to be a bit more stable without locks -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 @@ -21,12 +39,10 @@ build_flags = ${esp32_base.build_flags} -D INPUTDRIVER_ENCODER_DOWN=15 -D INPUTDRIVER_ENCODER_BTN=0 -D MAX_NUM_NODES=250 - -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 -D USE_I2S_BUZZER -D RAM_SIZE=1024 - -D GPS_POWER_TOGGLE -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE @@ -47,15 +63,14 @@ build_flags = ${esp32_base.build_flags} ; -D USE_DOUBLE_BUFFER -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 - -I variants/t-deck -build_src_filter = ${esp32_base.build_src_filter} + +build_src_filter = + ${env:t-deck.build_src_filter} +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/resources> +<../lib/device-ui/locale> +<../lib/device-ui/source> + lib_deps = - ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.16 + ${env:t-deck.lib_deps} bitbank2/bb_captouch@1.2.2 ; alternative touch library supporting GT911 - earlephilhower/ESP8266Audio@^1.9.9 - earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file diff --git a/variants/tlora_t3s3_v1/platformio.ini b/variants/tlora_t3s3_v1/platformio.ini index c062dbd7b0..0b27b881b5 100644 --- a/variants/tlora_t3s3_v1/platformio.ini +++ b/variants/tlora_t3s3_v1/platformio.ini @@ -7,72 +7,3 @@ upload_protocol = esptool build_flags = ${esp32_base.build_flags} -D TLORA_T3S3_V1 -I variants/tlora_t3s3_v1 -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. - - -[env:tlora-t3s3-tft] -extends = esp32s3_base -board = tlora-t3s3-v1 -;board_check = true -upload_protocol = esp-builtin - -build_flags = ${esp32_base.build_flags} - -D TLORA_T3S3_V1 - -D MESHTASTIC_EXCLUDE_SCREEN=1 - -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 - -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 - -D MESHTASTIC_EXCLUDE_PAXCOUNTER=1 - -D MESHTASTIC_EXCLUDE_WEBSERVER=1 - -D MESHTASTIC_EXCLUDE_GPS=1 - -D MESHTASTIC_EXCLUDE_AUDIO=1 - -D MESHTASTIC_EXCLUDE_POWER_TELEMETRY=1 - -D MESHTASTIC_EXCLUDE_ATAK=1 - -D MESHTASTIC_EXCLUDE_REMOTEHARDWARE=1 - -D MAX_NUM_NODES=250 - -D HAS_SCREEN=0 - -D HAS_TFT=1 - -D RAM_SIZE=1024 - -D LV_LVGL_H_INCLUDE_SIMPLE - -D LV_CONF_INCLUDE_SIMPLE - -D LV_COMP_CONF_INCLUDE_SIMPLE - -D LV_USE_SYSMON=0 - -D LV_USE_PROFILER=0 - -D LV_USE_PERF_MONITOR=0 - -D LV_USE_MEM_MONITOR=0 - -D LV_USE_LOG=0 - -D USE_LOG_DEBUG - -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -; -D CALIBRATE_TOUCH=0 - -D LGFX_DRIVER_TEMPLATE - -D LGFX_DRIVER=LGFX_GENERIC - -D LGFX_PANEL=ST7789 - -D LGFX_OFFSET_ROTATION=1 - -D LGFX_TOUCH=XPT2046 - -D LGFX_PIN_SCK=12 - -D LGFX_PIN_MOSI=15 - -D LGFX_PIN_MISO=16 - -D LGFX_PIN_DC=47 - -D LGFX_PIN_CS=48 - -D LGFX_PIN_RST=34 - -D LGFX_PIN_BL=35 - -D LGFX_TOUCH_INT=38 - -D LGFX_TOUCH_CS=39 - -D LGFX_TOUCH_CLK=12 - -D LGFX_TOUCH_DO=15 - -D LGFX_TOUCH_DIN=16 - -D LGFX_TOUCH_X_MIN=300 - -D LGFX_TOUCH_X_MAX=3900 - -D LGFX_TOUCH_Y_MIN=400 - -D LGFX_TOUCH_Y_MAX=3900 - -D VIEW_320x240 -; -D USE_DOUBLE_BUFFER - -D USE_PACKET_API - -I variants/tlora_t3s3_v1 - -I lib/device-ui/generated/ui_320x240 -build_src_filter = ${esp32_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> - +<../lib/device-ui/resources> - +<../lib/device-ui/locale> - +<../lib/device-ui/source> -lib_deps = - ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.16 diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index b41848e134..8ffcab049d 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -1,18 +1,15 @@ ; platformio.ini for unphone meshtastic [env:unphone] - extends = esp32s3_base -board = unphone9 +board = unphone +board_level = extra upload_speed = 921600 monitor_speed = 115200 monitor_filters = esp32_exception_decoder -build_unflags = - ${esp32s3_base.build_unflags} - -D ARDUINO_USB_MODE - -build_flags = ${esp32_base.build_flags} +build_flags = + ${esp32s3_base.build_flags} -D UNPHONE -I variants/unphone -D ARDUINO_USB_MODE=0 @@ -22,8 +19,11 @@ build_flags = ${esp32_base.build_flags} -D UNPHONE_UI0=0 -D UNPHONE_LORA=0 -D UNPHONE_FACTORY_MODE=0 + -D USE_SX127x -build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone> +build_src_filter = + ${esp32s3_base.build_src_filter} + +<../variants/unphone> lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@ 1.1.16 @@ -32,25 +32,15 @@ lib_deps = ${esp32s3_base.lib_deps} [env:unphone-tft] -extends = esp32s3_base -board_level = extra -board = unphone +extends = env:unphone +board_level = main board_build.partitions = default_8MB.csv -monitor_speed = 115200 -monitor_filters = esp32_exception_decoder -build_flags = ${esp32_base.build_flags} - -D UNPHONE - -D UNPHONE_ACCEL=0 - -D UNPHONE_TOUCHS=0 - -D UNPHONE_SDCARD=0 - -D UNPHONE_UI0=0 - -D UNPHONE_LORA=0 - -D UNPHONE_FACTORY_MODE=0 +build_flags = + ${env:unphone.build_flags} -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 -D MESHTASTIC_EXCLUDE_WEBSERVER=1 - -D USE_SX127x -D MAX_NUM_NODES=200 -D MAX_THREADS=40 -D HAS_SCREEN=0 @@ -71,18 +61,12 @@ build_flags = ${esp32_base.build_flags} -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_UNPHONE_V9 -D VIEW_320x240 -; -D USE_DOUBLE_BUFFER -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 - -I variants/unphone -build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone> +build_src_filter = + ${env:unphone.build_src_filter} +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/resources> +<../lib/device-ui/locale> +<../lib/device-ui/source> - -lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.16 - https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic@9.0.0 - adafruit/Adafruit NeoPixel@1.12.0 \ No newline at end of file From 6bb0e8a5b22c14b6c25cf68c3f89f8a2cdf7f2e8 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 20 Nov 2024 09:37:00 +0100 Subject: [PATCH 307/322] fix native targets --- variants/portduino/platformio.ini | 38 ++++++++++++++----------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 78d81358e6..216b24e395 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -1,33 +1,30 @@ -[env:native] +[native_base] extends = portduino_base -; The pkg-config commands below optionally add link flags. -; the || : is just a "or run the null command" to avoid returning an error code -build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino +build_flags = ${portduino_base.build_flags} -I variants/portduino -D ARCH_PORTDUINO -I /usr/include - !pkg-config --libs libulfius --silence-errors || : - !pkg-config --libs openssl --silence-errors || : board = cross_platform lib_deps = ${portduino_base.lib_deps} build_src_filter = ${portduino_base.build_src_filter} +[env:native] +extends = native_base +; The pkg-config commands below optionally add link flags. +; the || : is just a "or run the null command" to avoid returning an error code +build_flags = ${native_base.build_flags} + !pkg-config --libs libulfius --silence-errors || : + !pkg-config --libs openssl --silence-errors || : [env:native-tft] -extends = env:native +extends = native_base build_type = release -build_flags = ${portduino_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunction-sections -fdata-sections -Wl,--gc-sections +build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunction-sections -fdata-sections -Wl,--gc-sections -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D RAM_SIZE=16384 - -D USE_X11=1 ; enables usage of X11 + -D USE_X11=1 -D HAS_TFT=1 -D HAS_SCREEN=0 -D LV_BUILD_TEST=0 -; -D CALIBRATE_TOUCH=0 - -D LV_USE_LOG=0 - -D LV_USE_SYSMON=0 - -D LV_USE_PROFILER=0 - -D LV_USE_PERF_MONITOR=0 - -D LV_USE_MEM_MONITOR=0 -D LV_USE_LIBINPUT=1 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE @@ -36,8 +33,7 @@ build_flags = ${portduino_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunc -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 - -build_src_filter = ${env:native.build_src_filter} +build_src_filter = ${native_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/generated/ui_320x240/fonts> @@ -46,16 +42,15 @@ build_src_filter = ${env:native.build_src_filter} +<../lib/device-ui/locale> +<../lib/device-ui/source> - [env:native-tft-debug] -extends = env:native-tft +extends = native_base build_type = debug board_level = extra -build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 -linput -lxkbcommon +build_flags = ${native_base.build_flags} -O0 -fsanitize=address -lX11 -linput -lxkbcommon -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D DEBUG_HEAP -D RAM_SIZE=16384 - -D USE_X11=1 ; enables usage of X11 + -D USE_X11=1 -D HAS_TFT=1 -D HAS_SCREEN=0 ; -D CALIBRATE_TOUCH=0 @@ -73,3 +68,4 @@ build_flags = ${portduino_base.build_flags} -O0 -fsanitize=address -lX11 -linput -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 +build_src_filter = ${env:native-tft.build_src_filter} \ No newline at end of file From 21867e595607d94e9806c0a864c848327d139859 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 20 Nov 2024 09:44:12 +0100 Subject: [PATCH 308/322] add RadioLib debugging options for (T-Deck) --- variants/t-deck/platformio.ini | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index f84fc08b93..7142bfd607 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -53,6 +53,12 @@ build_flags = -D LV_USE_LOG=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D RADIOLIB_BUILD_ARDUINO + -D RADIOLIB_DEBUG=0 + -D RADIOLIB_DEBUG_BASIC=0 + -D RADIOLIB_DEBUG_SPI=0 + -D RADIOLIB_DEBUG_PROTOCOL=0 + -D RADIOLIB_VERBOSE_ASSERT=1 -D RADIOLIB_SPI_PARANOID=0 -D CUSTOM_TOUCH_DRIVER -D CALIBRATE_TOUCH=0 From 3f997ba70ff65471c407e6c82ad36fbc284de694 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 20 Nov 2024 16:26:45 +0100 Subject: [PATCH 309/322] fix T-Deck build --- variants/t-deck/variant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index d754834edb..d2f6a14b4f 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -1,5 +1,5 @@ // ST7789 TFT LCD -// #define ST7789_CS 12 +#define ST7789_CS 12 #define ST7789_RS 11 // DC #define ST7789_SDA 41 // MOSI #define ST7789_SCK 40 From 0f31e359cb7a092b5a02298b637bd8f509bc0b4f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 23 Nov 2024 11:03:41 +0000 Subject: [PATCH 310/322] fix native tft targets for rpi --- variants/portduino/platformio.ini | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 216b24e395..2e9207c1d9 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -33,6 +33,8 @@ build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunctio -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 + !pkg-config --libs libulfius --silence-errors || : + !pkg-config --libs openssl --silence-errors || : build_src_filter = ${native_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> @@ -68,4 +70,6 @@ build_flags = ${native_base.build_flags} -O0 -fsanitize=address -lX11 -linput -l -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 + !pkg-config --libs libulfius --silence-errors || : + !pkg-config --libs openssl --silence-errors || : build_src_filter = ${env:native-tft.build_src_filter} \ No newline at end of file From 83a89f1abf3a53307dd69858331bbf2e13eb5caa Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 24 Nov 2024 15:04:19 +0100 Subject: [PATCH 311/322] remove wrong debug defines --- variants/t-deck/platformio.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 7142bfd607..3304361968 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -53,8 +53,6 @@ build_flags = -D LV_USE_LOG=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" - -D RADIOLIB_BUILD_ARDUINO - -D RADIOLIB_DEBUG=0 -D RADIOLIB_DEBUG_BASIC=0 -D RADIOLIB_DEBUG_SPI=0 -D RADIOLIB_DEBUG_PROTOCOL=0 From e29d0e85e68e6255ab3af47a5812b0fba02851d1 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 24 Nov 2024 15:17:42 +0100 Subject: [PATCH 312/322] t-deck-tft button is handled in device-ui --- variants/t-deck/variant.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index d2f6a14b4f..c0d0cfdc27 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -1,3 +1,6 @@ +#ifndef HAS_TFT // for TFT-UI the definitions are in device-ui +#define BUTTON_PIN 0 + // ST7789 TFT LCD #define ST7789_CS 12 #define ST7789_RS 11 // DC @@ -19,6 +22,7 @@ #define SCREEN_ROTATE #define SCREEN_TRANSITION_FRAMERATE 5 #define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness +#endif #define HAS_TOUCHSCREEN 1 #define SCREEN_TOUCH_INT 16 @@ -27,11 +31,6 @@ #define SLEEP_TIME 120 -#ifndef HAS_TFT -#define BUTTON_PIN 0 -// #define BUTTON_NEED_PULLUP -#endif - #define GPS_RX_PIN 44 #define GPS_TX_PIN 43 From 210dfb0013b5e05db1cd51b5801d8f22db50a881 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 25 Nov 2024 23:43:48 +0100 Subject: [PATCH 313/322] disable default lightsleep for indicator --- src/mesh/NodeDB.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index de9f5d44b6..ada6ebf084 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -550,7 +550,7 @@ void NodeDB::initConfigIntervals() config.display.screen_on_secs = default_screen_on_secs; -#if defined(T_WATCH_S3) || defined(T_DECK) || defined(MESH_TAB) || defined(SENSECAP_INDICATOR) || defined(RAK14014) +#if defined(T_WATCH_S3) || defined(T_DECK) || defined(MESH_TAB) || defined(RAK14014) config.power.is_power_saving = true; config.display.screen_on_secs = 30; config.power.wait_bluetooth_secs = 30; From 50f1cb85abb262403e4bc8c2d8a20a197ce922cb Mon Sep 17 00:00:00 2001 From: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com> Date: Wed, 27 Nov 2024 11:37:05 +0100 Subject: [PATCH 314/322] Windows Support - Trunk and Platformio (#5397) * Add support for GPG * Add usb device support * Add trunk.io to devcontainer * Trunk things * trunk fmt * formatting * fix trivy/DS002, checkov/CKV_DOCKER_3 * hide docker extension popup * fix trivy/DS026, checkov/CKV_DOCKER_2 --- .devcontainer/99-platformio-udev.rules | 183 +++++++++++++++++++++++++ .devcontainer/Dockerfile | 17 ++- .devcontainer/devcontainer.json | 13 +- 3 files changed, 210 insertions(+), 3 deletions(-) create mode 100644 .devcontainer/99-platformio-udev.rules diff --git a/.devcontainer/99-platformio-udev.rules b/.devcontainer/99-platformio-udev.rules new file mode 100644 index 0000000000..83c7b87317 --- /dev/null +++ b/.devcontainer/99-platformio-udev.rules @@ -0,0 +1,183 @@ +# Copyright (c) 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################################################################### +# +# INSTALLATION +# +# Please visit > https://docs.platformio.org/en/latest/core/installation/udev-rules.html +# +##################################################################################### + +# +# Boards +# + +# CP210X USB UART +ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea[67][013]", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" +ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="80a9", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# FT231XS USB UART +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Prolific Technology, Inc. PL2303 Serial Port +ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# QinHeng Electronics HL-340 USB-Serial adapter +ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" +# QinHeng Electronics CH343 USB-Serial adapter +ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d3", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" +# QinHeng Electronics CH9102 USB-Serial adapter +ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d4", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Arduino boards +ATTRS{idVendor}=="2341", ATTRS{idProduct}=="[08][023]*", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" +ATTRS{idVendor}=="2a03", ATTRS{idProduct}=="[08][02]*", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Arduino SAM-BA +ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{MTP_NO_PROBE}="1" + +# Digistump boards +ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Maple with DFU +ATTRS{idVendor}=="1eaf", ATTRS{idProduct}=="000[34]", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# USBtiny +ATTRS{idProduct}=="0c9f", ATTRS{idVendor}=="1781", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# USBasp V2.0 +ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Teensy boards +ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" +ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" +SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666" +KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666" + +# TI Stellaris Launchpad +ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# TI MSP430 Launchpad +ATTRS{idVendor}=="0451", ATTRS{idProduct}=="f432", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# GD32V DFU Bootloader +ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# FireBeetle-ESP32 +ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7522", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Wio Terminal +ATTRS{idVendor}=="2886", ATTRS{idProduct}=="[08]02d", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Raspberry Pi Pico +ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="[01]*", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# AIR32F103 +ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0204", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# STM32 virtual COM port +ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# +# Debuggers +# + +# Black Magic Probe +SUBSYSTEM=="tty", ATTRS{interface}=="Black Magic GDB Server", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" +SUBSYSTEM=="tty", ATTRS{interface}=="Black Magic UART Port", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# opendous and estick +ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204f", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Original FT232/FT245/FT2232/FT232H/FT4232 +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="60[01][104]", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# DISTORTEC JTAG-lock-pick Tiny 2 +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8220", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# TUMPA, TUMPA Lite +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8a9[89]", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# XDS100v2 +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="a6d0", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Xverve Signalyzer Tool (DT-USB-ST), Signalyzer LITE (DT-USB-SLITE) +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bca[01]", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# TI/Luminary Stellaris Evaluation Board FTDI (several) +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bcd[9a]", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# egnite Turtelizer 2 +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bdc8", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Section5 ICEbear +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="c14[01]", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Amontec JTAGkey and JTAGkey-tiny +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="cff8", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# TI ICDI +ATTRS{idVendor}=="0451", ATTRS{idProduct}=="c32a", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# STLink probes +ATTRS{idVendor}=="0483", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Hilscher NXHX Boards +ATTRS{idVendor}=="0640", ATTRS{idProduct}=="0028", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Hitex probes +ATTRS{idVendor}=="0640", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Altera USB Blaster +ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6001", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Amontec JTAGkey-HiSpeed +ATTRS{idVendor}=="0fbb", ATTRS{idProduct}=="1000", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# SEGGER J-Link +ATTRS{idVendor}=="1366", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Raisonance RLink +ATTRS{idVendor}=="138e", ATTRS{idProduct}=="9000", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Debug Board for Neo1973 +ATTRS{idVendor}=="1457", ATTRS{idProduct}=="5118", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Olimex probes +ATTRS{idVendor}=="15ba", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# USBprog with OpenOCD firmware +ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c63", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# TI/Luminary Stellaris In-Circuit Debug Interface (ICDI) Board +ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Marvell Sheevaplug +ATTRS{idVendor}=="9e88", ATTRS{idProduct}=="9e8f", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Keil Software, Inc. ULink +ATTRS{idVendor}=="c251", ATTRS{idProduct}=="2710", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# CMSIS-DAP compatible adapters +ATTRS{product}=="*CMSIS-DAP*", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Atmel AVR Dragon +ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2107", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Espressif USB JTAG/serial debug unit +ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1001", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + +# Zephyr framework USB CDC-ACM +ATTRS{idVendor}=="2fe3", ATTRS{idProduct}=="0100", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" \ No newline at end of file diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c21564491f..62f0b7eadc 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,9 @@ FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12 -# [Optional] Uncomment this section to install additional packages. +USER root + +# trunk-ignore(terrascan/AC_DOCKER_0002): Known terrascan issue +# trunk-ignore(hadolint/DL3008): Use latest version of packages RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y install --no-install-recommends \ ca-certificates \ @@ -20,6 +23,16 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ python3-wheel \ wget \ zip \ + usbutils \ + hwdata \ + gpg \ + gnupg2 \ && apt-get clean && rm -rf /var/lib/apt/lists/* -RUN pipx install platformio==6.1.15 \ No newline at end of file +RUN pipx install platformio==6.1.15 + +COPY 99-platformio-udev.rules /etc/udev/rules.d/99-platformio-udev.rules + +USER vscode + +HEALTHCHECK NONE \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d83d052b0a..bf1c509820 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,13 +13,24 @@ }, "customizations": { "vscode": { - "extensions": ["ms-vscode.cpptools", "platformio.platformio-ide"] + "extensions": [ + "ms-vscode.cpptools", + "platformio.platformio-ide", + "Trunk.io" + ], + "unwantedRecommendations": ["ms-azuretools.vscode-docker"], + "settings": { + "extensions.ignoreRecommendations": true + } } }, // Use 'forwardPorts' to make a list of ports inside the container available locally. "forwardPorts": [4403], + // Use "--device=" to make a local device available inside the container. + // "runArgs": ["--device=/dev/ttyACM0"], + // Run commands to prepare the container for use "postCreateCommand": ".devcontainer/setup.sh" } From aac2a80a1db5127cf5536e5b4473c18f1a205d4c Mon Sep 17 00:00:00 2001 From: Manuel Verch Date: Sat, 30 Nov 2024 00:11:13 +0000 Subject: [PATCH 315/322] fix radioLib warnings for T-Deck target --- variants/t-deck/platformio.ini | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 09f0c70a76..8b31f502b5 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -21,7 +21,7 @@ lib_deps = ${esp32s3_base.lib_deps} [env:t-deck-tft] extends = env:t-deck -board_build.partitions = default_16MB.csv ; just for test +board_build.partitions = default_16MB.csv board_level = main build_flags = @@ -56,7 +56,6 @@ build_flags = -D RADIOLIB_DEBUG_BASIC=0 -D RADIOLIB_DEBUG_SPI=0 -D RADIOLIB_DEBUG_PROTOCOL=0 - -D RADIOLIB_VERBOSE_ASSERT=1 -D RADIOLIB_SPI_PARANOID=0 -D CUSTOM_TOUCH_DRIVER -D CALIBRATE_TOUCH=0 @@ -77,5 +76,4 @@ build_src_filter = lib_deps = ${env:t-deck.lib_deps} - bitbank2/bb_captouch@1.2.2 ; alternative touch library supporting GT911 - + bitbank2/bb_captouch@1.2.2 ; alternative touch library supporting GT911 \ No newline at end of file From ab6dfe4ef27b99a0ea8292acd82e19a561d60101 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 1 Dec 2024 12:46:45 +0100 Subject: [PATCH 316/322] wake screen with button only --- variants/seeed-sensecap-indicator/platformio.ini | 1 + variants/t-deck/platformio.ini | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index a6e75f9b19..edcc798c19 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -42,6 +42,7 @@ build_flags = -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 -D MESHTASTIC_EXCLUDE_SCREEN=1 -D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 + -D INPUTDRIVER_BUTTON_TYPE=38 -D HAS_TELEMETRY=0 -D CONFIG_DISABLE_HAL_LOCKS=1 -D MAX_NUM_NODES=250 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 09f0c70a76..95ef7a59ac 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -38,6 +38,7 @@ build_flags = -D INPUTDRIVER_ENCODER_UP=3 -D INPUTDRIVER_ENCODER_DOWN=15 -D INPUTDRIVER_ENCODER_BTN=0 + -D INPUTDRIVER_BUTTON_TYPE=0 -D MAX_NUM_NODES=250 -D HAS_SCREEN=0 -D HAS_TFT=1 @@ -58,7 +59,7 @@ build_flags = -D RADIOLIB_DEBUG_PROTOCOL=0 -D RADIOLIB_VERBOSE_ASSERT=1 -D RADIOLIB_SPI_PARANOID=0 - -D CUSTOM_TOUCH_DRIVER +; -D CUSTOM_TOUCH_DRIVER -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_TDECK ; -D LVGL_DRIVER=LVGL_TDECK From 5a6f36d3cf9c8f6e85ea7b8984e6157eb30705f1 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 1 Dec 2024 13:56:16 +0100 Subject: [PATCH 317/322] use custom touch driver --- variants/t-deck/platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 86c96b8823..bcb1f4f333 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -58,8 +58,8 @@ build_flags = -D RADIOLIB_DEBUG_SPI=0 -D RADIOLIB_DEBUG_PROTOCOL=0 -D RADIOLIB_SPI_PARANOID=0 -; -D CUSTOM_TOUCH_DRIVER - -D CALIBRATE_TOUCH=0 + -D CUSTOM_TOUCH_DRIVER +; -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_TDECK ; -D LVGL_DRIVER=LVGL_TDECK ; -D LV_USE_ST7789=1 From 44238cf909eded75fc5633fb1bca8b035f5cec42 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 3 Dec 2024 20:03:35 +0100 Subject: [PATCH 318/322] define wake button for unphone --- variants/unphone/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index 8ffcab049d..365bcc77eb 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -41,6 +41,7 @@ build_flags = -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 -D MESHTASTIC_EXCLUDE_WEBSERVER=1 + -D INPUTDRIVER_BUTTON_TYPE=21 -D MAX_NUM_NODES=200 -D MAX_THREADS=40 -D HAS_SCREEN=0 @@ -58,7 +59,6 @@ build_flags = -D LV_USE_LOG=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" - -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_UNPHONE_V9 -D VIEW_320x240 -D USE_PACKET_API From 678a489f9f56dec9da9917288f6d7e3e70daca50 Mon Sep 17 00:00:00 2001 From: Manuel Verch Date: Thu, 5 Dec 2024 23:27:18 +0000 Subject: [PATCH 319/322] use board definition for mesh-tab --- boards/mesh-tab.json | 2 +- variants/mesh-tab/pins_arduino.h | 65 ++++++++++++++++++++++++++++++++ variants/mesh-tab/platformio.ini | 4 +- 3 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 variants/mesh-tab/pins_arduino.h diff --git a/boards/mesh-tab.json b/boards/mesh-tab.json index 75ac1b5a21..52c65bf771 100644 --- a/boards/mesh-tab.json +++ b/boards/mesh-tab.json @@ -16,7 +16,7 @@ "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", - "hwids": [["0x303A", "0x1001"]], + "hwids": [["0x303A", "0x80D6"]], "mcu": "esp32s3", "variant": "mesh-tab" }, diff --git a/variants/mesh-tab/pins_arduino.h b/variants/mesh-tab/pins_arduino.h new file mode 100644 index 0000000000..c995f638ce --- /dev/null +++ b/variants/mesh-tab/pins_arduino.h @@ -0,0 +1,65 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include "soc/soc_caps.h" +#include + +#define USB_VID 0x303A +#define USB_PID 0x80D6 + +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +static const uint8_t SDA = 8; +static const uint8_t SCL = 9; + +static const uint8_t SS = 5; +static const uint8_t MOSI = 35; +static const uint8_t MISO = 37; +static const uint8_t SDO = 35; +static const uint8_t SDI = 37; +static const uint8_t SCK = 36; + +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 3; +static const uint8_t A3 = 4; +static const uint8_t A4 = 5; +static const uint8_t A5 = 6; +static const uint8_t A6 = 7; +static const uint8_t A7 = 8; +static const uint8_t A8 = 9; +static const uint8_t A9 = 10; +static const uint8_t A10 = 11; +static const uint8_t A11 = 12; +static const uint8_t A12 = 13; + +static const uint8_t T1 = 1; +static const uint8_t T3 = 3; +static const uint8_t T5 = 5; +static const uint8_t T6 = 6; +static const uint8_t T7 = 7; +static const uint8_t T8 = 8; +static const uint8_t T9 = 9; +static const uint8_t T10 = 10; +static const uint8_t T11 = 11; +static const uint8_t T12 = 12; +static const uint8_t T14 = 14; + +static const uint8_t VBAT_SENSE = 2; +static const uint8_t VBUS_SENSE = 34; + +// User LED +#define LED_BUILTIN 13 +#define BUILTIN_LED LED_BUILTIN // backward compatibility + +static const uint8_t RGB_DATA = 40; +// RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API neopixelWrite() +#define RGB_BUILTIN (RGB_DATA + SOC_GPIO_PIN_COUNT) +#define RGB_BRIGHTNESS 64 + +static const uint8_t RGB_PWR = 39; +static const uint8_t LDO2 = 39; +static const uint8_t LED = 13; + +#endif /* Pins_Arduino_h */ diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index 639b9f753c..cc691caa1b 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -2,7 +2,7 @@ ; https://github.com/valzzu/Mesh-Tab [mesh_tab_base] extends = esp32s3_base -board = um_feathers3 +board = mesh-tab board_level = extra board_upload.flash_size = 16MB board_build.partitions = default_16MB.csv @@ -231,4 +231,4 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_TOUCH_Y_MIN=0 -D LGFX_TOUCH_Y_MAX=479 -D LGFX_TOUCH_ROTATION=1 - -D LGFX_TOUCH_I2C_FREQ=1000000 + -D LGFX_TOUCH_I2C_FREQ=1000000 \ No newline at end of file From 66101bc9f758e462b64d05b84100d51fa3c7403b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 16 Dec 2024 01:40:18 +0100 Subject: [PATCH 320/322] mesh-tab rotation upside-down --- variants/mesh-tab/platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index cc691caa1b..6535825235 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -66,7 +66,7 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_PANEL=ST7789 -D LGFX_INVERT_COLOR=false -D LGFX_RGB_ORDER=false - -D LGFX_ROTATION=1 + -D LGFX_ROTATION=3 -D LGFX_TOUCH=XPT2046 -D SPI_FREQUENCY=60000000 -D LGFX_TOUCH_SPI_FREQ=2500000 @@ -116,7 +116,7 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_INVERT_COLOR=true -D LGFX_RGB_ORDER=false -D LGFX_DLEN_16BITS=false - -D LGFX_ROTATION=2 + -D LGFX_ROTATION=0 -D LGFX_TOUCH=XPT2046 -D SPI_FREQUENCY=40000000 ; may go higher upto 40/60/80 MHz -D LGFX_TOUCH_SPI_FREQ=2500000 From cdf76d678861629e907d23e0df777f6081361469 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 20 Dec 2024 20:35:49 +0100 Subject: [PATCH 321/322] update platform native --- arch/portduino/portduino.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index bbafef4da1..6c6242bb03 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated). [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#73bd1a21183ca8b00c4ea58bb21315df31a50dff +platform = https://github.com/meshtastic/platform-native.git#0e10e92627802594576ce831bb84e3127525b7dd framework = arduino build_src_filter = From fb5bd974ab78059b17ab59d4cb03feac30dc0ba4 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 23 Dec 2024 14:27:53 +0100 Subject: [PATCH 322/322] use MESH_TAB hardware model definition --- src/platform/esp32/architecture.h | 2 ++ variants/mesh-tab/platformio.ini | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index 1a274aa28d..742b295b54 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -174,6 +174,8 @@ #define HW_VENDOR meshtastic_HardwareModel_SENSECAP_INDICATOR #elif defined(SEEED_XIAO_S3) #define HW_VENDOR meshtastic_HardwareModel_SEEED_XIAO_S3 +#elif defined(MESH_TAB) +#define HW_VENDOR meshtastic_HardwareModel_MESH_TAB #endif // ----------------------------------------------------------------------------- diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index 6535825235..26b072cdee 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -9,7 +9,6 @@ board_build.partitions = default_16MB.csv upload_protocol = esptool build_flags = ${esp32s3_base.build_flags} -D MESH_TAB - -D PRIVATE_HW -D CONFIG_ARDUHAL_ESP_LOG -D CONFIG_ARDUHAL_LOG_COLORS=1 -D CONFIG_DISABLE_HAL_LOCKS=1