mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-28 13:40:32 +00:00
Compare commits
16 Commits
v2.2.4.3bc
...
v2.2.5.825
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8255128eae | ||
|
|
d7a98519f4 | ||
|
|
e256520336 | ||
|
|
fcf798df98 | ||
|
|
dcdf9b64de | ||
|
|
fd563e41f1 | ||
|
|
0fa3685161 | ||
|
|
899f9dd7bf | ||
|
|
9af4ecf48f | ||
|
|
cfb6a1394c | ||
|
|
1254031f7d | ||
|
|
c91e306659 | ||
|
|
4ff343b20f | ||
|
|
134fc75b67 | ||
|
|
fb23e479ac | ||
|
|
5a61695016 |
22
.github/workflows/trunk-check.yml
vendored
Normal file
22
.github/workflows/trunk-check.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: Pull Request
|
||||
on: [pull_request]
|
||||
concurrency:
|
||||
group: ${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
trunk_check:
|
||||
name: Trunk Check Runner
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
checks: write # For trunk to post annotations
|
||||
contents: read # For repo checkout
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Trunk Check
|
||||
uses: trunk-io/trunk-action@v1
|
||||
@@ -1,7 +1,7 @@
|
||||
; Common settings for ESP targes, mixin with extends = esp32_base
|
||||
[esp32_base]
|
||||
extends = arduino_base
|
||||
platform = platformio/espressif32@^6.3.2
|
||||
platform = platformio/espressif32@^6.4.0
|
||||
|
||||
build_src_filter =
|
||||
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/>
|
||||
@@ -38,7 +38,7 @@ lib_deps =
|
||||
${networking_base.lib_deps}
|
||||
${environmental_base.lib_deps}
|
||||
https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2
|
||||
h2zero/NimBLE-Arduino@^1.4.0
|
||||
h2zero/NimBLE-Arduino@^1.4.1
|
||||
jgromes/RadioLib@^6.1.0
|
||||
https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
|
||||
https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f
|
||||
|
||||
Submodule protobufs updated: 826dfb7604...82ce9448a0
75
src/AmbientLightingThread.h
Normal file
75
src/AmbientLightingThread.h
Normal file
@@ -0,0 +1,75 @@
|
||||
#include "configuration.h"
|
||||
|
||||
#ifdef HAS_NCP5623
|
||||
#include <graphics/RAKled.h>
|
||||
NCP5623 rgb;
|
||||
#endif
|
||||
|
||||
namespace concurrency
|
||||
{
|
||||
class AmbientLightingThread : public concurrency::OSThread
|
||||
{
|
||||
public:
|
||||
AmbientLightingThread(ScanI2C::DeviceType type) : OSThread("AmbientLightingThread")
|
||||
{
|
||||
// Uncomment to test module
|
||||
// moduleConfig.ambient_lighting.led_state = true;
|
||||
// moduleConfig.ambient_lighting.current = 10;
|
||||
// // Default to a color based on our node number
|
||||
// moduleConfig.ambient_lighting.red = (myNodeInfo.my_node_num & 0xFF0000) >> 16;
|
||||
// moduleConfig.ambient_lighting.green = (myNodeInfo.my_node_num & 0x00FF00) >> 8;
|
||||
// moduleConfig.ambient_lighting.blue = myNodeInfo.my_node_num & 0x0000FF;
|
||||
|
||||
#ifdef HAS_NCP5623
|
||||
_type = type;
|
||||
if (_type == ScanI2C::DeviceType::NONE) {
|
||||
LOG_DEBUG("AmbientLightingThread disabling due to no RGB leds found on I2C bus\n");
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
if (!moduleConfig.ambient_lighting.led_state) {
|
||||
LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF\n");
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("AmbientLightingThread initializing\n");
|
||||
if (_type == ScanI2C::NCP5623) {
|
||||
rgb.begin();
|
||||
setLighting();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
int32_t runOnce() override
|
||||
{
|
||||
#ifdef HAS_NCP5623
|
||||
if (_type == ScanI2C::NCP5623 && moduleConfig.ambient_lighting.led_state) {
|
||||
setLighting();
|
||||
return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification
|
||||
} else {
|
||||
return disable();
|
||||
}
|
||||
#else
|
||||
return disable();
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
ScanI2C::DeviceType _type = ScanI2C::DeviceType::NONE;
|
||||
|
||||
void setLighting()
|
||||
{
|
||||
#ifdef HAS_NCP5623
|
||||
rgb.setCurrent(moduleConfig.ambient_lighting.current);
|
||||
rgb.setRed(moduleConfig.ambient_lighting.red);
|
||||
rgb.setGreen(moduleConfig.ambient_lighting.green);
|
||||
rgb.setBlue(moduleConfig.ambient_lighting.blue);
|
||||
LOG_DEBUG("Initializing 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.blue);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace concurrency
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "RTC.h"
|
||||
#include "configuration.h"
|
||||
#include "sleep.h"
|
||||
#include "ubx.h"
|
||||
|
||||
#ifdef ARCH_PORTDUINO
|
||||
#include "meshUtils.h"
|
||||
@@ -32,7 +33,7 @@ static bool didSerialInit;
|
||||
struct uBloxGnssModelInfo info;
|
||||
uint8_t uBloxProtocolVersion;
|
||||
|
||||
void GPS::UBXChecksum(byte *message, size_t length)
|
||||
void GPS::UBXChecksum(uint8_t *message, size_t length)
|
||||
{
|
||||
uint8_t CK_A = 0, CK_B = 0;
|
||||
|
||||
@@ -47,6 +48,27 @@ void GPS::UBXChecksum(byte *message, size_t length)
|
||||
message[length - 1] = CK_B;
|
||||
}
|
||||
|
||||
// Function to create a ublox packet for editing in memory
|
||||
uint8_t GPS::makeUBXPacket(uint8_t class_id, uint8_t msg_id, uint8_t payload_size, const uint8_t *msg)
|
||||
{
|
||||
// Construct the UBX packet
|
||||
UBXscratch[0] = 0xB5; // header
|
||||
UBXscratch[1] = 0x62; // header
|
||||
UBXscratch[2] = class_id; // class
|
||||
UBXscratch[3] = msg_id; // id
|
||||
UBXscratch[4] = payload_size; // length
|
||||
UBXscratch[5] = 0x00;
|
||||
|
||||
UBXscratch[6 + payload_size] = 0x00; // CK_A
|
||||
UBXscratch[7 + payload_size] = 0x00; // CK_B
|
||||
|
||||
for (int i = 0; i < payload_size; i++) {
|
||||
UBXscratch[6 + i] = pgm_read_byte(&msg[i]);
|
||||
}
|
||||
UBXChecksum(UBXscratch, (payload_size + 8));
|
||||
return (payload_size + 8);
|
||||
}
|
||||
|
||||
GPS_RESPONSE GPS::getACK(const char *message, uint32_t waitMillis)
|
||||
{
|
||||
uint8_t buffer[768] = {0};
|
||||
@@ -306,7 +328,7 @@ bool GPS::setupGPS()
|
||||
} else if (gnssModel == GNSS_MODEL_UBLOX) {
|
||||
/*
|
||||
uint8_t buffer[768] = {0};
|
||||
byte _message_GNSS[8] = {0xb5, 0x62, // Sync message for UBX protocol
|
||||
uint8_t _message_GNSS[8] = {0xb5, 0x62, // Sync message for UBX protocol
|
||||
0x06, 0x3e, // Message class and ID (UBX-CFG-GNSS)
|
||||
0x00, 0x00, // Length of payload (28 bytes)
|
||||
0x00, 0x00};
|
||||
@@ -330,7 +352,7 @@ bool GPS::setupGPS()
|
||||
0) { // The original ublox 6 is GPS only and doesn't support the UBX-CFG-GNSS message
|
||||
if (strncmp(info.hwVersion, "00070000", 8) == 0) { // Max7 seems to only support GPS *or* GLONASS
|
||||
LOG_DEBUG("Setting GPS+SBAS\n");
|
||||
byte _message_GNSS[28] = {
|
||||
uint8_t _message_GNSS[28] = {
|
||||
0xb5, 0x62, // Sync message for UBX protocol
|
||||
0x06, 0x3e, // Message class and ID (UBX-CFG-GNSS)
|
||||
0x14, 0x00, // Length of payload (28 bytes)
|
||||
@@ -348,7 +370,7 @@ bool GPS::setupGPS()
|
||||
// Send the message to the module
|
||||
_serial_gps->write(_message_GNSS, sizeof(_message_GNSS));
|
||||
} else {
|
||||
byte _message_GNSS[36] = {
|
||||
uint8_t _message_GNSS[36] = {
|
||||
0xb5, 0x62, // Sync message for UBX protocol
|
||||
0x06, 0x3e, // Message class and ID (UBX-CFG-GNSS)
|
||||
0x1c, 0x00, // Length of payload (28 bytes)
|
||||
@@ -390,7 +412,7 @@ bool GPS::setupGPS()
|
||||
|
||||
// Enable interference resistance, because we are using LoRa, WiFi and Bluetooth on same board,
|
||||
// and we need to reduce interference from them
|
||||
byte _message_JAM[16] = {
|
||||
uint8_t _message_JAM[16] = {
|
||||
0xB5, 0x62, // UBX protocol sync characters
|
||||
0x06, 0x39, // Message class and ID (UBX-CFG-ITFM)
|
||||
0x08, 0x00, // Length of payload (8 bytes)
|
||||
@@ -419,7 +441,7 @@ bool GPS::setupGPS()
|
||||
}
|
||||
|
||||
// Configure navigation engine expert settings:
|
||||
byte _message_NAVX5[48] = {
|
||||
uint8_t _message_NAVX5[48] = {
|
||||
0xb5, 0x62, // UBX protocol sync characters
|
||||
0x06, 0x23, // Message class and ID (UBX-CFG-NAVX5)
|
||||
0x28, 0x00, // Length of payload (40 bytes)
|
||||
@@ -469,7 +491,7 @@ bool GPS::setupGPS()
|
||||
// Lowering the update rate helps to save power.
|
||||
// Additionally, for some new modules like the M9/M10, an update rate lower than 5Hz
|
||||
// is recommended to avoid a known issue with satellites disappearing.
|
||||
byte _message_1Hz[] = {
|
||||
uint8_t _message_1Hz[] = {
|
||||
0xB5, 0x62, // UBX protocol sync characters
|
||||
0x06, 0x08, // Message class and ID (UBX-CFG-RATE)
|
||||
0x06, 0x00, // Length of payload (6 bytes)
|
||||
@@ -491,7 +513,7 @@ bool GPS::setupGPS()
|
||||
|
||||
// Disable GGL. GGL - Geographic position (latitude and longitude), which provides the current geographical
|
||||
// coordinates.
|
||||
byte _message_GGL[] = {
|
||||
uint8_t _message_GGL[] = {
|
||||
0xB5, 0x62, // UBX sync characters
|
||||
0x06, 0x01, // Message class and ID (UBX-CFG-MSG)
|
||||
0x08, 0x00, // Length of payload (8 bytes)
|
||||
@@ -514,7 +536,7 @@ bool GPS::setupGPS()
|
||||
|
||||
// Enable GSA. GSA - GPS DOP and active satellites, used for detailing the satellites used in the positioning and
|
||||
// the DOP (Dilution of Precision)
|
||||
byte _message_GSA[] = {
|
||||
uint8_t _message_GSA[] = {
|
||||
0xB5, 0x62, // UBX sync characters
|
||||
0x06, 0x01, // Message class and ID (UBX-CFG-MSG)
|
||||
0x08, 0x00, // Length of payload (8 bytes)
|
||||
@@ -531,7 +553,7 @@ bool GPS::setupGPS()
|
||||
}
|
||||
|
||||
// Disable GSV. GSV - Satellites in view, details the number and location of satellites in view.
|
||||
byte _message_GSV[] = {
|
||||
uint8_t _message_GSV[] = {
|
||||
0xB5, 0x62, // UBX sync characters
|
||||
0x06, 0x01, // Message class and ID (UBX-CFG-MSG)
|
||||
0x08, 0x00, // Length of payload (8 bytes)
|
||||
@@ -549,7 +571,7 @@ bool GPS::setupGPS()
|
||||
|
||||
// Disable VTG. VTG - Track made good and ground speed, which provides course and speed information relative to
|
||||
// the ground.
|
||||
byte _message_VTG[] = {
|
||||
uint8_t _message_VTG[] = {
|
||||
0xB5, 0x62, // UBX sync characters
|
||||
0x06, 0x01, // Message class and ID (UBX-CFG-MSG)
|
||||
0x08, 0x00, // Length of payload (8 bytes)
|
||||
@@ -566,7 +588,7 @@ bool GPS::setupGPS()
|
||||
}
|
||||
|
||||
// Enable RMC. RMC - Recommended Minimum data, the essential gps pvt (position, velocity, time) data.
|
||||
byte _message_RMC[] = {
|
||||
uint8_t _message_RMC[] = {
|
||||
0xB5, 0x62, // UBX sync characters
|
||||
0x06, 0x01, // Message class and ID (UBX-CFG-MSG)
|
||||
0x08, 0x00, // Length of payload (8 bytes)
|
||||
@@ -583,7 +605,7 @@ bool GPS::setupGPS()
|
||||
}
|
||||
|
||||
// Enable GGA. GGA - Global Positioning System Fix Data, which provides 3D location and accuracy data.
|
||||
byte _message_GGA[] = {
|
||||
uint8_t _message_GGA[] = {
|
||||
0xB5, 0x62, // UBX sync characters
|
||||
0x06, 0x01, // Message class and ID (UBX-CFG-MSG)
|
||||
0x08, 0x00, // Length of payload (8 bytes)
|
||||
@@ -633,9 +655,28 @@ bool GPS::setupGPS()
|
||||
if (getACK(0x06, 0x86, 300) != GNSS_RESPONSE_OK) {
|
||||
LOG_WARN("Unable to enable powersaving for GPS.\n");
|
||||
}
|
||||
} else {
|
||||
if (strncmp(info.hwVersion, "00040007", 8) == 0) { // This PSM mode has only been tested on this hardware
|
||||
int msglen = makeUBXPacket(0x06, 0x11, 0x2, _message_CFG_RXM_PSM);
|
||||
_serial_gps->write(UBXscratch, msglen);
|
||||
if (getACK(0x06, 0x11, 300) != GNSS_RESPONSE_OK) {
|
||||
LOG_WARN("Unable to enable powersaving mode for GPS.\n");
|
||||
}
|
||||
msglen = makeUBXPacket(0x06, 0x3B, 44, _message_CFG_PM2);
|
||||
_serial_gps->write(UBXscratch, msglen);
|
||||
if (getACK(0x06, 0x3B, 300) != GNSS_RESPONSE_OK) {
|
||||
LOG_WARN("Unable to enable powersaving details for GPS.\n");
|
||||
}
|
||||
} else {
|
||||
int msglen = makeUBXPacket(0x06, 0x11, 0x2, _message_CFG_RXM_ECO);
|
||||
_serial_gps->write(UBXscratch, msglen);
|
||||
if (getACK(0x06, 0x11, 300) != GNSS_RESPONSE_OK) {
|
||||
LOG_WARN("Unable to enable powersaving ECO mode for GPS.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
// We need save configuration to flash to make our config changes persistent
|
||||
byte _message_SAVE[21] = {
|
||||
uint8_t _message_SAVE[21] = {
|
||||
0xB5, 0x62, // UBX protocol header
|
||||
0x06, 0x09, // UBX class ID (Configuration Input Messages), message ID (UBX-CFG-CFG)
|
||||
0x0D, 0x00, // Length of payload (13 bytes)
|
||||
@@ -693,7 +734,6 @@ bool GPS::setup()
|
||||
|
||||
if (config.position.gps_enabled == false && config.position.fixed_position == false) {
|
||||
setAwake(false);
|
||||
doGPSpowersave(false);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@@ -1000,8 +1040,8 @@ GnssModel_t GPS::probe(int serialSpeed)
|
||||
// setting will not output command messages in UART1, resulting in unrecognized module information
|
||||
if (serialSpeed != 9600) {
|
||||
// Set the UART port to 9600
|
||||
byte _message_prt[] = {0xB5, 0x62, 0x06, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00,
|
||||
0x80, 0x25, 0x00, 0x00, 0x07, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
uint8_t _message_prt[] = {0xB5, 0x62, 0x06, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00,
|
||||
0x80, 0x25, 0x00, 0x00, 0x07, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
UBXChecksum(_message_prt, sizeof(_message_prt));
|
||||
_serial_gps->write(_message_prt, sizeof(_message_prt));
|
||||
delay(500);
|
||||
@@ -1016,7 +1056,7 @@ GnssModel_t GPS::probe(int serialSpeed)
|
||||
}
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
byte _message_MONVER[8] = {
|
||||
uint8_t _message_MONVER[8] = {
|
||||
0xB5, 0x62, // Sync message for UBX protocol
|
||||
0x0A, 0x04, // Message class and ID (UBX-MON-VER)
|
||||
0x00, 0x00, // Length of payload (we're asking for an answer, so no payload)
|
||||
|
||||
@@ -62,6 +62,10 @@ class GPS : private concurrency::OSThread
|
||||
/** If !NULL we will use this serial port to construct our GPS */
|
||||
static HardwareSerial *_serial_gps;
|
||||
|
||||
static const uint8_t _message_PMREQ[8];
|
||||
static const uint8_t _message_CFG_RXM_PSM[2];
|
||||
static const uint8_t _message_CFG_RXM_ECO[2];
|
||||
static const uint8_t _message_CFG_PM2[44];
|
||||
meshtastic_Position p = meshtastic_Position_init_default;
|
||||
|
||||
GPS() : concurrency::OSThread("GPS") {}
|
||||
@@ -101,6 +105,12 @@ class GPS : private concurrency::OSThread
|
||||
// Empty the input buffer as quickly as possible
|
||||
void clearBuffer();
|
||||
|
||||
// Create a ublox packet for editing in memory
|
||||
uint8_t makeUBXPacket(uint8_t class_id, uint8_t msg_id, uint8_t payload_size, const uint8_t *msg);
|
||||
|
||||
// scratch space for creating ublox packets
|
||||
uint8_t UBXscratch[250] = {0};
|
||||
|
||||
protected:
|
||||
/// Do gps chipset specific init, return true for success
|
||||
virtual bool setupGPS();
|
||||
@@ -151,7 +161,7 @@ class GPS : private concurrency::OSThread
|
||||
int prepareDeepSleep(void *unused);
|
||||
|
||||
// Calculate checksum
|
||||
void UBXChecksum(byte *message, size_t length);
|
||||
void UBXChecksum(uint8_t *message, size_t length);
|
||||
|
||||
/**
|
||||
* Switch the GPS into a mode where we are actively looking for a lock, or alternatively switch GPS into a low power mode
|
||||
|
||||
31
src/gps/ubx.h
Normal file
31
src/gps/ubx.h
Normal file
@@ -0,0 +1,31 @@
|
||||
const uint8_t GPS::_message_PMREQ[] PROGMEM = {
|
||||
0x00, 0x00, // 4 bytes duration of request task
|
||||
0x00, 0x00, // (milliseconds)
|
||||
0x02, 0x00, // Task flag bitfield
|
||||
0x00, 0x00 // byte index 1 = sleep mode
|
||||
};
|
||||
|
||||
const uint8_t GPS::_message_CFG_RXM_PSM[] PROGMEM = {
|
||||
0x08, // Reserved
|
||||
0x01 // Power save mode
|
||||
};
|
||||
|
||||
const uint8_t GPS::_message_CFG_RXM_ECO[] PROGMEM = {
|
||||
0x08, // Reserved
|
||||
0x04 // eco mode
|
||||
};
|
||||
|
||||
const uint8_t GPS::_message_CFG_PM2[] PROGMEM = {
|
||||
0x01, 0x06, 0x00, 0x00, // version, Reserved
|
||||
0x0e, 0x81, 0x42, 0x01, // flags
|
||||
0xE8, 0x03, 0x00, 0x00, // update period 1000 ms
|
||||
0x10, 0x27, 0x00, 0x00, // search period 10s
|
||||
0x00, 0x00, 0x00, 0x00, // Grod offset 0
|
||||
0x01, 0x00, // onTime 1 second
|
||||
0x00, 0x00, // min search time 0
|
||||
0x2C, 0x01, // reserved
|
||||
0x00, 0x00, 0x4F, 0xC1, // reserved
|
||||
0x03, 0x00, 0x87, 0x02, // reserved
|
||||
0x00, 0x00, 0xFF, 0x00, // reserved
|
||||
0x01, 0x00, 0xD6, 0x4D // reserved
|
||||
};
|
||||
@@ -1,5 +1,3 @@
|
||||
#include "main.h"
|
||||
|
||||
#ifdef HAS_NCP5623
|
||||
#include <NCP5623.h>
|
||||
extern NCP5623 rgb;
|
||||
|
||||
55
src/main.cpp
55
src/main.cpp
@@ -73,6 +73,7 @@ NRF52Bluetooth *nrf52Bluetooth;
|
||||
|
||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||
#include "AccelerometerThread.h"
|
||||
#include "AmbientLightingThread.h"
|
||||
#endif
|
||||
|
||||
using namespace concurrency;
|
||||
@@ -169,6 +170,7 @@ static OSThread *buttonThread;
|
||||
uint32_t ButtonThread::longPressTime = 0;
|
||||
#endif
|
||||
static OSThread *accelerometerThread;
|
||||
static OSThread *ambientLightingThread;
|
||||
SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);
|
||||
|
||||
RadioInterface *rIf = NULL;
|
||||
@@ -409,14 +411,6 @@ void setup()
|
||||
// Only one supported RGB LED currently
|
||||
#ifdef HAS_NCP5623
|
||||
rgb_found = i2cScanner->find(ScanI2C::DeviceType::NCP5623);
|
||||
|
||||
// Start the RGB LED at 50%
|
||||
|
||||
if (rgb_found.type == ScanI2C::NCP5623) {
|
||||
rgb.begin();
|
||||
rgb.setCurrent(10);
|
||||
rgb.setColor(128, 128, 128);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||
@@ -521,6 +515,12 @@ void setup()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||
if (rgb_found.type != ScanI2C::DeviceType::NONE) {
|
||||
ambientLightingThread = new AmbientLightingThread(rgb_found.type);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef T_WATCH_S3
|
||||
drv.begin();
|
||||
drv.selectLibrary(1);
|
||||
@@ -558,14 +558,6 @@ void setup()
|
||||
|
||||
readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time)
|
||||
|
||||
gps = createGps();
|
||||
|
||||
if (gps) {
|
||||
gpsStatus->observe(&gps->newStatus);
|
||||
} else {
|
||||
LOG_WARN("No GPS found - running without GPS\n");
|
||||
}
|
||||
|
||||
nodeStatus->observe(&nodeDB.newStatus);
|
||||
|
||||
service.init();
|
||||
@@ -590,17 +582,6 @@ void setup()
|
||||
|
||||
screen->print("Started...\n");
|
||||
|
||||
// We have now loaded our saved preferences from flash
|
||||
|
||||
// ONCE we will factory reset the GPS for bug #327
|
||||
if (gps && !devicestate.did_gps_reset) {
|
||||
LOG_WARN("GPS FactoryReset requested\n");
|
||||
if (gps->factoryReset()) { // If we don't succeed try again next time
|
||||
devicestate.did_gps_reset = true;
|
||||
nodeDB.saveToDisk(SEGMENT_DEVICESTATE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SX126X_ANT_SW
|
||||
// make analog PA vs not PA switch on SX126x eval board work properly
|
||||
pinMode(SX126X_ANT_SW, OUTPUT);
|
||||
@@ -755,6 +736,26 @@ 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();
|
||||
|
||||
gps = createGps();
|
||||
|
||||
if (gps) {
|
||||
gpsStatus->observe(&gps->newStatus);
|
||||
if (config.position.gps_enabled == false && config.position.fixed_position == false) {
|
||||
doGPSpowersave(false);
|
||||
}
|
||||
} else {
|
||||
LOG_WARN("No GPS found - running without GPS\n");
|
||||
}
|
||||
// We have now loaded our saved preferences from flash
|
||||
|
||||
// ONCE we will factory reset the GPS for bug #327
|
||||
if (gps && !devicestate.did_gps_reset) {
|
||||
LOG_WARN("GPS FactoryReset requested\n");
|
||||
if (gps->factoryReset()) { // If we don't succeed try again next time
|
||||
devicestate.did_gps_reset = true;
|
||||
nodeDB.saveToDisk(SEGMENT_DEVICESTATE);
|
||||
}
|
||||
}
|
||||
// setBluetoothEnable(false); we now don't start bluetooth until we enter the proper state
|
||||
setCPUFast(false); // 80MHz is fine for our slow peripherals
|
||||
}
|
||||
|
||||
@@ -255,6 +255,13 @@ void NodeDB::installDefaultModuleConfig()
|
||||
moduleConfig.detection_sensor.detection_triggered_high = true;
|
||||
moduleConfig.detection_sensor.minimum_broadcast_secs = 45;
|
||||
|
||||
moduleConfig.has_ambient_lighting = true;
|
||||
moduleConfig.ambient_lighting.current = 10;
|
||||
// Default to a color based on our node number
|
||||
moduleConfig.ambient_lighting.red = (myNodeInfo.my_node_num & 0xFF0000) >> 16;
|
||||
moduleConfig.ambient_lighting.green = (myNodeInfo.my_node_num & 0x00FF00) >> 8;
|
||||
moduleConfig.ambient_lighting.blue = myNodeInfo.my_node_num & 0x0000FF;
|
||||
|
||||
initModuleConfigIntervals();
|
||||
}
|
||||
|
||||
|
||||
@@ -313,13 +313,14 @@ Initially created for the RAK14001 RGB LED module. */
|
||||
typedef struct _meshtastic_ModuleConfig_AmbientLightingConfig {
|
||||
/* Sets LED to on or off. */
|
||||
bool led_state;
|
||||
/* Sets the overall current for the LED, firmware side range for the RAK14001 is 1-31, but users should be given a range of 0-100% */
|
||||
/* Sets the current for the LED output. Default is 10. */
|
||||
uint8_t current;
|
||||
uint8_t red; /* Red level */
|
||||
/* Sets the green level of the LED, firmware side values are 0-255, but users should be given a range of 0-100% */
|
||||
uint8_t green; /* Green level */
|
||||
/* Sets the blue level of the LED, firmware side values are 0-255, but users should be given a range of 0-100% */
|
||||
uint8_t blue; /* Blue level */
|
||||
/* Sets the red LED level. Values are 0-255. */
|
||||
uint8_t red;
|
||||
/* Sets the green LED level. Values are 0-255. */
|
||||
uint8_t green;
|
||||
/* Sets the blue LED level. Values are 0-255. */
|
||||
uint8_t blue;
|
||||
} meshtastic_ModuleConfig_AmbientLightingConfig;
|
||||
|
||||
/* A GPIO pin definition for remote hardware module */
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#ifdef HAS_NCP5623
|
||||
#include <graphics/RAKled.h>
|
||||
NCP5623 rgb;
|
||||
|
||||
uint8_t red = 0;
|
||||
uint8_t green = 0;
|
||||
|
||||
@@ -99,7 +99,6 @@ NeighborInfoModule::NeighborInfoModule()
|
||||
setIntervalFromNow(35 * 1000);
|
||||
} else {
|
||||
LOG_DEBUG("NeighborInfoModule is disabled\n");
|
||||
neighborState = meshtastic_NeighborInfo_init_zero;
|
||||
disable();
|
||||
}
|
||||
}
|
||||
@@ -203,8 +202,10 @@ Pass it to an upper client; do not persist this data on the mesh
|
||||
*/
|
||||
bool NeighborInfoModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_NeighborInfo *np)
|
||||
{
|
||||
printNeighborInfo("RECEIVED", np);
|
||||
updateNeighbors(mp, np);
|
||||
if (enabled) {
|
||||
printNeighborInfo("RECEIVED", np);
|
||||
updateNeighbors(mp, np);
|
||||
}
|
||||
// Allow others to handle this packet
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -204,6 +204,19 @@ void doGPSpowersave(bool on)
|
||||
notifyGPSSleep.notifyObservers(NULL);
|
||||
}
|
||||
#endif
|
||||
#if !(defined(HAS_PMU) || defined(PIN_GPS_EN) || defined(PIN_GPS_WAKE))
|
||||
if (!on) {
|
||||
uint8_t msglen;
|
||||
notifyGPSSleep.notifyObservers(NULL);
|
||||
msglen = gps->makeUBXPacket(0x02, 0x41, 0x08, gps->_message_PMREQ);
|
||||
for (int i = 0; i < msglen; i++) {
|
||||
gps->_serial_gps->write(gps->UBXscratch, msglen);
|
||||
}
|
||||
} else {
|
||||
gps->forceWake(1);
|
||||
gps->_serial_gps->write(0xFF);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void doDeepSleep(uint32_t msecToWake)
|
||||
|
||||
@@ -228,7 +228,6 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
|
||||
#define GPS_TX_PIN PIN_SERIAL1_TX
|
||||
|
||||
// Define pin to enable GPS toggle (set GPIO to LOW) via user button triple press
|
||||
#define PIN_GPS_EN 34 // GPS power enable pin
|
||||
|
||||
// RAK12002 RTC Module
|
||||
#define RV3028_RTC (uint8_t)0b1010010
|
||||
@@ -276,4 +275,4 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
|
||||
* Arduino objects - C++ only
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -3,9 +3,12 @@
|
||||
#define I2C_SDA 21
|
||||
#define I2C_SCL 22
|
||||
|
||||
#define I2C_SDA1 14 // Second i2c channel on external IO connector
|
||||
#define I2C_SCL1 15 // Second i2c channel on external IO connector
|
||||
|
||||
#define BUTTON_PIN 36 // The middle button GPIO on the Nano G1
|
||||
//#define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented
|
||||
// anywhere.
|
||||
// #define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented
|
||||
// anywhere.
|
||||
#define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
|
||||
|
||||
// common pinout for their SX1262 vs RF95 modules - both can be enabled and we will probe at runtime for RF95 and if
|
||||
@@ -24,9 +27,9 @@
|
||||
#define SX126X_DIO1 LORA_DIO1
|
||||
#define SX126X_BUSY LORA_DIO2
|
||||
#define SX126X_RESET LORA_RESET
|
||||
//#define SX126X_E22 // Not really an E22
|
||||
// Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
|
||||
// code)
|
||||
// #define SX126X_E22 // Not really an E22
|
||||
// Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
|
||||
// code)
|
||||
#define SX126X_MAX_POWER \
|
||||
16 // Ensure the PA does not exceed the saturation output power. More
|
||||
// Info:https://uniteng.com/wiki/doku.php?id=meshtastic:station#rf_design_-_lora_station_edition_g1
|
||||
@@ -42,4 +45,4 @@
|
||||
#define BAT_NOBATVOLT 6690
|
||||
|
||||
// different screen
|
||||
#define USE_SH1106
|
||||
#define USE_SH1106
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[VERSION]
|
||||
major = 2
|
||||
minor = 2
|
||||
build = 4
|
||||
build = 5
|
||||
|
||||
Reference in New Issue
Block a user