From d8ad2b3f48776462e9afe6fc944d6ae3c6fb9223 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 8 Jul 2023 18:32:36 +0200 Subject: [PATCH] RPi Pico screen, CannedMessageModule (CardKB) and reboot support (#2595) * Make input_source case insensitive * Implement reboot for RP2040 * Remove EXT_NOTFIFY_OUT as it conflicts with I2C and module is not supported * RP2040 has screen, button and wire * Add default I2C pins also for Pico W --- src/modules/CannedMessageModule.cpp | 4 ++-- src/platform/rp2040/architecture.h | 9 +++++++++ src/shutdown.h | 4 +++- variants/rpipico/variant.h | 6 +++--- variants/rpipicow/variant.h | 6 +++--- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index bbd39f696..1119e0c27 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -123,8 +123,8 @@ int CannedMessageModule::splitConfiguredMessages() int CannedMessageModule::handleInputEvent(const InputEvent *event) { if ((strlen(moduleConfig.canned_message.allow_input_source) > 0) && - (strcmp(moduleConfig.canned_message.allow_input_source, event->source) != 0) && - (strcmp(moduleConfig.canned_message.allow_input_source, "_any") != 0)) { + (strcasecmp(moduleConfig.canned_message.allow_input_source, event->source) != 0) && + (strcasecmp(moduleConfig.canned_message.allow_input_source, "_any") != 0)) { // Event source is not accepted. // Event only accepted if source matches the configured one, or // the configured one is "_any" (or if there is no configured diff --git a/src/platform/rp2040/architecture.h b/src/platform/rp2040/architecture.h index 772e4b1af..762a2dc83 100644 --- a/src/platform/rp2040/architecture.h +++ b/src/platform/rp2040/architecture.h @@ -2,9 +2,18 @@ #define ARCH_RP2040 +#ifndef HAS_BUTTON +#define HAS_BUTTON 1 +#endif #ifndef HAS_TELEMETRY #define HAS_TELEMETRY 1 #endif +#ifndef HAS_SCREEN +#define HAS_SCREEN 1 +#endif +#ifndef HAS_WIRE +#define HAS_WIRE 1 +#endif #ifndef HAS_SENSOR #define HAS_SENSOR 1 #endif diff --git a/src/shutdown.h b/src/shutdown.h index ee63422dd..d9077151c 100644 --- a/src/shutdown.h +++ b/src/shutdown.h @@ -12,6 +12,8 @@ void powerCommandsCheck() ESP.restart(); #elif defined(ARCH_NRF52) NVIC_SystemReset(); +#elif defined(ARCH_RP2040) + rp2040.reboot(); #else rebootAtMsec = -1; LOG_WARN("FIXME implement reboot for this platform. Skipping for now.\n"); @@ -33,4 +35,4 @@ void powerCommandsCheck() LOG_WARN("FIXME implement shutdown for this platform"); #endif } -} +} \ No newline at end of file diff --git a/variants/rpipico/variant.h b/variants/rpipico/variant.h index 7e2660aa6..fb4b9bd75 100644 --- a/variants/rpipico/variant.h +++ b/variants/rpipico/variant.h @@ -15,11 +15,11 @@ #define USE_SH1106 1 #undef GPS_SERIAL_NUM -// #define I2C_SDA 6 -// #define I2C_SCL 7 +// default I2C pins: +// SDA = 4 +// SCL = 5 #define BUTTON_PIN 17 -#define EXT_NOTIFY_OUT 4 #define LED_PIN PIN_LED diff --git a/variants/rpipicow/variant.h b/variants/rpipicow/variant.h index 4741fd130..59f8d2ec2 100644 --- a/variants/rpipicow/variant.h +++ b/variants/rpipicow/variant.h @@ -15,11 +15,11 @@ #define USE_SH1106 1 #undef GPS_SERIAL_NUM -// #define I2C_SDA 6 -// #define I2C_SCL 7 +// default I2C pins: +// SDA = 4 +// SCL = 5 #define BUTTON_PIN 17 -#define EXT_NOTIFY_OUT 4 #define BATTERY_PIN 26 // ratio of voltage divider = 3.0 (R17=200k, R18=100k)