Compare commits

..

23 Commits

Author SHA1 Message Date
Ben Meadors
700397d3ed ugh 2024-08-27 07:32:05 -05:00
Ben Meadors
cd65497ac4 Update to move setup to its own module 2024-08-27 07:02:49 -05:00
Ben Meadors
3c90a65a66 WIP 2024-08-27 06:24:36 -05:00
Ben Meadors
9e8f0814ab Stuff 2024-08-26 16:34:28 -05:00
Ben Meadors
36cadd03ee wip 2024-08-25 15:27:59 -05:00
Ben Meadors
15ee827efd Hello world 2024-08-25 13:41:58 -05:00
Ben Meadors
d6dac1737a Userlite mem comparison (#4552) 2024-08-24 12:19:31 -05:00
github-actions[bot]
23844389ac [create-pull-request] automated change (#4544)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
2024-08-23 20:44:14 -05:00
John Hollowell
8847945734 Add devcontainer (#4491)
devcontainers can be used by IDEs/editors like VS Code to create a standardized development environment in a container
2024-08-23 20:25:16 -05:00
Nestpebble
5514aab007 add a .yml to setup a Gitpod instance quickly (#4551)
* Create .gitpod.yml

* Update .gitpod.yml
2024-08-23 20:24:23 -05:00
geeksville
aa54335e21 remove deprecated serial/bt logging options and unify in the new (#4516)
security option.  Per discussion in https://github.com/meshtastic/firmware/issues/4375
no need to preserve the old options when changing to this new simpler
single boolean because they were newish, rarely used and only for 'advanced'
developers.
2024-08-23 20:18:36 -05:00
Ben Meadors
2a279c7f3d Dum dum zero comparision 2024-08-23 07:07:28 -05:00
Ben Meadors
7abc194ef5 Found more places to set explicit has_optional on position (#4542) 2024-08-23 07:04:34 -05:00
Ian McEwen
f99b81acf7 Use the '+' wildcard for MQTT rather than '#', to subscribe only to topics one nesting level deep (#4528) 2024-08-23 07:03:29 -05:00
Michael Gjelsø
0850ad6c8d Initial support for RadioMaster Bandit. (#4523)
* Initial support for RadioMaster Bandit.

* Different lighting can be made for Button 1 & 2 on the Bandit.
Changes to AmbientLighting will turn off af shutdown().

* Trunk

* Trunk again.
2024-08-23 06:28:23 -05:00
Jonathan Bennett
00ea9182a4 Fix copyPasta in NodeDB (#4538) 2024-08-23 06:26:19 -05:00
Jonathan Bennett
601ae29fe9 Adds has_x bools to position packet. (#4540) 2024-08-23 06:25:40 -05:00
Ben Meadors
ff500bc5a9 Save nodedb after favoriting (or removing) (#4537) 2024-08-22 20:57:03 -05:00
Mark Trevor Birss
734f36589d Update variant.h (#4534) 2024-08-22 10:44:49 -05:00
Mark Trevor Birss
1e655052fc Fixes for ME25LS01_4Y10TD and ESP32-PICO (#4522)
* Update platformio.ini

* Update variant.h

* Update architecture.h

* Update variant.h
2024-08-22 07:00:19 -05:00
Ben Meadors
6ddee795d6 Poetry 2024-08-21 17:24:56 -05:00
Mark Trevor Birss
d556ae762c Update ScanI2CTwoWire.cpp (#4520) 2024-08-21 06:04:03 -05:00
geeksville
48e0fd7ed0 fix #4448 (by seeing there is actually no problem) (#4517)
Print directory names when listing directories
2024-08-20 17:38:39 -05:00
33 changed files with 632 additions and 67 deletions

24
.devcontainer/Dockerfile Normal file
View File

@@ -0,0 +1,24 @@
FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12
# [Optional] Uncomment this section to install additional packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
ca-certificates \
g++ \
git \
libbluetooth-dev \
libgpiod-dev \
liborcania-dev \
libssl-dev \
libulfius-dev \
libyaml-cpp-dev \
pkg-config \
python3 \
python3-pip \
python3-venv \
python3-wheel \
wget \
zip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pip3 install --no-cache-dir -U platformio==6.1.15

View File

@@ -0,0 +1,28 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Meshtastic Firmware Dev",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"version": "latest"
}
},
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"platformio.platformio-ide",
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [ 4403 ],
// Run commands to prepare the container for use
"postCreateCommand": ".devcontainer/setup.sh",
}

3
.devcontainer/setup.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env sh
git submodule update --init

View File

@@ -35,6 +35,7 @@ runs:
python -m pip install --upgrade pip
pip install -U --no-build-isolation --no-cache-dir "setuptools<72"
pip install -U platformio adafruit-nrfutil --no-build-isolation
pip install -U poetry --no-build-isolation
pip install -U meshtastic --pre --no-build-isolation
- name: Upgrade platformio

2
.gitpod.yml Normal file
View File

@@ -0,0 +1,2 @@
tasks:
- init: pip install platformio && pip install --upgrade pip

View File

@@ -34,6 +34,7 @@ default_envs = tbeam
;default_envs = wio-e5
;default_envs = radiomaster_900_bandit_nano
;default_envs = radiomaster_900_bandit_micro
;default_envs = radiomaster_900_bandit
;default_envs = heltec_capsule_sensor_v3
;default_envs = heltec_vision_master_t190
;default_envs = heltec_vision_master_e213

View File

@@ -1,3 +1,4 @@
#include "Observer.h"
#include "configuration.h"
#ifdef HAS_NCP5623
@@ -22,10 +23,18 @@ class AmbientLightingThread : public concurrency::OSThread
public:
explicit AmbientLightingThread(ScanI2C::DeviceType type) : OSThread("AmbientLightingThread")
{
notifyDeepSleepObserver.observe(&notifyDeepSleep); // Let us know when shutdown() is issued.
// Enables Ambient Lighting by default if conditions are meet.
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
#ifdef ENABLE_AMBIENTLIGHTING
moduleConfig.ambient_lighting.led_state = true;
#endif
#endif
// Uncomment to test module
// moduleConfig.ambient_lighting.led_state = true;
// moduleConfig.ambient_lighting.current = 10;
// // Default to a color based on our node number
// 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;
@@ -82,9 +91,46 @@ class AmbientLightingThread : public concurrency::OSThread
return disable();
}
// When shutdown() is issued, setLightingOff will be called.
CallbackObserver<AmbientLightingThread, void *> notifyDeepSleepObserver =
CallbackObserver<AmbientLightingThread, void *>(this, &AmbientLightingThread::setLightingOff);
private:
ScanI2C::DeviceType _type = ScanI2C::DeviceType::NONE;
// Turn RGB lighting off, is used in junction to shutdown()
int setLightingOff(void *unused)
{
#ifdef HAS_NCP5623
rgb.setCurrent(0);
rgb.setRed(0);
rgb.setGreen(0);
rgb.setBlue(0);
LOG_INFO("Turn Off NCP5623 Ambient lighting.\n");
#endif
#ifdef HAS_NEOPIXEL
pixels.clear();
pixels.show();
LOG_INFO("Turn Off NeoPixel Ambient lighting.\n");
#endif
#ifdef RGBLED_CA
analogWrite(RGBLED_RED, 255 - 0);
analogWrite(RGBLED_GREEN, 255 - 0);
analogWrite(RGBLED_BLUE, 255 - 0);
LOG_INFO("Turn Off Ambient lighting RGB Common Anode.\n");
#elif defined(RGBLED_RED)
analogWrite(RGBLED_RED, 0);
analogWrite(RGBLED_GREEN, 0);
analogWrite(RGBLED_BLUE, 0);
LOG_INFO("Turn Off Ambient lighting RGB Common Cathode.\n");
#endif
#ifdef UNPHONE
unphone.rgb(0, 0, 0);
LOG_INFO("Turn Off unPhone Ambient lighting.\n");
#endif
return 0;
}
void setLighting()
{
#ifdef HAS_NCP5623
@@ -100,6 +146,17 @@ class AmbientLightingThread : public concurrency::OSThread
pixels.fill(pixels.Color(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
moduleConfig.ambient_lighting.blue),
0, NEOPIXEL_COUNT);
// RadioMaster Bandit has addressable LED at the two buttons
// this allow us to set different lighting for them in variant.h file.
#ifdef RADIOMASTER_900_BANDIT
#if defined(BUTTON1_COLOR) && defined(BUTTON1_COLOR_INDEX)
pixels.fill(BUTTON1_COLOR, BUTTON1_COLOR_INDEX, 1);
#endif
#if defined(BUTTON2_COLOR) && defined(BUTTON2_COLOR_INDEX)
pixels.fill(BUTTON2_COLOR, BUTTON1_COLOR_INDEX, 1);
#endif
#endif
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,

View File

@@ -249,6 +249,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
file.close();
}
#else
LOG_DEBUG(" %s (directory)\n", file.name());
listDir(file.name(), levels - 1, del);
file.close();
#endif
@@ -275,7 +276,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
file.close();
}
#else
LOG_DEBUG(" %s (%i Bytes)\n", file.name(), file.size());
LOG_DEBUG(" %s (%i Bytes)\n", file.name(), file.size());
file.close();
#endif
}

View File

@@ -213,7 +213,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.security.bluetooth_logging_enabled && !pauseBluetoothLogging) {
if (config.security.debug_log_api_enabled && !pauseBluetoothLogging) {
bool isBleConnected = false;
#ifdef ARCH_ESP32
isBleConnected = nimbleBluetooth && nimbleBluetooth->isActive() && nimbleBluetooth->isConnected();

View File

@@ -315,7 +315,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
case SHT31_4x_ADDR:
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x89), 2);
if (registerValue == 0x11a2 || registerValue == 0x11da) {
if (registerValue == 0x11a2 || registerValue == 0x11da || registerValue == 0xe9c) {
type = SHT4X;
LOG_INFO("SHT4X sensor found\n");
} else if (getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x7E), 2) == 0x5449) {

View File

@@ -127,7 +127,6 @@ NodeDB::NodeDB()
if (!config.has_security) {
config.has_security = true;
config.security.serial_enabled = config.device.serial_enabled;
config.security.bluetooth_logging_enabled = config.bluetooth.device_logging_enabled;
config.security.is_managed = config.device.is_managed;
}
#if !(MESHTASTIC_EXCLUDE_PKI)
@@ -556,13 +555,8 @@ void NodeDB::cleanupMeshDB()
for (int i = 0; i < numMeshNodes; i++) {
if (meshNodes->at(i).has_user) {
if (meshNodes->at(i).user.public_key.size > 0) {
for (int j = 0; j < numMeshNodes; j++) {
if (meshNodes->at(i).user.public_key.bytes[j] != 0) {
break;
}
if (j == 31) {
meshNodes->at(i).user.public_key.size = 0;
}
if (memfll(meshNodes->at(i).user.public_key.bytes, 0, meshNodes->at(i).user.public_key.size)) {
meshNodes->at(i).user.public_key.size = 0;
}
}
meshNodes->at(newPos++) = meshNodes->at(i);
@@ -1033,9 +1027,10 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde
#endif
// Both of info->user and p start as filled with zero so I think this is okay
bool changed = memcmp(&info->user, &p, sizeof(info->user)) || (info->channel != channelIndex);
auto lite = TypeConversions::ConvertToUserLite(p);
bool changed = memcmp(&info->user, &lite, sizeof(info->user)) || (info->channel != channelIndex);
info->user = TypeConversions::ConvertToUserLite(p);
info->user = lite;
if (info->user.public_key.size == 32) {
printBytes("Saved Pubkey: ", info->user.public_key.bytes, 32);
}

View File

@@ -16,7 +16,7 @@
// In theory up to 27 dBm is possible, but the modules installed in most radios can cope with a max of 20. So BIG WARNING
// if you set power to something higher than 17 or 20 you might fry your board.
#ifdef RADIOMASTER_900_BANDIT_NANO
#if defined(RADIOMASTER_900_BANDIT_NANO) || defined(RADIOMASTER_900_BANDIT)
// Structure to hold DAC and DB values
typedef struct {
uint8_t dac;
@@ -40,12 +40,23 @@ DACDB getDACandDB(uint8_t dbm)
static const struct {
uint8_t dbm;
DACDB values;
} dbmToDACDB[] = {
}
#ifdef RADIOMASTER_900_BANDIT_NANO
dbmToDACDB[] = {
{20, {168, 2}}, // 100mW
{24, {148, 6}}, // 250mW
{27, {128, 9}}, // 500mW
{30, {90, 12}} // 1000mW
};
#endif
#ifdef RADIOMASTER_900_BANDIT
dbmToDACDB[] = {
{20, {165, 2}}, // 100mW
{24, {155, 6}}, // 250mW
{27, {142, 9}}, // 500mW
{30, {110, 10}} // 1000mW
};
#endif
const int numValues = sizeof(dbmToDACDB) / sizeof(dbmToDACDB[0]);
// Find the interval dbm falls within and interpolate
@@ -56,7 +67,12 @@ DACDB getDACandDB(uint8_t dbm)
}
// Return a default value if no match is found and default to 100mW
#ifdef RADIOMASTER_900_BANDIT_NANO
DACDB defaultValue = {168, 2};
#endif
#ifdef RADIOMASTER_900_BANDIT
DACDB defaultValue = {165, 2};
#endif
return defaultValue;
}
#endif
@@ -95,7 +111,7 @@ bool RF95Interface::init()
{
RadioLibInterface::init();
#ifdef RADIOMASTER_900_BANDIT_NANO
#if defined(RADIOMASTER_900_BANDIT_NANO) || defined(RADIOMASTER_900_BANDIT)
// DAC and DB values based on dBm using interpolation
DACDB dacDbValues = getDACandDB(power);
int8_t powerDAC = dacDbValues.dac;
@@ -117,7 +133,7 @@ bool RF95Interface::init()
// enable PA
#ifdef RF95_PA_EN
#if defined(RF95_PA_DAC_EN)
#ifdef RADIOMASTER_900_BANDIT_NANO
#if defined(RADIOMASTER_900_BANDIT_NANO) || defined(RADIOMASTER_900_BANDIT)
// Use calculated DAC value
dacWrite(RF95_PA_EN, powerDAC);
#else
@@ -163,7 +179,7 @@ bool RF95Interface::init()
LOG_INFO("Frequency set to %f\n", getFreq());
LOG_INFO("Bandwidth set to %f\n", bw);
LOG_INFO("Power output set to %d\n", power);
#ifdef RADIOMASTER_900_BANDIT_NANO
#if defined(RADIOMASTER_900_BANDIT_NANO) || defined(RADIOMASTER_900_BANDIT)
LOG_INFO("DAC output set to %d\n", powerDAC);
#endif

View File

@@ -16,8 +16,14 @@ meshtastic_NodeInfo TypeConversions::ConvertToNodeInfo(const meshtastic_NodeInfo
if (lite->has_position) {
info.has_position = true;
if (lite->position.latitude_i != 0)
info.position.has_latitude_i = true;
info.position.latitude_i = lite->position.latitude_i;
if (lite->position.longitude_i != 0)
info.position.has_longitude_i = true;
info.position.longitude_i = lite->position.longitude_i;
if (lite->position.altitude != 0)
info.position.has_altitude = true;
info.position.altitude = lite->position.altitude;
info.position.location_source = lite->position.location_source;
info.position.time = lite->position.time;
@@ -48,8 +54,14 @@ meshtastic_PositionLite TypeConversions::ConvertToPositionLite(meshtastic_Positi
meshtastic_Position TypeConversions::ConvertToPosition(meshtastic_PositionLite lite)
{
meshtastic_Position position = meshtastic_Position_init_default;
if (lite.latitude_i != 0)
position.has_latitude_i = true;
position.latitude_i = lite.latitude_i;
if (lite.longitude_i != 0)
position.has_longitude_i = true;
position.longitude_i = lite.longitude_i;
if (lite.altitude != 0)
position.has_altitude = true;
position.altitude = lite.altitude;
position.location_source = lite.location_source;
position.time = lite.time;

View File

@@ -284,10 +284,6 @@ typedef struct _meshtastic_Config_DeviceConfig {
/* Disabling this will disable the SerialConsole by not initilizing the StreamAPI
Moved to SecurityConfig */
bool serial_enabled;
/* By default we turn off logging as soon as an API client connects (to keep shared serial link quiet).
Set this to true to leave the debug log outputting even when API is active.
Moved to SecurityConfig */
bool debug_log_enabled;
/* For boards without a hard wired button, this is the pin number that will be used
Boards that have more than one button can swap the function with this one. defaults to BUTTON_PIN if defined. */
uint32_t button_gpio;
@@ -523,9 +519,6 @@ typedef struct _meshtastic_Config_BluetoothConfig {
meshtastic_Config_BluetoothConfig_PairingMode mode;
/* Specified PIN for PairingMode.FixedPin */
uint32_t fixed_pin;
/* Enables device (serial style logs) over Bluetooth
Moved to SecurityConfig */
bool device_logging_enabled;
} meshtastic_Config_BluetoothConfig;
typedef PB_BYTES_ARRAY_T(32) meshtastic_Config_SecurityConfig_public_key_t;
@@ -546,10 +539,8 @@ typedef struct _meshtastic_Config_SecurityConfig {
/* Serial Console over the Stream API." */
bool serial_enabled;
/* By default we turn off logging as soon as an API client connects (to keep shared serial link quiet).
Output live debug logging over serial. */
Output live debug logging over serial or bluetooth is set to true. */
bool debug_log_api_enabled;
/* Enables device (serial style logs) over Bluetooth */
bool bluetooth_logging_enabled;
/* Allow incoming device control over the insecure legacy admin channel. */
bool admin_channel_enabled;
} meshtastic_Config_SecurityConfig;
@@ -658,32 +649,31 @@ extern "C" {
/* Initializer values for message structs */
#define meshtastic_Config_init_default {0, {meshtastic_Config_DeviceConfig_init_default}}
#define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
#define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
#define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN}
#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, ""}
#define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0}
#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN}
#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0}
#define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0, 0}
#define meshtastic_Config_SecurityConfig_init_default {{0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0, 0}
#define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
#define meshtastic_Config_SecurityConfig_init_default {{0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0}
#define meshtastic_Config_SessionkeyConfig_init_default {0}
#define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}}
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
#define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN}
#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, ""}
#define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0}
#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN}
#define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0}
#define meshtastic_Config_BluetoothConfig_init_zero {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0, 0}
#define meshtastic_Config_SecurityConfig_init_zero {{0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0, 0}
#define meshtastic_Config_BluetoothConfig_init_zero {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
#define meshtastic_Config_SecurityConfig_init_zero {{0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0}
#define meshtastic_Config_SessionkeyConfig_init_zero {0}
/* Field tags (for use in manual encoding/decoding) */
#define meshtastic_Config_DeviceConfig_role_tag 1
#define meshtastic_Config_DeviceConfig_serial_enabled_tag 2
#define meshtastic_Config_DeviceConfig_debug_log_enabled_tag 3
#define meshtastic_Config_DeviceConfig_button_gpio_tag 4
#define meshtastic_Config_DeviceConfig_buzzer_gpio_tag 5
#define meshtastic_Config_DeviceConfig_rebroadcast_mode_tag 6
@@ -758,14 +748,12 @@ extern "C" {
#define meshtastic_Config_BluetoothConfig_enabled_tag 1
#define meshtastic_Config_BluetoothConfig_mode_tag 2
#define meshtastic_Config_BluetoothConfig_fixed_pin_tag 3
#define meshtastic_Config_BluetoothConfig_device_logging_enabled_tag 4
#define meshtastic_Config_SecurityConfig_public_key_tag 1
#define meshtastic_Config_SecurityConfig_private_key_tag 2
#define meshtastic_Config_SecurityConfig_admin_key_tag 3
#define meshtastic_Config_SecurityConfig_is_managed_tag 4
#define meshtastic_Config_SecurityConfig_serial_enabled_tag 5
#define meshtastic_Config_SecurityConfig_debug_log_api_enabled_tag 6
#define meshtastic_Config_SecurityConfig_bluetooth_logging_enabled_tag 7
#define meshtastic_Config_SecurityConfig_admin_channel_enabled_tag 8
#define meshtastic_Config_device_tag 1
#define meshtastic_Config_position_tag 2
@@ -803,7 +791,6 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,sessionkey,payload_variant.s
#define meshtastic_Config_DeviceConfig_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UENUM, role, 1) \
X(a, STATIC, SINGULAR, BOOL, serial_enabled, 2) \
X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 3) \
X(a, STATIC, SINGULAR, UINT32, button_gpio, 4) \
X(a, STATIC, SINGULAR, UINT32, buzzer_gpio, 5) \
X(a, STATIC, SINGULAR, UENUM, rebroadcast_mode, 6) \
@@ -906,8 +893,7 @@ X(a, STATIC, SINGULAR, BOOL, ignore_mqtt, 104)
#define meshtastic_Config_BluetoothConfig_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
X(a, STATIC, SINGULAR, UENUM, mode, 2) \
X(a, STATIC, SINGULAR, UINT32, fixed_pin, 3) \
X(a, STATIC, SINGULAR, BOOL, device_logging_enabled, 4)
X(a, STATIC, SINGULAR, UINT32, fixed_pin, 3)
#define meshtastic_Config_BluetoothConfig_CALLBACK NULL
#define meshtastic_Config_BluetoothConfig_DEFAULT NULL
@@ -918,7 +904,6 @@ X(a, STATIC, SINGULAR, BYTES, admin_key, 3) \
X(a, STATIC, SINGULAR, BOOL, is_managed, 4) \
X(a, STATIC, SINGULAR, BOOL, serial_enabled, 5) \
X(a, STATIC, SINGULAR, BOOL, debug_log_api_enabled, 6) \
X(a, STATIC, SINGULAR, BOOL, bluetooth_logging_enabled, 7) \
X(a, STATIC, SINGULAR, BOOL, admin_channel_enabled, 8)
#define meshtastic_Config_SecurityConfig_CALLBACK NULL
#define meshtastic_Config_SecurityConfig_DEFAULT NULL
@@ -955,15 +940,15 @@ extern const pb_msgdesc_t meshtastic_Config_SessionkeyConfig_msg;
/* Maximum encoded size of messages (where known) */
#define MESHTASTIC_MESHTASTIC_CONFIG_PB_H_MAX_SIZE meshtastic_Config_size
#define meshtastic_Config_BluetoothConfig_size 12
#define meshtastic_Config_DeviceConfig_size 100
#define meshtastic_Config_BluetoothConfig_size 10
#define meshtastic_Config_DeviceConfig_size 98
#define meshtastic_Config_DisplayConfig_size 30
#define meshtastic_Config_LoRaConfig_size 82
#define meshtastic_Config_NetworkConfig_IpV4Config_size 20
#define meshtastic_Config_NetworkConfig_size 196
#define meshtastic_Config_PositionConfig_size 62
#define meshtastic_Config_PowerConfig_size 52
#define meshtastic_Config_SecurityConfig_size 112
#define meshtastic_Config_SecurityConfig_size 110
#define meshtastic_Config_SessionkeyConfig_size 0
#define meshtastic_Config_size 199

View File

@@ -358,7 +358,7 @@ extern const pb_msgdesc_t meshtastic_OEMStore_msg;
#define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_OEMStore_size
#define meshtastic_ChannelFile_size 718
#define meshtastic_NodeInfoLite_size 183
#define meshtastic_OEMStore_size 3502
#define meshtastic_OEMStore_size 3496
#define meshtastic_PositionLite_size 28
#define meshtastic_UserLite_size 96

View File

@@ -187,7 +187,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
/* Maximum encoded size of messages (where known) */
#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalModuleConfig_size
#define meshtastic_LocalConfig_size 669
#define meshtastic_LocalConfig_size 663
#define meshtastic_LocalModuleConfig_size 687
#ifdef __cplusplus

View File

@@ -189,6 +189,13 @@ typedef enum _meshtastic_HardwareModel {
meshtastic_HardwareModel_RADIOMASTER_900_BANDIT = 74,
/* Minewsemi ME25LS01 (ME25LE01_V1.0). NRF52840 w/ LR1110 radio, buttons and leds and pins. */
meshtastic_HardwareModel_ME25LS01_4Y10TD = 75,
/* RP2040_FEATHER_RFM95
Adafruit Feather RP2040 with RFM95 LoRa Radio RFM95 with SX1272, SSD1306 OLED
https://www.adafruit.com/product/5714
https://www.adafruit.com/product/326
https://www.adafruit.com/product/938
^^^ short A0 to switch to I2C address 0x3C */
meshtastic_HardwareModel_RP2040_FEATHER_RFM95 = 76,
/* ------------------------------------------------------------------------------------------------------------------------------------------
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.
------------------------------------------------------------------------------------------------------------------------------------------ */

View File

@@ -238,6 +238,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node);
if (node != NULL) {
node->is_favorite = true;
saveChanges(SEGMENT_DEVICESTATE, false);
}
break;
}
@@ -246,6 +247,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node);
if (node != NULL) {
node->is_favorite = false;
saveChanges(SEGMENT_DEVICESTATE, false);
}
break;
}

View File

@@ -187,16 +187,23 @@ meshtastic_MeshPacket *PositionModule::allocReply()
p.longitude_i = localPosition.longitude_i;
}
p.precision_bits = precision;
p.has_latitude_i = true;
p.has_longitude_i = true;
p.time = getValidTime(RTCQualityNTP) > 0 ? getValidTime(RTCQualityNTP) : localPosition.time;
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE) {
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL)
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL) {
p.altitude = localPosition.altitude;
else
p.has_altitude = true;
} else {
p.altitude_hae = localPosition.altitude_hae;
p.has_altitude_hae = true;
}
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_GEOIDAL_SEPARATION)
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_GEOIDAL_SEPARATION) {
p.altitude_geoidal_separation = localPosition.altitude_geoidal_separation;
p.has_altitude_geoidal_separation = true;
}
}
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_DOP) {
@@ -216,11 +223,15 @@ meshtastic_MeshPacket *PositionModule::allocReply()
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_SEQ_NO)
p.seq_number = localPosition.seq_number;
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_HEADING)
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_HEADING) {
p.ground_track = localPosition.ground_track;
p.has_ground_track = true;
}
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_SPEED)
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_SPEED) {
p.ground_speed = localPosition.ground_speed;
p.has_ground_speed = true;
}
// Strip out any time information before sending packets to other nodes - to keep the wire size small (and because other
// nodes shouldn't trust it anyways) Note: we allow a device with a local GPS or NTP to include the time, so that devices

View File

@@ -376,12 +376,12 @@ void MQTT::sendSubscriptions()
const auto &ch = channels.getByIndex(i);
if (ch.settings.downlink_enabled) {
hasDownlink = true;
std::string topic = cryptTopic + channels.getGlobalId(i) + "/#";
std::string topic = cryptTopic + channels.getGlobalId(i) + "/+";
LOG_INFO("Subscribing to %s\n", topic.c_str());
pubSub.subscribe(topic.c_str(), 1); // FIXME, is QOS 1 right?
#ifndef ARCH_NRF52 // JSON is not supported on nRF52, see issue #2804
if (moduleConfig.mqtt.json_enabled == true) {
std::string topicDecoded = jsonTopic + channels.getGlobalId(i) + "/#";
std::string topicDecoded = jsonTopic + channels.getGlobalId(i) + "/+";
LOG_INFO("Subscribing to %s\n", topicDecoded.c_str());
pubSub.subscribe(topicDecoded.c_str(), 1); // FIXME, is QOS 1 right?
}
@@ -390,7 +390,7 @@ void MQTT::sendSubscriptions()
}
#if !MESHTASTIC_EXCLUDE_PKI
if (hasDownlink) {
std::string topic = cryptTopic + "PKI/#";
std::string topic = cryptTopic + "PKI/+";
LOG_INFO("Subscribing to %s\n", topic.c_str());
pubSub.subscribe(topic.c_str(), 1);
}

View File

@@ -152,6 +152,8 @@
#define HW_VENDOR meshtastic_HardwareModel_WIPHONE
#elif defined(RADIOMASTER_900_BANDIT_NANO)
#define HW_VENDOR meshtastic_HardwareModel_RADIOMASTER_900_BANDIT_NANO
#elif defined(RADIOMASTER_900_BANDIT)
#define HW_VENDOR meshtastic_HardwareModel_RADIOMASTER_900_BANDIT
#elif defined(HELTEC_CAPSULE_SENSOR_V3)
#define HW_VENDOR meshtastic_HardwareModel_HELTEC_CAPSULE_SENSOR_V3
#elif defined(HELTEC_VISION_MASTER_T190)

View File

@@ -65,8 +65,8 @@
#define HW_VENDOR meshtastic_HardwareModel_WIO_WM1110
#elif defined(TRACKER_T1000_E)
#define HW_VENDOR meshtastic_HardwareModel_TRACKER_T1000_E
#elif defined(ME25LS01)
#define HW_VENDOR meshtastic_HardwareModel_ME25LS01
#elif defined(ME25LS01_4Y10TD)
#define HW_VENDOR meshtastic_HardwareModel_ME25LS01_4Y10TD
#elif defined(PRIVATE_HW) || defined(FEATHER_DIY)
#define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW
#else

58
test/end2end/flash.py Normal file
View File

@@ -0,0 +1,58 @@
# trunk-ignore-all(bandit/B404)
import subprocess
import usb.core
def find_usb_device(vendor_id, product_id):
# Find USB devices
dev = usb.core.find(find_all=True)
# Loop through devices, printing vendor and product ids in decimal and hex
for cfg in dev:
if cfg.idVendor == vendor_id and cfg.idProduct == product_id:
return cfg
return None
# Flash esp32 target
def flash_esp32(pio_env, port):
# trunk-ignore(bandit/B603)
# trunk-ignore(bandit/B607)
subprocess.run(
["platformio", "run", "-e", pio_env, "-t", "upload", "--upload-port", port]
)
def flash_nrf52(pio_env, port):
# trunk-ignore(bandit/B603)
# trunk-ignore(bandit/B607)
subprocess.run(
["platformio", "run", "-e", pio_env, "-t", "upload", "--upload-port", port]
)
def find_usb_device(vendor_id, product_id):
# Find USB devices
dev = usb.core.find(find_all=True)
# Loop through devices, printing vendor and product ids in decimal and hex
for cfg in dev:
if cfg.idVendor == vendor_id and cfg.idProduct == product_id:
return cfg
return None
# Flash esp32 target
def flash_esp32(pio_env, port):
# trunk-ignore(bandit/B603)
# trunk-ignore(bandit/B607)
subprocess.run(
["platformio", "run", "-e", pio_env, "-t", "upload", "--upload-port", port]
)
def flash_nrf52(pio_env, port):
# trunk-ignore(bandit/B603)
# trunk-ignore(bandit/B607)
subprocess.run(
["platformio", "run", "-e", pio_env, "-t", "upload", "--upload-port", port]
)

42
test/end2end/readprops.py Normal file
View File

@@ -0,0 +1,42 @@
import configparser
import subprocess
def readProps(prefsLoc):
"""Read the version of our project as a string"""
config = configparser.RawConfigParser()
config.read(prefsLoc)
version = dict(config.items("VERSION"))
verObj = dict(
short="{}.{}.{}".format(version["major"], version["minor"], version["build"]),
long="unset",
)
# Try to find current build SHA if if the workspace is clean. This could fail if git is not installed
try:
sha = (
subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
.decode("utf-8")
.strip()
)
isDirty = (
subprocess.check_output(["git", "diff", "HEAD"]).decode("utf-8").strip()
)
suffix = sha
# if isDirty:
# # short for 'dirty', we want to keep our verstrings source for protobuf reasons
# suffix = sha + "-d"
verObj["long"] = "{}.{}.{}.{}".format(
version["major"], version["minor"], version["build"], suffix
)
except:
# print("Unexpected error:", sys.exc_info()[0])
# traceback.print_exc()
verObj["long"] = verObj["short"]
# print("firmware version " + verStr)
return verObj
# print("path is" + ','.join(sys.path))

59
test/end2end/setup.py Normal file
View File

@@ -0,0 +1,59 @@
import time
import flash
import meshtastic
import meshtastic.serial_interface
from readprops import readProps
version = readProps("version.properties")["long"]
def setup_users_prefs(prefsLoc):
with open(prefsLoc, "r") as file:
filedata = file.read()
filedata = filedata.replace(
"// #define CONFIG_LORA_REGION_USERPREFS",
"#define CONFIG_LORA_REGION_USERPREFS",
)
filedata = filedata.replace(
"// #define LORACONFIG_CHANNEL_NUM_USERPREFS",
"#define LORACONFIG_CHANNEL_NUM_USERPREFS",
)
filedata = filedata.replace(
"// #define CHANNEL_0_PRECISION", "#define CHANNEL_0_PRECISION"
)
with open(prefsLoc, "w") as file:
file.write(filedata)
def setup_device(port, pio_env, arch):
interface = meshtastic.serial_interface.SerialInterface(port)
try:
interface.waitForConfig()
if interface.metadata.firmware_version == version:
print("Already at local ref version", version)
else:
print(
"Device has version",
interface.metadata.firmware_version,
" updating to",
version,
)
interface.close()
time.sleep(1)
flash_device(port, pio_env, arch)
time.sleep(2)
except:
interface.close()
time.sleep(1)
flash_device(port, pio_env, arch)
time.sleep(2)
interface = meshtastic.serial_interface.SerialInterface(port)
interface.waitForConfig()
def flash_device(port, pio_env, arch):
if arch == "esp32":
flash.flash_esp32(pio_env=pio_env, port=port)
elif arch == "nrf52":
flash.flash_nrf52(pio_env=pio_env, port=port)

121
test/end2end/test.py Normal file
View File

@@ -0,0 +1,121 @@
import time
from typing import Dict, List, NamedTuple
import meshtastic
import meshtastic.serial_interface
import pytest
from dotmap import DotMap
from pubsub import pub # type: ignore[import-untyped]
from setup import setup_device, setup_users_prefs # type: ignore[import-untyped]
class ConnectedDevice(NamedTuple):
port: str
pio_env: str
arch: str
interface: meshtastic.serial_interface.SerialInterface
mesh_packets: List[meshtastic.mesh_pb2.FromRadio]
devices: Dict[str, ConnectedDevice] = {}
heltec_v3 = ["/dev/cu.usbserial-0001", "heltec-v3", "esp32"]
rak4631 = ["/dev/cu.usbmodem14101", "rak4631", "nrf52"]
tbeam = ["/dev/", "rak4631", "nrf52"]
setup_users_prefs("userPrefs.h")
for port_device in [heltec_v3, rak4631]:
print("Setting up device", port_device[1], "on port", port_device[0])
setup_device(port=port_device[0], pio_env=port_device[1], arch=port_device[2])
@pytest.fixture(scope="module", params=[rak4631, heltec_v3])
def device(request):
port = request.param[0]
pio_env = request.param[1]
arch = request.param[2]
if devices.get(port) is not None and devices[port].interface.isConnected:
yield devices[port]
else:
time.sleep(1)
devices[port] = ConnectedDevice(
port=port,
pio_env=pio_env,
arch=arch,
interface=meshtastic.serial_interface.SerialInterface(port),
mesh_packets=[],
)
yield devices[port]
# Tear down devices
devices[port].interface.close()
def default_on_receive(packet, interface):
print("Received packet", packet["decoded"], "interface", interface)
# find the device that sent the packet
for port in devices:
if devices[port].interface == interface:
devices[port].mesh_packets.append(packet)
# Test want_config responses from device
def test_should_get_and_set_config(device: ConnectedDevice):
assert device is not None, "Expected connected device"
assert (
len(device.interface.nodes) > 0
), "Expected at least one node in the device NodeDB"
assert (
device.interface.localNode.localConfig is not None
), "Expected LocalConfig to be set"
assert (
device.interface.localNode.moduleConfig is not None
), "Expected ModuleConfig to be set"
assert (
len(device.interface.localNode.channels) > 0
), "Expected at least one channel in the device"
pub.subscribe(default_on_receive, "meshtastic.receive")
device.interface.waitForAckNak
def test_should_send_text_message_and_receive_ack(device: ConnectedDevice):
# Send a text message
print("Sending text from device", device.pio_env)
device.interface.sendText(text="Test broadcast", wantAck=True)
# time.sleep(1)
# device.interface.waitForAckNak()
print("Received ack from device")
time.sleep(2)
# for port in devices:
# if devices[port].port != device.port:
# print("Checking device", devices[port].pio_env, "for received message")
# print(devices[port].mesh_packets)
# # Assert should have received a message
# # find text message in packets
# textPackets = list(
# filter(
# lambda packet: packet["decoded"]["portnum"]
# == meshtastic.portnums_pb2.TEXT_MESSAGE_APP
# and packet["decoded"]["payload"].decode("utf-8")
# == "Test broadcast",
# devices[port].mesh_packets,
# )
# )
# assert (
# len(textPackets) > 0
# ), "Expected a text message received on other device"
# # Assert should have received an ack
# ackPackets = list(
# filter(
# lambda packet: packet["decoded"]["portnum"]
# == meshtastic.portnums_pb2.ROUTING_APP,
# device.mesh_packets,
# )
# )
# assert len(ackPackets) > 0, "Expected an ack from the device"
if __name__ == "__main__":
pytest.main()

View File

@@ -110,8 +110,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define PIN_EINK_BUSY (0 + 19) // EPD_BUSY
#define PIN_EINK_DC (0 + 24) // EPD_D/C
#define PIN_EINK_RES (0 + 23) // EPD_RESET
#define PIN_EINK_SCLK (0 + 9) // EPD_SCLK
#define PIN_EINK_MOSI (0 + 10) // EPD_MOSI
#define PIN_EINK_SCLK PIN_SPI1_SCK
#define PIN_EINK_MOSI PIN_SPI1_MOSI
// supported modules list
#define USE_LR1110

View File

@@ -11,7 +11,7 @@ board_upload.require_upload_port = yes
;upload_port = /dev/ttyACM0
build_flags = ${esp32_base.build_flags}
build_flags = ${esp32s3_base.build_flags}
-DESP32_S3_PICO
;-DPRIVATE_HW
-Ivariants/esp32-s3-pico

View File

@@ -0,0 +1,14 @@
[env:radiomaster_900_bandit]
extends = esp32_base
board = esp32doit-devkit-v1
build_flags =
${esp32_base.build_flags}
-DRADIOMASTER_900_BANDIT
-DVTABLES_IN_FLASH=1
-DCONFIG_DISABLE_HAL_LOCKS=1
-O2
-Ivariants/radiomaster_900_bandit
board_build.f_cpu = 240000000L
upload_protocol = esptool
lib_deps =
${esp32_base.lib_deps}

View File

@@ -0,0 +1,121 @@
/*
Initial settings and work by https://github.com/gjelsoe
Unit provided by Radio Master RC
https://radiomasterrc.com/products/bandit-expresslrs-rf-module with 1.29" OLED display CH1115 driver
*/
/*
On this model then screen is NOT upside down, don't flip it for the user.
*/
#undef DISPLAY_FLIP_SCREEN
/*
I2C SDA and SCL.
0x18 - STK8XXX Accelerometer, Not supported yet.
0x3C - SH1115 Display Driver
*/
#define I2C_SDA 14
#define I2C_SCL 12
/*
No GPS - but free pins are available.
*/
#define HAS_GPS 0
#undef GPS_RX_PIN
#undef GPS_TX_PIN
/*
Pin connections from ESP32-D0WDQ6 to SX1276.
*/
#define LORA_DIO0 22
#define LORA_DIO1 21
#define LORA_SCK 18
#define LORA_MISO 19
#define LORA_MOSI 23
#define LORA_CS 4
#define LORA_RESET 5
#define LORA_TXEN 33
/*
This unit has a FAN built-in.
FAN is active at 250mW on it's ExpressLRS Firmware.
This FAN has TACHO signal on Pin 27 for use with PWM.
*/
#define RF95_FAN_EN 2
/*
LED PIN setup and it has a NeoPixel LED.
It's possible to setup colors for Button 1 and 2,
look at BUTTON1_COLOR, BUTTON1_COLOR_INDEX, BUTTON2_COLOR and BUTTON2_COLOR_INDEX
this is done here for now.
*/
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 6 // How many neopixels are connected
#define NEOPIXEL_DATA 15 // GPIO pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // Type of neopixels in use
#define ENABLE_AMBIENTLIGHTING // Turn on Ambient Lighting
// #define BUTTON1_COLOR 0xFF0000 // Background light for Button 1 in HEX RGB Color (RadioMaster Bandit only).
// #define BUTTON1_COLOR_INDEX 0 // NeoPixel Index ID for Button 1
// #define BUTTON2_COLOR 0x0000FF // Background light for Button 2 in HEX RGB Color (RadioMaster Bandit only).
// #define BUTTON2_COLOR_INDEX 1 // NeoPixel Index ID for Button 2
/*
It has 1 x five-way and 2 x normal buttons.
Button GPIO RGB Index
---------------------------
Five-way 39 -
Button 1 34 0
Button 2 35 1
Five way button when using ADC.
2.632V, 2.177V, 1.598V, 1.055V, 0V
ADC Values:
{ UP, DOWN, LEFT, RIGHT, ENTER, IDLE }
3227, 0 ,1961, 2668, 1290, 4095
Five way button when using ADC.
https://github.com/ExpressLRS/targets/blob/f3215b5ec891108db1a13523e4163950cfcadaac/TX/Radiomaster%20Bandit.json#L41
*/
#define INPUTBROKER_EXPRESSLRSFIVEWAY_TYPE
#define PIN_JOYSTICK 39
#define JOYSTICK_ADC_VALS /*UP*/ 3227, /*DOWN*/ 0, /*LEFT*/ 1961, /*RIGHT*/ 2668, /*OK*/ 1290, /*IDLE*/ 4095
/*
Normal Button Pin setup.
*/
#define BUTTON_PIN 34
#define BUTTON_NEED_PULLUP
/*
No External notification.
*/
#undef EXT_NOTIFY_OUT
/*
Remapping PIN Names.
Note, that this unit uses RFO
*/
#define USE_RF95
#define USE_RF95_RFO
#define RF95_CS LORA_CS
#define RF95_DIO1 LORA_DIO1
#define RF95_TXEN LORA_TXEN
#define RF95_RESET LORA_RESET
#define RF95_MAX_POWER 10
/*
This module has Skyworks SKY66122 controlled by dacWrite
power ranging from 100mW to 1000mW.
Mapping of PA_LEVEL to Power output: GPIO26/dacWrite
168 -> 100mW
155 -> 250mW
142 -> 500mW
110 -> 1000mW
*/
#define RF95_PA_EN 26
#define RF95_PA_DAC_EN
#define RF95_PA_LEVEL 110

View File

@@ -15,4 +15,7 @@ Do not expect a working Meshtastic device with this target.
#define USE_STM32WLx
#define MAX_NUM_NODES 10
#define LED_PIN PB5
#define LED_STATE_ON 1
#endif