Merge branch 'master' into RCWL-9620

This commit is contained in:
Thomas Göttgens 2024-04-23 14:04:22 +02:00 committed by GitHub
commit c6e940af81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 242 additions and 70 deletions

View File

@ -2,14 +2,17 @@
extends = esp32_base extends = esp32_base
build_src_filter = build_src_filter =
${esp32_base.build_src_filter} -<nimble/> -<mesh/raspihttp> ${esp32_base.build_src_filter} - <libpax/> -<nimble/> -<mesh/raspihttp>
monitor_speed = 115200 monitor_speed = 115200
build_flags = build_flags =
${esp32_base.build_flags} ${esp32_base.build_flags}
-DHAS_BLUETOOTH=0 -DHAS_BLUETOOTH=0
-DMESHTASTIC_EXCLUDE_PAXCOUNTER
-DMESHTASTIC_EXCLUDE_BLUETOOTH
lib_ignore = lib_ignore =
${esp32_base.lib_ignore} ${esp32_base.lib_ignore}
NimBLE-Arduino NimBLE-Arduino
libpax

View File

@ -5,6 +5,16 @@
NCP5623 rgb; NCP5623 rgb;
#endif #endif
#ifdef HAS_NEOPIXEL
#include <graphics/NeoPixel.h>
Adafruit_NeoPixel pixels(NEOPIXEL_COUNT, NEOPIXEL_DATA, NEOPIXEL_TYPE);
#endif
#ifdef UNPHONE
#include "unPhone.h"
extern unPhone unphone;
#endif
namespace concurrency namespace concurrency
{ {
class AmbientLightingThread : public concurrency::OSThread class AmbientLightingThread : public concurrency::OSThread
@ -27,15 +37,31 @@ class AmbientLightingThread : public concurrency::OSThread
disable(); disable();
return; return;
} }
#endif
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
if (!moduleConfig.ambient_lighting.led_state) { if (!moduleConfig.ambient_lighting.led_state) {
LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF\n"); LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF\n");
disable(); disable();
return; return;
} }
LOG_DEBUG("AmbientLightingThread initializing\n"); LOG_DEBUG("AmbientLightingThread initializing\n");
#ifdef HAS_NCP5623
if (_type == ScanI2C::NCP5623) { if (_type == ScanI2C::NCP5623) {
rgb.begin(); rgb.begin();
#endif
#ifdef RGBLED_RED
pinMode(RGBLED_RED, OUTPUT);
pinMode(RGBLED_GREEN, OUTPUT);
pinMode(RGBLED_BLUE, OUTPUT);
#endif
#ifdef HAS_NEOPIXEL
pixels.begin(); // Initialise the pixel(s)
pixels.clear(); // Set all pixel colors to 'off'
pixels.setBrightness(moduleConfig.ambient_lighting.current);
#endif
setLighting(); setLighting();
#endif
#ifdef HAS_NCP5623
} }
#endif #endif
} }
@ -43,16 +69,17 @@ class AmbientLightingThread : public concurrency::OSThread
protected: protected:
int32_t runOnce() override int32_t runOnce() override
{ {
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
#ifdef HAS_NCP5623 #ifdef HAS_NCP5623
if (_type == ScanI2C::NCP5623 && moduleConfig.ambient_lighting.led_state) { if (_type == ScanI2C::NCP5623 && moduleConfig.ambient_lighting.led_state) {
#endif
setLighting(); setLighting();
return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification
} else { #ifdef HAS_NCP5623
return disable();
} }
#else
return disable();
#endif #endif
#endif
return disable();
} }
private: private:
@ -65,9 +92,36 @@ class AmbientLightingThread : public concurrency::OSThread
rgb.setRed(moduleConfig.ambient_lighting.red); rgb.setRed(moduleConfig.ambient_lighting.red);
rgb.setGreen(moduleConfig.ambient_lighting.green); rgb.setGreen(moduleConfig.ambient_lighting.green);
rgb.setBlue(moduleConfig.ambient_lighting.blue); rgb.setBlue(moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Initializing Ambient lighting w/ current=%d, red=%d, green=%d, blue=%d\n", LOG_DEBUG("Initializing NCP5623 Ambient lighting w/ current=%d, red=%d, green=%d, blue=%d\n",
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
moduleConfig.ambient_lighting.blue); moduleConfig.ambient_lighting.blue);
#endif
#ifdef HAS_NEOPIXEL
pixels.fill(pixels.Color(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
moduleConfig.ambient_lighting.blue),
0, NEOPIXEL_COUNT);
pixels.show();
LOG_DEBUG("Initializing NeoPixel Ambient lighting w/ brightness(current)=%d, red=%d, green=%d, blue=%d\n",
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
moduleConfig.ambient_lighting.blue);
#endif
#ifdef RGBLED_CA
analogWrite(RGBLED_RED, 255 - moduleConfig.ambient_lighting.red);
analogWrite(RGBLED_GREEN, 255 - moduleConfig.ambient_lighting.green);
analogWrite(RGBLED_BLUE, 255 - moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Initializing Ambient lighting RGB Common Anode w/ red=%d, green=%d, blue=%d\n",
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
#elif defined(RGBLED_RED)
analogWrite(RGBLED_RED, moduleConfig.ambient_lighting.red);
analogWrite(RGBLED_GREEN, moduleConfig.ambient_lighting.green);
analogWrite(RGBLED_BLUE, moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Initializing Ambient lighting RGB Common Cathode w/ red=%d, green=%d, blue=%d\n",
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
#endif
#ifdef UNPHONE
unphone.rgb(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Initializing unPhone Ambient lighting w/ red=%d, green=%d, blue=%d\n", moduleConfig.ambient_lighting.red,
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
#endif #endif
} }
}; };

View File

@ -42,9 +42,7 @@ class ScanI2C
LSM6DS3, LSM6DS3,
TCA9555, TCA9555,
RCWL9620, RCWL9620,
#ifdef HAS_NCP5623
NCP5623, NCP5623,
#endif
} DeviceType; } DeviceType;
// typedef uint8_t DeviceAddress; // typedef uint8_t DeviceAddress;

View File

@ -452,7 +452,7 @@ bool GPS::setup()
// Set the NEMA output messages // Set the NEMA output messages
// Ask for only RMC and GGA // Ask for only RMC and GGA
uint8_t fields[] = {CAS_NEMA_RMC, CAS_NEMA_GGA}; uint8_t fields[] = {CAS_NEMA_RMC, CAS_NEMA_GGA};
for (int i = 0; i < sizeof(fields); i++) { for (uint i = 0; i < sizeof(fields); i++) {
// Construct a CAS-CFG-MSG packet // Construct a CAS-CFG-MSG packet
uint8_t cas_cfg_msg_packet[] = {0x4e, fields[i], 0x01, 0x00}; uint8_t cas_cfg_msg_packet[] = {0x4e, fields[i], 0x01, 0x00};
msglen = makeCASPacket(0x06, 0x01, sizeof(cas_cfg_msg_packet), cas_cfg_msg_packet); msglen = makeCASPacket(0x06, 0x01, sizeof(cas_cfg_msg_packet), cas_cfg_msg_packet);
@ -1584,7 +1584,7 @@ bool GPS::hasFlow()
bool GPS::whileIdle() bool GPS::whileIdle()
{ {
int charsInBuf = 0; uint charsInBuf = 0;
bool isValid = false; bool isValid = false;
if (!isAwake) { if (!isAwake) {
clearBuffer(); clearBuffer();

4
src/graphics/NeoPixel.h Normal file
View File

@ -0,0 +1,4 @@
#ifdef HAS_NEOPIXEL
#include <Adafruit_NeoPixel.h>
extern Adafruit_NeoPixel pixels;
#endif

View File

@ -179,6 +179,11 @@ const char *getDeviceName()
static int32_t ledBlinker() static int32_t ledBlinker()
{ {
// Still set up the blinking (heartbeat) interval but skip code path below, so LED will blink if
// config.device.led_heartbeat_disabled is changed
if (config.device.led_heartbeat_disabled)
return 1000;
static bool ledOn; static bool ledOn;
ledOn ^= 1; ledOn ^= 1;
@ -608,7 +613,9 @@ void setup()
} }
#endif #endif
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) #if defined(HAS_NEOPIXEL) || defined(UNPHONE) || defined(RGBLED_RED)
ambientLightingThread = new AmbientLightingThread(ScanI2C::DeviceType::NONE);
#elif !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
if (rgb_found.type != ScanI2C::DeviceType::NONE) { if (rgb_found.type != ScanI2C::DeviceType::NONE) {
ambientLightingThread = new AmbientLightingThread(rgb_found.type); ambientLightingThread = new AmbientLightingThread(rgb_found.type);
} }

View File

@ -492,7 +492,7 @@ void RadioInterface::applyModemConfig()
// If user has manually specified a channel num, then use that, otherwise generate one by hashing the name // If user has manually specified a channel num, then use that, otherwise generate one by hashing the name
const char *channelName = channels.getName(channels.getPrimaryIndex()); const char *channelName = channels.getName(channels.getPrimaryIndex());
// channel_num is actually (channel_num - 1), since modulus (%) returns values from 0 to (numChannels - 1) // channel_num is actually (channel_num - 1), since modulus (%) returns values from 0 to (numChannels - 1)
int channel_num = (loraConfig.channel_num ? loraConfig.channel_num - 1 : hash(channelName)) % numChannels; uint channel_num = (loraConfig.channel_num ? loraConfig.channel_num - 1 : hash(channelName)) % numChannels;
// Check if we use the default frequency slot // Check if we use the default frequency slot
RadioInterface::uses_default_frequency_slot = RadioInterface::uses_default_frequency_slot =

View File

@ -26,7 +26,18 @@
#ifdef HAS_NCP5623 #ifdef HAS_NCP5623
#include <graphics/RAKled.h> #include <graphics/RAKled.h>
#endif
#ifdef HAS_NEOPIXEL
#include <graphics/NeoPixel.h>
#endif
#ifdef UNPHONE
#include "unPhone.h"
extern unPhone unphone;
#endif
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
uint8_t red = 0; uint8_t red = 0;
uint8_t green = 0; uint8_t green = 0;
uint8_t blue = 0; uint8_t blue = 0;
@ -108,27 +119,44 @@ int32_t ExternalNotificationModule::runOnce()
millis()) { millis()) {
getExternal(2) ? setExternalOff(2) : setExternalOn(2); getExternal(2) ? setExternalOff(2) : setExternalOn(2);
} }
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
red = (colorState & 4) ? brightnessValues[brightnessIndex] : 0; // Red enabled on colorState = 4,5,6,7
green = (colorState & 2) ? brightnessValues[brightnessIndex] : 0; // Green enabled on colorState = 2,3,6,7
blue = (colorState & 1) ? (brightnessValues[brightnessIndex] * 1.5) : 0; // Blue enabled on colorState = 1,3,5,7
#ifdef HAS_NCP5623 #ifdef HAS_NCP5623
if (rgb_found.type == ScanI2C::NCP5623) { if (rgb_found.type == ScanI2C::NCP5623) {
red = (colorState & 4) ? brightnessValues[brightnessIndex] : 0; // Red enabled on colorState = 4,5,6,7
green = (colorState & 2) ? brightnessValues[brightnessIndex] : 0; // Green enabled on colorState = 2,3,6,7
blue = (colorState & 1) ? (brightnessValues[brightnessIndex] * 1.5) : 0; // Blue enabled on colorState = 1,3,5,7
rgb.setColor(red, green, blue); rgb.setColor(red, green, blue);
}
if (ascending) { // fade in #endif
brightnessIndex++; #ifdef RGBLED_CA
if (brightnessIndex == (sizeof(brightnessValues) - 1)) { analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic
ascending = false; analogWrite(RGBLED_GREEN, 255 - green);
} analogWrite(RGBLED_BLUE, 255 - blue);
} else { #elif defined(RGBLED_RED)
brightnessIndex--; // fade out analogWrite(RGBLED_RED, red);
analogWrite(RGBLED_GREEN, green);
analogWrite(RGBLED_BLUE, blue);
#endif
#ifdef HAS_NEOPIXEL
pixels.fill(pixels.Color(red, green, blue), 0, NEOPIXEL_COUNT);
pixels.show();
#endif
#ifdef UNPHONE
unphone.rgb(red, green, blue);
#endif
if (ascending) { // fade in
brightnessIndex++;
if (brightnessIndex == (sizeof(brightnessValues) - 1)) {
ascending = false;
} }
if (brightnessIndex == 0) { } else {
ascending = true; brightnessIndex--; // fade out
colorState++; // next color }
if (colorState > 7) { if (brightnessIndex == 0) {
colorState = 1; ascending = true;
} colorState++; // next color
if (colorState > 7) {
colorState = 1;
} }
} }
#endif #endif
@ -179,6 +207,9 @@ void ExternalNotificationModule::setExternalOn(uint8_t index)
switch (index) { switch (index) {
case 1: case 1:
#ifdef UNPHONE
unphone.vibe(true); // the unPhone's vibration motor is on a i2c GPIO expander
#endif
if (moduleConfig.external_notification.output_vibra) if (moduleConfig.external_notification.output_vibra)
digitalWrite(moduleConfig.external_notification.output_vibra, true); digitalWrite(moduleConfig.external_notification.output_vibra, true);
break; break;
@ -197,6 +228,22 @@ void ExternalNotificationModule::setExternalOn(uint8_t index)
rgb.setColor(red, green, blue); rgb.setColor(red, green, blue);
} }
#endif #endif
#ifdef RGBLED_CA
analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic
analogWrite(RGBLED_GREEN, 255 - green);
analogWrite(RGBLED_BLUE, 255 - blue);
#elif defined(RGBLED_RED)
analogWrite(RGBLED_RED, red);
analogWrite(RGBLED_GREEN, green);
analogWrite(RGBLED_BLUE, blue);
#endif
#ifdef HAS_NEOPIXEL
pixels.fill(pixels.Color(red, green, blue), 0, NEOPIXEL_COUNT);
pixels.show();
#endif
#ifdef UNPHONE
unphone.rgb(red, green, blue);
#endif
#ifdef T_WATCH_S3 #ifdef T_WATCH_S3
drv.go(); drv.go();
#endif #endif
@ -209,6 +256,9 @@ void ExternalNotificationModule::setExternalOff(uint8_t index)
switch (index) { switch (index) {
case 1: case 1:
#ifdef UNPHONE
unphone.vibe(false); // the unPhone's vibration motor is on a i2c GPIO expander
#endif
if (moduleConfig.external_notification.output_vibra) if (moduleConfig.external_notification.output_vibra)
digitalWrite(moduleConfig.external_notification.output_vibra, false); digitalWrite(moduleConfig.external_notification.output_vibra, false);
break; break;
@ -222,14 +272,33 @@ void ExternalNotificationModule::setExternalOff(uint8_t index)
break; break;
} }
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
red = 0;
green = 0;
blue = 0;
#ifdef HAS_NCP5623 #ifdef HAS_NCP5623
if (rgb_found.type == ScanI2C::NCP5623) { if (rgb_found.type == ScanI2C::NCP5623) {
red = 0;
green = 0;
blue = 0;
rgb.setColor(red, green, blue); rgb.setColor(red, green, blue);
} }
#endif #endif
#ifdef RGBLED_CA
analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic
analogWrite(RGBLED_GREEN, 255 - green);
analogWrite(RGBLED_BLUE, 255 - blue);
#elif defined(RGBLED_RED)
analogWrite(RGBLED_RED, red);
analogWrite(RGBLED_GREEN, green);
analogWrite(RGBLED_BLUE, blue);
#endif
#ifdef HAS_NEOPIXEL
pixels.fill(pixels.Color(red, green, blue), 0, NEOPIXEL_COUNT);
pixels.show();
#endif
#ifdef UNPHONE
unphone.rgb(red, green, blue);
#endif
#endif
#ifdef T_WATCH_S3 #ifdef T_WATCH_S3
drv.stop(); drv.stop();
#endif #endif
@ -328,6 +397,21 @@ ExternalNotificationModule::ExternalNotificationModule()
rgb.begin(); rgb.begin();
rgb.setCurrent(10); rgb.setCurrent(10);
} }
#endif
#ifdef RGBLED_RED
pinMode(RGBLED_RED, OUTPUT); // set up the RGB led pins
pinMode(RGBLED_GREEN, OUTPUT);
pinMode(RGBLED_BLUE, OUTPUT);
#endif
#ifdef RGBLED_CA
analogWrite(RGBLED_RED, 255); // with a common anode type, logic is reversed
analogWrite(RGBLED_GREEN, 255); // so we want to initialise with lights off
analogWrite(RGBLED_BLUE, 255);
#endif
#ifdef HAS_NEOPIXEL
pixels.begin(); // Initialise the pixel(s)
pixels.clear(); // Set all pixel colors to 'off'
pixels.setBrightness(moduleConfig.ambient_lighting.current);
#endif #endif
} else { } else {
LOG_INFO("External Notification Module Disabled\n"); LOG_INFO("External Notification Module Disabled\n");

View File

@ -51,7 +51,7 @@ uint8_t RoutingModule::getHopLimitForResponse(uint8_t hopStart, uint8_t hopLimit
uint8_t hopsUsed = hopStart < hopLimit ? config.lora.hop_limit : hopStart - hopLimit; uint8_t hopsUsed = hopStart < hopLimit ? config.lora.hop_limit : hopStart - hopLimit;
if (hopsUsed > config.lora.hop_limit) { if (hopsUsed > config.lora.hop_limit) {
return hopsUsed; // If the request used more hops than the limit, use the same amount of hops return hopsUsed; // If the request used more hops than the limit, use the same amount of hops
} else if (hopsUsed + 2 < config.lora.hop_limit) { } else if ((uint8_t)(hopsUsed + 2) < config.lora.hop_limit) {
return hopsUsed + 2; // Use only the amount of hops needed with some margin as the way back may be different return hopsUsed + 2; // Use only the amount of hops needed with some margin as the way back may be different
} }
} }

View File

@ -1,5 +1,5 @@
#include "configuration.h" #include "configuration.h"
#if defined(ARCH_ESP32) #if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_PAXCOUNTER
#include "Default.h" #include "Default.h"
#include "MeshService.h" #include "MeshService.h"
#include "PaxcounterModule.h" #include "PaxcounterModule.h"

View File

@ -211,7 +211,7 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
// esp_wifi_stop(); // esp_wifi_stop();
waitEnterSleep(skipPreflight); waitEnterSleep(skipPreflight);
#ifdef ARCH_ESP32 #if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_BLUETOOTH
// Full shutdown of bluetooth hardware // Full shutdown of bluetooth hardware
if (nimbleBluetooth) if (nimbleBluetooth)
nimbleBluetooth->deinit(); nimbleBluetooth->deinit();

View File

@ -29,10 +29,7 @@ const uint32_t g_ADigitalPinMap[] = {
void initVariant() void initVariant()
{ {
// LED1 & LED2 // LED1
pinMode(PIN_LED1, OUTPUT); pinMode(PIN_LED1, OUTPUT);
ledOff(PIN_LED1); ledOff(PIN_LED1);
pinMode(PIN_LED2, OUTPUT);
ledOff(PIN_LED2);
} }

View File

@ -43,16 +43,12 @@ extern "C" {
#define NUM_ANALOG_OUTPUTS (0) #define NUM_ANALOG_OUTPUTS (0)
// LEDs // LEDs
#define PIN_LED1 (0 + 12) // Blue LED P1.12 #define PIN_LED1 (0 + 6) // Built in Green P0.06
#define PIN_LED2 (0 + 6) // Built in Green P0.06 #define PIN_LED2 (0 + 6) // Just here for completeness
#define RGBLED_RED (0 + 8) // Red of RGB P0.08
// Green Built in LED1 #define RGBLED_GREEN (32 + 9) // Green of RGB P1.09
// #define PIN_LED1 (0 + 6) // LED1 P1.15 #define RGBLED_BLUE (0 + 12) // Blue of RGB P0.12
#define RGBLED_CA // comment out this line if you have a common cathode type, as defined use common anode logic
// RGB NeoPixel LED2
// #define PIN_LED1 (0 + 8) Red
// #define PIN_LED1 (32 + 9) Green
// #define PIN_LED1 (0 + 12) Blue
#define LED_BUILTIN PIN_LED1 #define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED2 #define LED_CONN PIN_LED2

View File

@ -15,4 +15,4 @@ upload_protocol = esptool
upload_speed = 460800 upload_speed = 460800
lib_deps = lib_deps =
${esp32_base.lib_deps} ${esp32_base.lib_deps}
makuna/NeoPixelBus@^2.7.1 adafruit/Adafruit NeoPixel @ ^1.12.0

View File

@ -1,5 +1,4 @@
// https://betafpv.com/products/elrs-micro-tx-module // https://betafpv.com/products/elrs-micro-tx-module
#include <NeoPixelBus.h>
// 0.96" OLED // 0.96" OLED
#define I2C_SDA 22 #define I2C_SDA 22
@ -15,7 +14,11 @@
#define LORA_CS 5 #define LORA_CS 5
#define RF95_FAN_EN 17 #define RF95_FAN_EN 17
#define LED_PIN 16 // This is a LED_WS2812 not a standard LED // #define LED_PIN 16 // This is a LED_WS2812 not a standard LED
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 16 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define BUTTON_PIN 25 #define BUTTON_PIN 25
#define BUTTON_NEED_PULLUP #define BUTTON_NEED_PULLUP

View File

@ -22,4 +22,4 @@ build_flags = ${esp32_base.build_flags}
lib_deps = ${esp32s3_base.lib_deps} lib_deps = ${esp32s3_base.lib_deps}
zinggjm/GxEPD2@^1.5.3 zinggjm/GxEPD2@^1.5.3
;adafruit/Adafruit NeoPixel@^1.10.7 adafruit/Adafruit NeoPixel @ ^1.12.0

View File

@ -10,6 +10,10 @@
// #define LED_PIN PIN_LED // #define LED_PIN PIN_LED
// Board has RGB LED 21 // Board has RGB LED 21
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 21 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
// The usbPower state is revered ? // The usbPower state is revered ?
// DEBUG | ??:??:?? 365 [Power] Battery: usbPower=0, isCharging=0, batMv=4116, batPct=90 // DEBUG | ??:??:?? 365 [Power] Battery: usbPower=0, isCharging=0, batMv=4116, batPct=90

View File

@ -21,3 +21,4 @@ lib_deps =
${nrf52840_base.lib_deps} ${nrf52840_base.lib_deps}
sparkfun/SparkFun BQ27441 LiPo Fuel Gauge Arduino Library@^1.1.0 sparkfun/SparkFun BQ27441 LiPo Fuel Gauge Arduino Library@^1.1.0
bodmer/TFT_eSPI@^2.4.76 bodmer/TFT_eSPI@^2.4.76
adafruit/Adafruit NeoPixel @ ^1.12.0

View File

@ -44,7 +44,11 @@ extern "C" {
// LEDs // LEDs
#define PIN_LED1 (3) #define PIN_LED1 (3)
#define PIN_LED2 (4) #define PIN_LED2 (4)
#define PIN_NEOPIXEL (8) // #define PIN_NEOPIXEL (8)
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 8 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define LED_BUILTIN PIN_LED1 #define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED2 #define LED_CONN PIN_LED2

View File

@ -23,3 +23,4 @@ lib_deps =
${nrf52840_base.lib_deps} ${nrf52840_base.lib_deps}
sparkfun/SparkFun BQ27441 LiPo Fuel Gauge Arduino Library@^1.1.0 sparkfun/SparkFun BQ27441 LiPo Fuel Gauge Arduino Library@^1.1.0
bodmer/TFT_eSPI@^2.4.76 bodmer/TFT_eSPI@^2.4.76
adafruit/Adafruit NeoPixel @ ^1.12.0

View File

@ -61,7 +61,12 @@ extern "C" {
// LEDs // LEDs
#define PIN_LED1 (3) #define PIN_LED1 (3)
#define PIN_LED2 (4) #define PIN_LED2 (4)
#define PIN_NEOPIXEL (8) // #define PIN_NEOPIXEL (8)
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 8 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define PIN_BUZZER (40) #define PIN_BUZZER (40)
#define LED_BUILTIN PIN_LED1 #define LED_BUILTIN PIN_LED1

View File

@ -13,7 +13,7 @@ platform_packages =
lib_deps = lib_deps =
${esp32_base.lib_deps} ${esp32_base.lib_deps}
zinggjm/GxEPD2@^1.5.1 zinggjm/GxEPD2@^1.5.1
adafruit/Adafruit NeoPixel@^1.10.7 adafruit/Adafruit NeoPixel @ ^1.12.0
build_unflags = -DARDUINO_USB_MODE=1 build_unflags = -DARDUINO_USB_MODE=1
build_flags = build_flags =
;${esp32_base.build_flags} -D MY_ESP32S3_DIY -I variants/my_esp32s3_diy_eink ;${esp32_base.build_flags} -D MY_ESP32S3_DIY -I variants/my_esp32s3_diy_eink

View File

@ -12,6 +12,10 @@
#define I2C_SCL 17 // 2 #define I2C_SCL 17 // 2
// #define LED_PIN 38 // This is a RGB LED not a standard LED // #define LED_PIN 38 // This is a RGB LED not a standard LED
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 38 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define BUTTON_PIN 0 // This is the BOOT button #define BUTTON_PIN 0 // This is the BOOT button
#define BUTTON_NEED_PULLUP #define BUTTON_NEED_PULLUP

View File

@ -12,7 +12,7 @@ platform_packages =
tool-esptoolpy@^1.40500.0 tool-esptoolpy@^1.40500.0
lib_deps = lib_deps =
${esp32_base.lib_deps} ${esp32_base.lib_deps}
adafruit/Adafruit NeoPixel@^1.10.7 adafruit/Adafruit NeoPixel @ ^1.12.0
build_unflags = -DARDUINO_USB_MODE=1 build_unflags = -DARDUINO_USB_MODE=1
build_flags = build_flags =
;${esp32_base.build_flags} -D MY_ESP32S3_DIY -I variants/my_esp32s3_diy_oled ;${esp32_base.build_flags} -D MY_ESP32S3_DIY -I variants/my_esp32s3_diy_oled

View File

@ -12,6 +12,10 @@
#define I2C_SCL 17 // 2 #define I2C_SCL 17 // 2
// #define LED_PIN 38 // This is a RGB LED not a standard LED // #define LED_PIN 38 // This is a RGB LED not a standard LED
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 38 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define BUTTON_PIN 0 // This is the BOOT button #define BUTTON_PIN 0 // This is the BOOT button
#define BUTTON_NEED_PULLUP #define BUTTON_NEED_PULLUP

View File

@ -14,7 +14,7 @@
#define BATTERY_PIN 26 #define BATTERY_PIN 26
#define BATTERY_SENSE_RESOLUTION_BITS ADC_RESOLUTION #define BATTERY_SENSE_RESOLUTION_BITS ADC_RESOLUTION
// ratio of voltage divider = 3.0 (R17=200k, R18=100k) // ratio of voltage divider = 3.0 (R17=200k, R18=100k)
#define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic #define ADC_MULTIPLIER 1.84
#define DETECTION_SENSOR_EN 28 #define DETECTION_SENSOR_EN 28

View File

@ -13,6 +13,7 @@ build_unflags =
-D ARDUINO_USB_MODE -D ARDUINO_USB_MODE
build_flags = ${esp32_base.build_flags} 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 -D UNPHONE
-I variants/unphone -I variants/unphone
-D ARDUINO_USB_MODE=0 -D ARDUINO_USB_MODE=0
@ -28,3 +29,4 @@ build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone>
lib_deps = ${esp32s3_base.lib_deps} lib_deps = ${esp32s3_base.lib_deps}
lovyan03/LovyanGFX @ ^1.1.8 lovyan03/LovyanGFX @ ^1.1.8
https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic @ ^9.0.0 https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic @ ^9.0.0
adafruit/Adafruit NeoPixel @ ^1.12.0

View File

@ -10,6 +10,7 @@ void initVariant()
unphone.printWakeupReason(); // what woke us up? (stored, not printed :|) unphone.printWakeupReason(); // what woke us up? (stored, not printed :|)
unphone.checkPowerSwitch(); // if power switch is off, shutdown unphone.checkPowerSwitch(); // if power switch is off, shutdown
unphone.backlight(false); // setup backlight and make sure its off unphone.backlight(false); // setup backlight and make sure its off
unphone.expanderPower(true); // enable power to expander / hat / sheild
for (int i = 0; i < 3; i++) { // buzz a bit for (int i = 0; i < 3; i++) { // buzz a bit
unphone.vibe(true); unphone.vibe(true);