Merge branch 'master' into sx126x-rx-boosted-gain
This commit is contained in:
@@ -41,6 +41,9 @@ jobs:
|
|||||||
id: base
|
id: base
|
||||||
uses: ./.github/actions/setup-base
|
uses: ./.github/actions/setup-base
|
||||||
|
|
||||||
|
- name: Trunk Check
|
||||||
|
uses: trunk-io/trunk-action@v1
|
||||||
|
|
||||||
- name: Check ${{ matrix.board }}
|
- name: Check ${{ matrix.board }}
|
||||||
run: bin/check-all.sh ${{ matrix.board }}
|
run: bin/check-all.sh ${{ matrix.board }}
|
||||||
|
|
||||||
@@ -109,14 +112,14 @@ jobs:
|
|||||||
uses: ./.github/actions/setup-base
|
uses: ./.github/actions/setup-base
|
||||||
|
|
||||||
# We now run integration test before other build steps (to quickly see runtime failures)
|
# We now run integration test before other build steps (to quickly see runtime failures)
|
||||||
- name: Build for native
|
#- name: Build for native
|
||||||
run: platformio run -e native
|
# run: platformio run -e native
|
||||||
- name: Integration test
|
#- name: Integration test
|
||||||
run: |
|
# run: |
|
||||||
.pio/build/native/program &
|
#.pio/build/native/program
|
||||||
sleep 20 # 5 seconds was not enough
|
#& sleep 20 # 5 seconds was not enough
|
||||||
echo "Simulator started, launching python test..."
|
#echo "Simulator started, launching python test..."
|
||||||
python3 -c 'from meshtastic.test import testSimulator; testSimulator()'
|
#python3 -c 'from meshtastic.test import testSimulator; testSimulator()'
|
||||||
|
|
||||||
- name: Build Native
|
- name: Build Native
|
||||||
run: bin/build-native.sh
|
run: bin/build-native.sh
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
name: Nightly
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: 0 8 * * 1-5
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trunk_check:
|
||||||
|
name: Trunk Check Upload
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Trunk Check
|
||||||
|
uses: trunk-io/trunk-action@v1
|
||||||
|
with:
|
||||||
|
trunk-token: ${{ secrets.TRUNK_TOKEN }}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
*out
|
||||||
|
*logs
|
||||||
|
*actions
|
||||||
|
*notifications
|
||||||
|
plugins
|
||||||
|
user_trunk.yaml
|
||||||
|
user.yaml
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Following source doesn't work in most setups
|
||||||
|
ignored:
|
||||||
|
- SC1090
|
||||||
|
- SC1091
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Autoformatter friendly markdownlint config (all formatting rules disabled)
|
||||||
|
default: true
|
||||||
|
blank_lines: false
|
||||||
|
bullet: false
|
||||||
|
html: false
|
||||||
|
indentation: false
|
||||||
|
line_length: false
|
||||||
|
spaces: false
|
||||||
|
url: false
|
||||||
|
whitespace: false
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
enable=all
|
||||||
|
source-path=SCRIPTDIR
|
||||||
|
disable=SC2154
|
||||||
|
|
||||||
|
# If you're having issues with shellcheck following source, disable the errors via:
|
||||||
|
# disable=SC1090
|
||||||
|
# disable=SC1091
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
{
|
||||||
|
name: "preset-default",
|
||||||
|
params: {
|
||||||
|
overrides: {
|
||||||
|
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
|
||||||
|
sortAttrs: true,
|
||||||
|
removeOffCanvasPaths: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
version: 0.1
|
||||||
|
cli:
|
||||||
|
version: 1.3.1
|
||||||
|
plugins:
|
||||||
|
sources:
|
||||||
|
- id: trunk
|
||||||
|
ref: v0.0.8
|
||||||
|
uri: https://github.com/trunk-io/plugins
|
||||||
|
lint:
|
||||||
|
enabled:
|
||||||
|
- shellcheck@0.9.0
|
||||||
|
- shfmt@3.5.0
|
||||||
|
- oxipng@8.0.0
|
||||||
|
- actionlint@1.6.22
|
||||||
|
- git-diff-check
|
||||||
|
- gitleaks@8.15.2
|
||||||
|
- markdownlint@0.33.0
|
||||||
|
- hadolint@2.12.0
|
||||||
|
- clang-format@14.0.0
|
||||||
|
- prettier@2.8.3
|
||||||
|
- svgo@3.0.2
|
||||||
|
runtimes:
|
||||||
|
enabled:
|
||||||
|
- go@1.18.3
|
||||||
|
- node@18.12.1
|
||||||
|
actions:
|
||||||
|
disabled:
|
||||||
|
- trunk-announce
|
||||||
|
- trunk-check-pre-push
|
||||||
|
- trunk-fmt-pre-commit
|
||||||
|
enabled:
|
||||||
|
- trunk-upgrade-available
|
||||||
Vendored
+2
-4
@@ -2,10 +2,8 @@
|
|||||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||||
// for the documentation about the extensions.json format
|
// for the documentation about the extensions.json format
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
|
"ms-vscode.cpptools",
|
||||||
"platformio.platformio-ide",
|
"platformio.platformio-ide",
|
||||||
"xaver.clang-format"
|
"trunk.io"
|
||||||
],
|
],
|
||||||
"unwantedRecommendations": [
|
|
||||||
"ms-vscode.cpptools-extension-pack"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-78
@@ -1,80 +1,4 @@
|
|||||||
{
|
{
|
||||||
"files.associations": {
|
"editor.formatOnSave": true,
|
||||||
"type_traits": "cpp",
|
"editor.defaultFormatter": "trunk.io"
|
||||||
"array": "cpp",
|
|
||||||
"*.tcc": "cpp",
|
|
||||||
"cctype": "cpp",
|
|
||||||
"clocale": "cpp",
|
|
||||||
"cmath": "cpp",
|
|
||||||
"cstdarg": "cpp",
|
|
||||||
"cstddef": "cpp",
|
|
||||||
"cstdint": "cpp",
|
|
||||||
"cstdio": "cpp",
|
|
||||||
"cstdlib": "cpp",
|
|
||||||
"cstring": "cpp",
|
|
||||||
"ctime": "cpp",
|
|
||||||
"cwchar": "cpp",
|
|
||||||
"cwctype": "cpp",
|
|
||||||
"deque": "cpp",
|
|
||||||
"unordered_map": "cpp",
|
|
||||||
"unordered_set": "cpp",
|
|
||||||
"vector": "cpp",
|
|
||||||
"exception": "cpp",
|
|
||||||
"algorithm": "cpp",
|
|
||||||
"functional": "cpp",
|
|
||||||
"system_error": "cpp",
|
|
||||||
"tuple": "cpp",
|
|
||||||
"fstream": "cpp",
|
|
||||||
"initializer_list": "cpp",
|
|
||||||
"iomanip": "cpp",
|
|
||||||
"iosfwd": "cpp",
|
|
||||||
"istream": "cpp",
|
|
||||||
"limits": "cpp",
|
|
||||||
"memory": "cpp",
|
|
||||||
"new": "cpp",
|
|
||||||
"ostream": "cpp",
|
|
||||||
"numeric": "cpp",
|
|
||||||
"sstream": "cpp",
|
|
||||||
"stdexcept": "cpp",
|
|
||||||
"streambuf": "cpp",
|
|
||||||
"cinttypes": "cpp",
|
|
||||||
"utility": "cpp",
|
|
||||||
"typeinfo": "cpp",
|
|
||||||
"string": "cpp",
|
|
||||||
"*.xbm": "cpp",
|
|
||||||
"list": "cpp",
|
|
||||||
"atomic": "cpp",
|
|
||||||
"memory_resource": "cpp",
|
|
||||||
"optional": "cpp",
|
|
||||||
"string_view": "cpp",
|
|
||||||
"cassert": "cpp",
|
|
||||||
"iterator": "cpp",
|
|
||||||
"shared_mutex": "cpp",
|
|
||||||
"iostream": "cpp",
|
|
||||||
"esp_nimble_hci.h": "c",
|
|
||||||
"map": "cpp",
|
|
||||||
"random": "cpp",
|
|
||||||
"*.tpp": "cpp"
|
|
||||||
},
|
|
||||||
"cSpell.words": [
|
|
||||||
"Blox",
|
|
||||||
"EINK",
|
|
||||||
"HFSR",
|
|
||||||
"Meshtastic",
|
|
||||||
"NEMAGPS",
|
|
||||||
"NMEAGPS",
|
|
||||||
"RDEF",
|
|
||||||
"Ublox",
|
|
||||||
"bkpt",
|
|
||||||
"cfsr",
|
|
||||||
"descs",
|
|
||||||
"ocrypto",
|
|
||||||
"protobufs",
|
|
||||||
"wifi"
|
|
||||||
],
|
|
||||||
"C_Cpp.dimInactiveRegions": true,
|
|
||||||
"cmake.configureOnOpen": true,
|
|
||||||
"protoc": {
|
|
||||||
"compile_on_save": false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
cd protobufs && ..\nanopb-0.4.7\generator-bin\protoc.exe --nanopb_out=-v:..\src\mesh\generated -I=..\protobufs *.proto
|
cd protobufs && ..\nanopb-0.4.7\generator-bin\protoc.exe --nanopb_out=-v:..\src\mesh\generated\meshtastic -I=..\protobufs meshtastic\*.proto
|
||||||
|
|||||||
+6
-1
@@ -8,7 +8,12 @@ echo "prebuilt binaries for your computer into nanopb-0.4.7"
|
|||||||
|
|
||||||
# the nanopb tool seems to require that the .options file be in the current directory!
|
# the nanopb tool seems to require that the .options file be in the current directory!
|
||||||
cd protobufs
|
cd protobufs
|
||||||
../nanopb-0.4.7/generator-bin/protoc --nanopb_out=-v:../src/mesh/generated -I=../protobufs *.proto
|
../nanopb-0.4.7/generator-bin/protoc --nanopb_out=-v:../src/mesh/generated/ -I=../protobufs meshtastic/*.proto
|
||||||
|
|
||||||
|
cd ../src/mesh/generated/meshtastic
|
||||||
|
sed -i 's/#include "meshtastic/#include "./g' *
|
||||||
|
|
||||||
|
sed -i 's/meshtastic_//g' *
|
||||||
|
|
||||||
#echo "Regenerating protobuf documentation - if you see an error message"
|
#echo "Regenerating protobuf documentation - if you see an error message"
|
||||||
#echo "you can ignore it unless doing a new protobuf release to github."
|
#echo "you can ignore it unless doing a new protobuf release to github."
|
||||||
|
|||||||
+1
-1
Submodule protobufs updated: 1763fe4a38...aaa6e08b2e
@@ -1,7 +1,7 @@
|
|||||||
#include "../configuration.h"
|
#include "../configuration.h"
|
||||||
#include "../main.h"
|
#include "../main.h"
|
||||||
|
#include "mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include "mesh/generated/telemetry.pb.h"
|
|
||||||
|
|
||||||
// AXP192 and AXP2101 have the same device address, we just need to identify it in Power.cpp
|
// AXP192 and AXP2101 have the same device address, we just need to identify it in Power.cpp
|
||||||
#ifndef XPOWERS_AXP192_AXP2101_ADDRESS
|
#ifndef XPOWERS_AXP192_AXP2101_ADDRESS
|
||||||
@@ -44,7 +44,8 @@ void printATECCInfo()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getRegisterValue(uint8_t address, uint8_t reg, uint8_t length) {
|
uint16_t getRegisterValue(uint8_t address, uint8_t reg, uint8_t length)
|
||||||
|
{
|
||||||
uint16_t value = 0x00;
|
uint16_t value = 0x00;
|
||||||
Wire.beginTransmission(address);
|
Wire.beginTransmission(address);
|
||||||
Wire.write(reg);
|
Wire.write(reg);
|
||||||
|
|||||||
+3
-2
@@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#include "mesh/generated/mesh.pb.h" // For CriticalErrorCode
|
#include "mesh/generated/meshtastic/mesh.pb.h" // For CriticalErrorCode
|
||||||
|
|
||||||
/// A macro that include filename and line
|
/// A macro that include filename and line
|
||||||
#define RECORD_CRITICALERROR(code) recordCriticalError(code, __LINE__, __FILE__)
|
#define RECORD_CRITICALERROR(code) recordCriticalError(code, __LINE__, __FILE__)
|
||||||
|
|
||||||
/// Record an error that should be reported via analytics
|
/// Record an error that should be reported via analytics
|
||||||
void recordCriticalError(CriticalErrorCode code = CriticalErrorCode_UNSPECIFIED, uint32_t address = 0, const char *filename = NULL);
|
void recordCriticalError(CriticalErrorCode code = CriticalErrorCode_UNSPECIFIED, uint32_t address = 0,
|
||||||
|
const char *filename = NULL);
|
||||||
|
|||||||
+37
-29
@@ -33,9 +33,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
#include "mesh/Channels.h"
|
#include "mesh/Channels.h"
|
||||||
#include "mesh/generated/deviceonly.pb.h"
|
#include "mesh/generated/meshtastic/deviceonly.pb.h"
|
||||||
#include "modules/TextMessageModule.h"
|
|
||||||
#include "modules/ExternalNotificationModule.h"
|
#include "modules/ExternalNotificationModule.h"
|
||||||
|
#include "modules/TextMessageModule.h"
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#include "target_specific.h"
|
#include "target_specific.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@@ -118,7 +118,6 @@ static uint16_t displayWidth, displayHeight;
|
|||||||
|
|
||||||
#define getStringCenteredX(s) ((SCREEN_WIDTH - display->getStringWidth(s)) / 2)
|
#define getStringCenteredX(s) ((SCREEN_WIDTH - display->getStringWidth(s)) / 2)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw the icon with extra info printed around the corners
|
* Draw the icon with extra info printed around the corners
|
||||||
*/
|
*/
|
||||||
@@ -332,7 +331,8 @@ static void drawFrameFirmware(OLEDDisplay *display, OLEDDisplayUiState *state, i
|
|||||||
|
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
display->drawStringMaxWidth(0 + x, 2 + y + FONT_HEIGHT_SMALL *2, x + display->getWidth(), "Please be patient and do not power off.");
|
display->drawStringMaxWidth(0 + x, 2 + y + FONT_HEIGHT_SMALL * 2, x + display->getWidth(),
|
||||||
|
"Please be patient and do not power off.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw the last text message we received
|
/// Draw the last text message we received
|
||||||
@@ -354,8 +354,7 @@ static void drawCriticalFaultFrame(OLEDDisplay *display, OLEDDisplayUiState *sta
|
|||||||
// Ignore messages orginating from phone (from the current node 0x0) unless range test or store and forward module are enabled
|
// Ignore messages orginating from phone (from the current node 0x0) unless range test or store and forward module are enabled
|
||||||
static bool shouldDrawMessage(const MeshPacket *packet)
|
static bool shouldDrawMessage(const MeshPacket *packet)
|
||||||
{
|
{
|
||||||
return packet->from != 0 && !moduleConfig.range_test.enabled &&
|
return packet->from != 0 && !moduleConfig.range_test.enabled && !moduleConfig.store_forward.enabled;
|
||||||
!moduleConfig.store_forward.enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw the last text message we received
|
/// Draw the last text message we received
|
||||||
@@ -582,22 +581,23 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const
|
|||||||
if (gpsFormat != Config_DisplayConfig_GpsCoordinateFormat_DMS) {
|
if (gpsFormat != Config_DisplayConfig_GpsCoordinateFormat_DMS) {
|
||||||
char coordinateLine[22];
|
char coordinateLine[22];
|
||||||
if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_DEC) { // Decimal Degrees
|
if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_DEC) { // Decimal Degrees
|
||||||
snprintf(coordinateLine, sizeof(coordinateLine), "%f %f", geoCoord.getLatitude() * 1e-7, geoCoord.getLongitude() * 1e-7);
|
snprintf(coordinateLine, sizeof(coordinateLine), "%f %f", geoCoord.getLatitude() * 1e-7,
|
||||||
|
geoCoord.getLongitude() * 1e-7);
|
||||||
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_UTM) { // Universal Transverse Mercator
|
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_UTM) { // Universal Transverse Mercator
|
||||||
snprintf(coordinateLine, sizeof(coordinateLine), "%2i%1c %06u %07u", geoCoord.getUTMZone(), geoCoord.getUTMBand(),
|
snprintf(coordinateLine, sizeof(coordinateLine), "%2i%1c %06u %07u", geoCoord.getUTMZone(), geoCoord.getUTMBand(),
|
||||||
geoCoord.getUTMEasting(), geoCoord.getUTMNorthing());
|
geoCoord.getUTMEasting(), geoCoord.getUTMNorthing());
|
||||||
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_MGRS) { // Military Grid Reference System
|
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_MGRS) { // Military Grid Reference System
|
||||||
snprintf(coordinateLine, sizeof(coordinateLine), "%2i%1c %1c%1c %05u %05u", geoCoord.getMGRSZone(), geoCoord.getMGRSBand(),
|
snprintf(coordinateLine, sizeof(coordinateLine), "%2i%1c %1c%1c %05u %05u", geoCoord.getMGRSZone(),
|
||||||
geoCoord.getMGRSEast100k(), geoCoord.getMGRSNorth100k(), geoCoord.getMGRSEasting(),
|
geoCoord.getMGRSBand(), geoCoord.getMGRSEast100k(), geoCoord.getMGRSNorth100k(),
|
||||||
geoCoord.getMGRSNorthing());
|
geoCoord.getMGRSEasting(), geoCoord.getMGRSNorthing());
|
||||||
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OLC) { // Open Location Code
|
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OLC) { // Open Location Code
|
||||||
geoCoord.getOLCCode(coordinateLine);
|
geoCoord.getOLCCode(coordinateLine);
|
||||||
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OSGR) { // Ordnance Survey Grid Reference
|
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OSGR) { // Ordnance Survey Grid Reference
|
||||||
if (geoCoord.getOSGRE100k() == 'I' || geoCoord.getOSGRN100k() == 'I') // OSGR is only valid around the UK region
|
if (geoCoord.getOSGRE100k() == 'I' || geoCoord.getOSGRN100k() == 'I') // OSGR is only valid around the UK region
|
||||||
snprintf(coordinateLine, sizeof(coordinateLine), "%s", "Out of Boundary");
|
snprintf(coordinateLine, sizeof(coordinateLine), "%s", "Out of Boundary");
|
||||||
else
|
else
|
||||||
snprintf(coordinateLine, sizeof(coordinateLine), "%1c%1c %05u %05u", geoCoord.getOSGRE100k(), geoCoord.getOSGRN100k(),
|
snprintf(coordinateLine, sizeof(coordinateLine), "%1c%1c %05u %05u", geoCoord.getOSGRE100k(),
|
||||||
geoCoord.getOSGREasting(), geoCoord.getOSGRNorthing());
|
geoCoord.getOSGRN100k(), geoCoord.getOSGREasting(), geoCoord.getOSGRNorthing());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If fixed position, display text "Fixed GPS" alternating with the coordinates.
|
// If fixed position, display text "Fixed GPS" alternating with the coordinates.
|
||||||
@@ -614,10 +614,10 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const
|
|||||||
} else {
|
} else {
|
||||||
char latLine[22];
|
char latLine[22];
|
||||||
char lonLine[22];
|
char lonLine[22];
|
||||||
snprintf(latLine, sizeof(latLine), "%2i° %2i' %2u\" %1c", geoCoord.getDMSLatDeg(), geoCoord.getDMSLatMin(), geoCoord.getDMSLatSec(),
|
snprintf(latLine, sizeof(latLine), "%2i° %2i' %2u\" %1c", geoCoord.getDMSLatDeg(), geoCoord.getDMSLatMin(),
|
||||||
geoCoord.getDMSLatCP());
|
geoCoord.getDMSLatSec(), geoCoord.getDMSLatCP());
|
||||||
snprintf(lonLine, sizeof(lonLine), "%3i° %2i' %2u\" %1c", geoCoord.getDMSLonDeg(), geoCoord.getDMSLonMin(), geoCoord.getDMSLonSec(),
|
snprintf(lonLine, sizeof(lonLine), "%3i° %2i' %2u\" %1c", geoCoord.getDMSLonDeg(), geoCoord.getDMSLonMin(),
|
||||||
geoCoord.getDMSLonCP());
|
geoCoord.getDMSLonSec(), geoCoord.getDMSLonCP());
|
||||||
display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(latLine))) / 2, y - FONT_HEIGHT_SMALL * 1, latLine);
|
display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(latLine))) / 2, y - FONT_HEIGHT_SMALL * 1, latLine);
|
||||||
display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(lonLine))) / 2, y, lonLine);
|
display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(lonLine))) / 2, y, lonLine);
|
||||||
}
|
}
|
||||||
@@ -1000,8 +1000,8 @@ void Screen::setup()
|
|||||||
#ifdef SCREEN_MIRROR
|
#ifdef SCREEN_MIRROR
|
||||||
dispdev.mirrorScreen();
|
dispdev.mirrorScreen();
|
||||||
#else
|
#else
|
||||||
// Standard behaviour is to FLIP the screen (needed on T-Beam). If this config item is set, unflip it, and thereby logically flip it.
|
// Standard behaviour is to FLIP the screen (needed on T-Beam). If this config item is set, unflip it, and thereby logically
|
||||||
// If you have a headache now, you're welcome.
|
// flip it. If you have a headache now, you're welcome.
|
||||||
if (!config.display.flip_screen) {
|
if (!config.display.flip_screen) {
|
||||||
dispdev.flipScreenVertically();
|
dispdev.flipScreenVertically();
|
||||||
}
|
}
|
||||||
@@ -1452,26 +1452,35 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
// Draw our hardware ID to assist with bluetooth pairing. Either prefix with Info or S&F Logo
|
// Draw our hardware ID to assist with bluetooth pairing. Either prefix with Info or S&F Logo
|
||||||
if (moduleConfig.store_forward.enabled) {
|
if (moduleConfig.store_forward.enabled) {
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
if (millis() - storeForwardModule->lastHeartbeat > (storeForwardModule->heartbeatInterval * 1200)) { //no heartbeat, overlap a bit
|
if (millis() - storeForwardModule->lastHeartbeat >
|
||||||
|
(storeForwardModule->heartbeatInterval * 1200)) { // no heartbeat, overlap a bit
|
||||||
#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS)
|
#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS)
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8, imgQuestionL1);
|
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8,
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 12, 8, imgQuestionL2);
|
imgQuestionL1);
|
||||||
|
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 12, 8,
|
||||||
|
imgQuestionL2);
|
||||||
#else
|
#else
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 10 - display->getStringWidth(ourId), y + 2 + FONT_HEIGHT_SMALL, 8, 8, imgQuestion);
|
display->drawFastImage(x + SCREEN_WIDTH - 10 - display->getStringWidth(ourId), y + 2 + FONT_HEIGHT_SMALL, 8, 8,
|
||||||
|
imgQuestion);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS)
|
#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS)
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 16, 8, imgSFL1);
|
display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 16, 8,
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 16, 8, imgSFL2);
|
imgSFL1);
|
||||||
|
display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 16, 8,
|
||||||
|
imgSFL2);
|
||||||
#else
|
#else
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 13 - display->getStringWidth(ourId), y + 2 + FONT_HEIGHT_SMALL, 11, 8, imgSF);
|
display->drawFastImage(x + SCREEN_WIDTH - 13 - display->getStringWidth(ourId), y + 2 + FONT_HEIGHT_SMALL, 11, 8,
|
||||||
|
imgSF);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS)
|
#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS)
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8, imgInfoL1);
|
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8,
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 12, 8, imgInfoL2);
|
imgInfoL1);
|
||||||
|
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 12, 8,
|
||||||
|
imgInfoL2);
|
||||||
#else
|
#else
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 10 - display->getStringWidth(ourId), y + 2 + FONT_HEIGHT_SMALL, 8, 8, imgInfo);
|
display->drawFastImage(x + SCREEN_WIDTH - 10 - display->getStringWidth(ourId), y + 2 + FONT_HEIGHT_SMALL, 8, 8, imgInfo);
|
||||||
#endif
|
#endif
|
||||||
@@ -1742,8 +1751,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|||||||
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil), y + FONT_HEIGHT_SMALL * 1, chUtil);
|
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil), y + FONT_HEIGHT_SMALL * 1, chUtil);
|
||||||
if (config.position.gps_enabled) {
|
if (config.position.gps_enabled) {
|
||||||
// Line 3
|
// Line 3
|
||||||
if (config.display.gps_format !=
|
if (config.display.gps_format != Config_DisplayConfig_GpsCoordinateFormat_DMS) // if DMS then don't draw altitude
|
||||||
Config_DisplayConfig_GpsCoordinateFormat_DMS) // if DMS then don't draw altitude
|
|
||||||
drawGPSAltitude(display, x, y + FONT_HEIGHT_SMALL * 2, gpsStatus);
|
drawGPSAltitude(display, x, y + FONT_HEIGHT_SMALL * 2, gpsStatus);
|
||||||
|
|
||||||
// Line 4
|
// Line 4
|
||||||
|
|||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include "GPSStatus.h"
|
#include "GPSStatus.h"
|
||||||
#include "NodeStatus.h"
|
#include "NodeStatus.h"
|
||||||
#include "PowerStatus.h"
|
#include "PowerStatus.h"
|
||||||
#include "graphics/Screen.h"
|
#include "graphics/Screen.h"
|
||||||
#include "mesh/generated/telemetry.pb.h"
|
#include "mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include <map>
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||||
#include <SparkFun_ATECCX08a_Arduino_Library.h>
|
#include <SparkFun_ATECCX08a_Arduino_Library.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+19
-1
@@ -6,6 +6,7 @@
|
|||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "RadioInterface.h"
|
#include "RadioInterface.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#include "xmodem.h"
|
||||||
|
|
||||||
#if FromRadio_size > MAX_TO_FROM_RADIO_SIZE
|
#if FromRadio_size > MAX_TO_FROM_RADIO_SIZE
|
||||||
#error FromRadio is too big
|
#error FromRadio is too big
|
||||||
@@ -31,6 +32,7 @@ void PhoneAPI::handleStartConfig()
|
|||||||
if (!isConnected()) {
|
if (!isConnected()) {
|
||||||
onConnectionChanged(true);
|
onConnectionChanged(true);
|
||||||
observe(&service.fromNumChanged);
|
observe(&service.fromNumChanged);
|
||||||
|
observe(&xModem.packetReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
// even if we were already connected - restart our state machine
|
// even if we were already connected - restart our state machine
|
||||||
@@ -48,6 +50,7 @@ void PhoneAPI::close()
|
|||||||
state = STATE_SEND_NOTHING;
|
state = STATE_SEND_NOTHING;
|
||||||
|
|
||||||
unobserve(&service.fromNumChanged);
|
unobserve(&service.fromNumChanged);
|
||||||
|
unobserve(&xModem.packetReady);
|
||||||
releasePhonePacket(); // Don't leak phone packets on shutdown
|
releasePhonePacket(); // Don't leak phone packets on shutdown
|
||||||
releaseQueueStatusPhonePacket();
|
releaseQueueStatusPhonePacket();
|
||||||
|
|
||||||
@@ -90,6 +93,10 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
|||||||
LOG_INFO("Disconnecting from phone\n");
|
LOG_INFO("Disconnecting from phone\n");
|
||||||
close();
|
close();
|
||||||
break;
|
break;
|
||||||
|
case ToRadio_xmodemPacket_tag:
|
||||||
|
LOG_INFO("Got xmodem packet\n");
|
||||||
|
xModem.handlePacket(toRadioScratch.xmodemPacket);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// Ignore nop messages
|
// Ignore nop messages
|
||||||
// LOG_DEBUG("Error: unexpected ToRadio variant\n");
|
// LOG_DEBUG("Error: unexpected ToRadio variant\n");
|
||||||
@@ -287,10 +294,14 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||||||
// Do we have a message from the mesh?
|
// Do we have a message from the mesh?
|
||||||
LOG_INFO("getFromRadio=STATE_SEND_PACKETS\n");
|
LOG_INFO("getFromRadio=STATE_SEND_PACKETS\n");
|
||||||
if (queueStatusPacketForPhone) {
|
if (queueStatusPacketForPhone) {
|
||||||
|
|
||||||
fromRadioScratch.which_payload_variant = FromRadio_queueStatus_tag;
|
fromRadioScratch.which_payload_variant = FromRadio_queueStatus_tag;
|
||||||
fromRadioScratch.queueStatus = *queueStatusPacketForPhone;
|
fromRadioScratch.queueStatus = *queueStatusPacketForPhone;
|
||||||
releaseQueueStatusPhonePacket();
|
releaseQueueStatusPhonePacket();
|
||||||
|
} else if (xmodemPacketForPhone) {
|
||||||
|
fromRadioScratch.which_payload_variant = FromRadio_xmodemPacket_tag;
|
||||||
|
fromRadioScratch.xmodemPacket = *xmodemPacketForPhone;
|
||||||
|
free(xmodemPacketForPhone);
|
||||||
|
xmodemPacketForPhone = NULL;
|
||||||
} else if (packetForPhone) {
|
} else if (packetForPhone) {
|
||||||
printPacket("phone downloaded packet", packetForPhone);
|
printPacket("phone downloaded packet", packetForPhone);
|
||||||
|
|
||||||
@@ -353,6 +364,7 @@ bool PhoneAPI::available()
|
|||||||
case STATE_SEND_MODULECONFIG:
|
case STATE_SEND_MODULECONFIG:
|
||||||
case STATE_SEND_COMPLETE_ID:
|
case STATE_SEND_COMPLETE_ID:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case STATE_SEND_NODEINFO:
|
case STATE_SEND_NODEINFO:
|
||||||
if (!nodeInfoForPhone)
|
if (!nodeInfoForPhone)
|
||||||
nodeInfoForPhone = nodeDB.readNextInfo();
|
nodeInfoForPhone = nodeDB.readNextInfo();
|
||||||
@@ -365,6 +377,12 @@ bool PhoneAPI::available()
|
|||||||
if (hasPacket)
|
if (hasPacket)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (!xmodemPacketForPhone)
|
||||||
|
xmodemPacketForPhone = xModem.getForPhone();
|
||||||
|
hasPacket = !!packetForPhone;
|
||||||
|
if (hasPacket)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!packetForPhone)
|
if (!packetForPhone)
|
||||||
packetForPhone = service.getForPhone();
|
packetForPhone = service.getForPhone();
|
||||||
hasPacket = !!packetForPhone;
|
hasPacket = !!packetForPhone;
|
||||||
|
|||||||
+5
-1
@@ -16,7 +16,8 @@
|
|||||||
* Eventually there should be once instance of this class for each live connection (because it has a bit of state
|
* Eventually there should be once instance of this class for each live connection (because it has a bit of state
|
||||||
* for that connection)
|
* for that connection)
|
||||||
*/
|
*/
|
||||||
class PhoneAPI : public Observer<uint32_t> // FIXME, we shouldn't be inheriting from Observer, instead use CallbackObserver as a member
|
class PhoneAPI
|
||||||
|
: public Observer<uint32_t> // FIXME, we shouldn't be inheriting from Observer, instead use CallbackObserver as a member
|
||||||
{
|
{
|
||||||
enum State {
|
enum State {
|
||||||
STATE_SEND_NOTHING, // Initial state, don't send anything until the client starts asking for config
|
STATE_SEND_NOTHING, // Initial state, don't send anything until the client starts asking for config
|
||||||
@@ -42,6 +43,9 @@ class PhoneAPI : public Observer<uint32_t> // FIXME, we shouldn't be inheriting
|
|||||||
/// downloads it
|
/// downloads it
|
||||||
MeshPacket *packetForPhone = NULL;
|
MeshPacket *packetForPhone = NULL;
|
||||||
|
|
||||||
|
// file transfer packets destined for phone. Push it to the queue then free it.
|
||||||
|
XModem *xmodemPacketForPhone = NULL;
|
||||||
|
|
||||||
// Keep QueueStatus packet just as packetForPhone
|
// Keep QueueStatus packet just as packetForPhone
|
||||||
QueueStatus *queueStatusPacketForPhone = NULL;
|
QueueStatus *queueStatusPacketForPhone = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
DisableFormat: true
|
||||||
|
SortIncludes: false
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "admin.pb.h"
|
#include "./admin.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_ADMIN_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED
|
||||||
#define PB_ADMIN_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "channel.pb.h"
|
#include "./channel.pb.h"
|
||||||
#include "config.pb.h"
|
#include "./config.pb.h"
|
||||||
#include "device_metadata.pb.h"
|
#include "./device_metadata.pb.h"
|
||||||
#include "mesh.pb.h"
|
#include "./mesh.pb.h"
|
||||||
#include "module_config.pb.h"
|
#include "./module_config.pb.h"
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "apponly.pb.h"
|
#include "./apponly.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_APPONLY_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED
|
||||||
#define PB_APPONLY_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "channel.pb.h"
|
#include "./channel.pb.h"
|
||||||
#include "config.pb.h"
|
#include "./config.pb.h"
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "cannedmessages.pb.h"
|
#include "./cannedmessages.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_CANNEDMESSAGES_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_CANNEDMESSAGES_PB_H_INCLUDED
|
||||||
#define PB_CANNEDMESSAGES_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_CANNEDMESSAGES_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "channel.pb.h"
|
#include "./channel.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_CHANNEL_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_INCLUDED
|
||||||
#define PB_CHANNEL_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "config.pb.h"
|
#include "./config.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_CONFIG_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_CONFIG_PB_H_INCLUDED
|
||||||
#define PB_CONFIG_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_CONFIG_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
@@ -300,6 +300,8 @@ typedef struct _Config_NetworkConfig {
|
|||||||
/* struct to keep static address */
|
/* struct to keep static address */
|
||||||
bool has_ipv4_config;
|
bool has_ipv4_config;
|
||||||
Config_NetworkConfig_IpV4Config ipv4_config;
|
Config_NetworkConfig_IpV4Config ipv4_config;
|
||||||
|
/* rsyslog Server and Port */
|
||||||
|
char rsyslog_server[33];
|
||||||
} Config_NetworkConfig;
|
} Config_NetworkConfig;
|
||||||
|
|
||||||
/* Display Config */
|
/* Display Config */
|
||||||
@@ -476,7 +478,7 @@ extern "C" {
|
|||||||
#define Config_DeviceConfig_init_default {_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0}
|
#define Config_DeviceConfig_init_default {_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0}
|
||||||
#define Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0}
|
#define Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define Config_NetworkConfig_init_default {0, "", "", "", 0, _Config_NetworkConfig_AddressMode_MIN, false, Config_NetworkConfig_IpV4Config_init_default}
|
#define Config_NetworkConfig_init_default {0, "", "", "", 0, _Config_NetworkConfig_AddressMode_MIN, false, Config_NetworkConfig_IpV4Config_init_default, ""}
|
||||||
#define Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0}
|
#define Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0}
|
||||||
#define Config_DisplayConfig_init_default {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN, _Config_DisplayConfig_OledType_MIN, _Config_DisplayConfig_DisplayMode_MIN, 0}
|
#define Config_DisplayConfig_init_default {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN, _Config_DisplayConfig_OledType_MIN, _Config_DisplayConfig_DisplayMode_MIN, 0}
|
||||||
#define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
#define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
||||||
@@ -485,7 +487,7 @@ extern "C" {
|
|||||||
#define Config_DeviceConfig_init_zero {_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0}
|
#define Config_DeviceConfig_init_zero {_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0}
|
||||||
#define Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0}
|
#define Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define Config_NetworkConfig_init_zero {0, "", "", "", 0, _Config_NetworkConfig_AddressMode_MIN, false, Config_NetworkConfig_IpV4Config_init_zero}
|
#define Config_NetworkConfig_init_zero {0, "", "", "", 0, _Config_NetworkConfig_AddressMode_MIN, false, Config_NetworkConfig_IpV4Config_init_zero, ""}
|
||||||
#define Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0}
|
#define Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0}
|
||||||
#define Config_DisplayConfig_init_zero {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN, _Config_DisplayConfig_OledType_MIN, _Config_DisplayConfig_DisplayMode_MIN, 0}
|
#define Config_DisplayConfig_init_zero {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN, _Config_DisplayConfig_OledType_MIN, _Config_DisplayConfig_DisplayMode_MIN, 0}
|
||||||
#define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
#define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
||||||
@@ -525,6 +527,7 @@ extern "C" {
|
|||||||
#define Config_NetworkConfig_eth_enabled_tag 6
|
#define Config_NetworkConfig_eth_enabled_tag 6
|
||||||
#define Config_NetworkConfig_address_mode_tag 7
|
#define Config_NetworkConfig_address_mode_tag 7
|
||||||
#define Config_NetworkConfig_ipv4_config_tag 8
|
#define Config_NetworkConfig_ipv4_config_tag 8
|
||||||
|
#define Config_NetworkConfig_rsyslog_server_tag 9
|
||||||
#define Config_DisplayConfig_screen_on_secs_tag 1
|
#define Config_DisplayConfig_screen_on_secs_tag 1
|
||||||
#define Config_DisplayConfig_gps_format_tag 2
|
#define Config_DisplayConfig_gps_format_tag 2
|
||||||
#define Config_DisplayConfig_auto_screen_carousel_secs_tag 3
|
#define Config_DisplayConfig_auto_screen_carousel_secs_tag 3
|
||||||
@@ -618,7 +621,8 @@ X(a, STATIC, SINGULAR, STRING, wifi_psk, 4) \
|
|||||||
X(a, STATIC, SINGULAR, STRING, ntp_server, 5) \
|
X(a, STATIC, SINGULAR, STRING, ntp_server, 5) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, eth_enabled, 6) \
|
X(a, STATIC, SINGULAR, BOOL, eth_enabled, 6) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, address_mode, 7) \
|
X(a, STATIC, SINGULAR, UENUM, address_mode, 7) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, ipv4_config, 8)
|
X(a, STATIC, OPTIONAL, MESSAGE, ipv4_config, 8) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, rsyslog_server, 9)
|
||||||
#define Config_NetworkConfig_CALLBACK NULL
|
#define Config_NetworkConfig_CALLBACK NULL
|
||||||
#define Config_NetworkConfig_DEFAULT NULL
|
#define Config_NetworkConfig_DEFAULT NULL
|
||||||
#define Config_NetworkConfig_ipv4_config_MSGTYPE Config_NetworkConfig_IpV4Config
|
#define Config_NetworkConfig_ipv4_config_MSGTYPE Config_NetworkConfig_IpV4Config
|
||||||
@@ -695,10 +699,10 @@ extern const pb_msgdesc_t Config_BluetoothConfig_msg;
|
|||||||
#define Config_DisplayConfig_size 26
|
#define Config_DisplayConfig_size 26
|
||||||
#define Config_LoRaConfig_size 70
|
#define Config_LoRaConfig_size 70
|
||||||
#define Config_NetworkConfig_IpV4Config_size 20
|
#define Config_NetworkConfig_IpV4Config_size 20
|
||||||
#define Config_NetworkConfig_size 161
|
#define Config_NetworkConfig_size 195
|
||||||
#define Config_PositionConfig_size 42
|
#define Config_PositionConfig_size 42
|
||||||
#define Config_PowerConfig_size 43
|
#define Config_PowerConfig_size 43
|
||||||
#define Config_size 164
|
#define Config_size 198
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "device_metadata.pb.h"
|
#include "./device_metadata.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
+15
-6
@@ -1,9 +1,10 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_DEVICE_METADATA_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_DEVICE_METADATA_PB_H_INCLUDED
|
||||||
#define PB_DEVICE_METADATA_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_DEVICE_METADATA_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
|
#include "./config.pb.h"
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
@@ -24,6 +25,10 @@ typedef struct _DeviceMetadata {
|
|||||||
bool hasBluetooth;
|
bool hasBluetooth;
|
||||||
/* Indicates that the device has an ethernet peripheral */
|
/* Indicates that the device has an ethernet peripheral */
|
||||||
bool hasEthernet;
|
bool hasEthernet;
|
||||||
|
/* Indicates that the device's role in the mesh */
|
||||||
|
Config_DeviceConfig_Role role;
|
||||||
|
/* Indicates the device's current enabled position flags */
|
||||||
|
uint32_t position_flags;
|
||||||
} DeviceMetadata;
|
} DeviceMetadata;
|
||||||
|
|
||||||
|
|
||||||
@@ -32,8 +37,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define DeviceMetadata_init_default {"", 0, 0, 0, 0, 0}
|
#define DeviceMetadata_init_default {"", 0, 0, 0, 0, 0, _Config_DeviceConfig_Role_MIN, 0}
|
||||||
#define DeviceMetadata_init_zero {"", 0, 0, 0, 0, 0}
|
#define DeviceMetadata_init_zero {"", 0, 0, 0, 0, 0, _Config_DeviceConfig_Role_MIN, 0}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define DeviceMetadata_firmware_version_tag 1
|
#define DeviceMetadata_firmware_version_tag 1
|
||||||
@@ -42,6 +47,8 @@ extern "C" {
|
|||||||
#define DeviceMetadata_hasWifi_tag 4
|
#define DeviceMetadata_hasWifi_tag 4
|
||||||
#define DeviceMetadata_hasBluetooth_tag 5
|
#define DeviceMetadata_hasBluetooth_tag 5
|
||||||
#define DeviceMetadata_hasEthernet_tag 6
|
#define DeviceMetadata_hasEthernet_tag 6
|
||||||
|
#define DeviceMetadata_role_tag 7
|
||||||
|
#define DeviceMetadata_position_flags_tag 8
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define DeviceMetadata_FIELDLIST(X, a) \
|
#define DeviceMetadata_FIELDLIST(X, a) \
|
||||||
@@ -50,7 +57,9 @@ X(a, STATIC, SINGULAR, UINT32, device_state_version, 2) \
|
|||||||
X(a, STATIC, SINGULAR, BOOL, canShutdown, 3) \
|
X(a, STATIC, SINGULAR, BOOL, canShutdown, 3) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, hasWifi, 4) \
|
X(a, STATIC, SINGULAR, BOOL, hasWifi, 4) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, hasBluetooth, 5) \
|
X(a, STATIC, SINGULAR, BOOL, hasBluetooth, 5) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, hasEthernet, 6)
|
X(a, STATIC, SINGULAR, BOOL, hasEthernet, 6) \
|
||||||
|
X(a, STATIC, SINGULAR, UENUM, role, 7) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, position_flags, 8)
|
||||||
#define DeviceMetadata_CALLBACK NULL
|
#define DeviceMetadata_CALLBACK NULL
|
||||||
#define DeviceMetadata_DEFAULT NULL
|
#define DeviceMetadata_DEFAULT NULL
|
||||||
|
|
||||||
@@ -60,7 +69,7 @@ extern const pb_msgdesc_t DeviceMetadata_msg;
|
|||||||
#define DeviceMetadata_fields &DeviceMetadata_msg
|
#define DeviceMetadata_fields &DeviceMetadata_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define DeviceMetadata_size 33
|
#define DeviceMetadata_size 41
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "deviceonly.pb.h"
|
#include "./deviceonly.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_DEVICEONLY_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_INCLUDED
|
||||||
#define PB_DEVICEONLY_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "channel.pb.h"
|
#include "./channel.pb.h"
|
||||||
#include "mesh.pb.h"
|
#include "./mesh.pb.h"
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "localonly.pb.h"
|
#include "./localonly.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_LOCALONLY_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_INCLUDED
|
||||||
#define PB_LOCALONLY_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "config.pb.h"
|
#include "./config.pb.h"
|
||||||
#include "module_config.pb.h"
|
#include "./module_config.pb.h"
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
@@ -156,7 +156,7 @@ extern const pb_msgdesc_t LocalModuleConfig_msg;
|
|||||||
#define LocalModuleConfig_fields &LocalModuleConfig_msg
|
#define LocalModuleConfig_fields &LocalModuleConfig_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define LocalConfig_size 391
|
#define LocalConfig_size 425
|
||||||
#define LocalModuleConfig_size 412
|
#define LocalModuleConfig_size 412
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "mesh.pb.h"
|
#include "./mesh.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_MESH_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_MESH_PB_H_INCLUDED
|
||||||
#define PB_MESH_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_MESH_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "channel.pb.h"
|
#include "./channel.pb.h"
|
||||||
#include "config.pb.h"
|
#include "./config.pb.h"
|
||||||
#include "module_config.pb.h"
|
#include "./module_config.pb.h"
|
||||||
#include "portnums.pb.h"
|
#include "./portnums.pb.h"
|
||||||
#include "telemetry.pb.h"
|
#include "./telemetry.pb.h"
|
||||||
#include "xmodem.pb.h"
|
#include "./xmodem.pb.h"
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "module_config.pb.h"
|
#include "./module_config.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_MODULE_CONFIG_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_MODULE_CONFIG_PB_H_INCLUDED
|
||||||
#define PB_MODULE_CONFIG_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_MODULE_CONFIG_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "mqtt.pb.h"
|
#include "./mqtt.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_MQTT_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED
|
||||||
#define PB_MQTT_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "mesh.pb.h"
|
#include "./mesh.pb.h"
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "portnums.pb.h"
|
#include "./portnums.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_PORTNUMS_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_PORTNUMS_PB_H_INCLUDED
|
||||||
#define PB_PORTNUMS_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_PORTNUMS_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "remote_hardware.pb.h"
|
#include "./remote_hardware.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_REMOTE_HARDWARE_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_REMOTE_HARDWARE_PB_H_INCLUDED
|
||||||
#define PB_REMOTE_HARDWARE_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_REMOTE_HARDWARE_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "rtttl.pb.h"
|
#include "./rtttl.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_RTTTL_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_RTTTL_PB_H_INCLUDED
|
||||||
#define PB_RTTTL_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_RTTTL_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "storeforward.pb.h"
|
#include "./storeforward.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_STOREFORWARD_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_STOREFORWARD_PB_H_INCLUDED
|
||||||
#define PB_STOREFORWARD_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_STOREFORWARD_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "telemetry.pb.h"
|
#include "./telemetry.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_TELEMETRY_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_INCLUDED
|
||||||
#define PB_TELEMETRY_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Automatically generated nanopb constant definitions */
|
/* Automatically generated nanopb constant definitions */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#include "xmodem.pb.h"
|
#include "./xmodem.pb.h"
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* Automatically generated nanopb header */
|
/* Automatically generated nanopb header */
|
||||||
/* Generated by nanopb-0.4.7 */
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
#ifndef PB_XMODEM_PB_H_INCLUDED
|
#ifndef PB_MESHTASTIC_MESHTASTIC_XMODEM_PB_H_INCLUDED
|
||||||
#define PB_XMODEM_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_XMODEM_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "mesh/generated/mesh.pb.h"
|
#include "mesh/generated/meshtastic/admin.pb.h"
|
||||||
#include "mesh/generated/localonly.pb.h"
|
#include "mesh/generated/meshtastic/deviceonly.pb.h"
|
||||||
#include "mesh/generated/deviceonly.pb.h"
|
#include "mesh/generated/meshtastic/localonly.pb.h"
|
||||||
#include "mesh/generated/admin.pb.h"
|
#include "mesh/generated/meshtastic/mesh.pb.h"
|
||||||
|
|
||||||
// this file defines constants which come from mesh.options
|
// this file defines constants which come from mesh.options
|
||||||
|
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
#define member_size(type, member) sizeof(((type *)0)->member)
|
#define member_size(type, member) sizeof(((type *)0)->member)
|
||||||
|
|
||||||
/// max number of packets which can be waiting for delivery to android - note, this value comes from mesh.options protobuf
|
/// max number of packets which can be waiting for delivery to android - note, this value comes from mesh.options protobuf
|
||||||
// FIXME - max_count is actually 32 but we save/load this as one long string of preencoded MeshPacket bytes - not a big array in RAM
|
// FIXME - max_count is actually 32 but we save/load this as one long string of preencoded MeshPacket bytes - not a big array in
|
||||||
// #define MAX_RX_TOPHONE (member_size(DeviceState, receive_queue) / member_size(DeviceState, receive_queue[0]))
|
// RAM #define MAX_RX_TOPHONE (member_size(DeviceState, receive_queue) / member_size(DeviceState, receive_queue[0]))
|
||||||
#define MAX_RX_TOPHONE 32
|
#define MAX_RX_TOPHONE 32
|
||||||
|
|
||||||
/// max number of nodes allowed in the mesh
|
/// max number of nodes allowed in the mesh
|
||||||
|
|||||||
+12
-11
@@ -141,7 +141,8 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
|||||||
nodeDB.factoryReset();
|
nodeDB.factoryReset();
|
||||||
reboot(DEFAULT_REBOOT_SECONDS);
|
reboot(DEFAULT_REBOOT_SECONDS);
|
||||||
break;
|
break;
|
||||||
} case AdminMessage_nodedb_reset_tag: {
|
}
|
||||||
|
case AdminMessage_nodedb_reset_tag: {
|
||||||
LOG_INFO("Initiating node-db reset\n");
|
LOG_INFO("Initiating node-db reset\n");
|
||||||
nodeDB.resetNodes();
|
nodeDB.resetNodes();
|
||||||
reboot(DEFAULT_REBOOT_SECONDS);
|
reboot(DEFAULT_REBOOT_SECONDS);
|
||||||
@@ -233,8 +234,7 @@ void AdminModule::handleSetConfig(const Config &c)
|
|||||||
config.has_device = true;
|
config.has_device = true;
|
||||||
config.device = c.payload_variant.device;
|
config.device = c.payload_variant.device;
|
||||||
// If we're setting router role for the first time, install its intervals
|
// If we're setting router role for the first time, install its intervals
|
||||||
if (!isRouter &&
|
if (!isRouter && c.payload_variant.device.role == Config_DeviceConfig_Role_ROUTER) {
|
||||||
c.payload_variant.device.role == Config_DeviceConfig_Role_ROUTER) {
|
|
||||||
nodeDB.initConfigIntervals();
|
nodeDB.initConfigIntervals();
|
||||||
nodeDB.initModuleConfigIntervals();
|
nodeDB.initModuleConfigIntervals();
|
||||||
}
|
}
|
||||||
@@ -265,8 +265,7 @@ void AdminModule::handleSetConfig(const Config &c)
|
|||||||
LOG_INFO("Setting config: LoRa\n");
|
LOG_INFO("Setting config: LoRa\n");
|
||||||
config.has_lora = true;
|
config.has_lora = true;
|
||||||
config.lora = c.payload_variant.lora;
|
config.lora = c.payload_variant.lora;
|
||||||
if (isRegionUnset &&
|
if (isRegionUnset && config.lora.region > Config_LoRaConfig_RegionCode_UNSET) {
|
||||||
config.lora.region > Config_LoRaConfig_RegionCode_UNSET) {
|
|
||||||
config.lora.tx_enabled = true;
|
config.lora.tx_enabled = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -381,7 +380,8 @@ void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configTy
|
|||||||
LOG_INFO("Getting config: Network\n");
|
LOG_INFO("Getting config: Network\n");
|
||||||
res.get_config_response.which_payload_variant = Config_network_tag;
|
res.get_config_response.which_payload_variant = Config_network_tag;
|
||||||
res.get_config_response.payload_variant.network = config.network;
|
res.get_config_response.payload_variant.network = config.network;
|
||||||
writeSecret(res.get_config_response.payload_variant.network.wifi_psk, sizeof(res.get_config_response.payload_variant.network.wifi_psk), config.network.wifi_psk);
|
writeSecret(res.get_config_response.payload_variant.network.wifi_psk,
|
||||||
|
sizeof(res.get_config_response.payload_variant.network.wifi_psk), config.network.wifi_psk);
|
||||||
break;
|
break;
|
||||||
case AdminMessage_ConfigType_DISPLAY_CONFIG:
|
case AdminMessage_ConfigType_DISPLAY_CONFIG:
|
||||||
LOG_INFO("Getting config: Display\n");
|
LOG_INFO("Getting config: Display\n");
|
||||||
@@ -430,8 +430,7 @@ void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t co
|
|||||||
case AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
|
case AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
|
||||||
LOG_INFO("Getting module config: External Notification\n");
|
LOG_INFO("Getting module config: External Notification\n");
|
||||||
res.get_module_config_response.which_payload_variant = ModuleConfig_external_notification_tag;
|
res.get_module_config_response.which_payload_variant = ModuleConfig_external_notification_tag;
|
||||||
res.get_module_config_response.payload_variant.external_notification =
|
res.get_module_config_response.payload_variant.external_notification = moduleConfig.external_notification;
|
||||||
moduleConfig.external_notification;
|
|
||||||
break;
|
break;
|
||||||
case AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
|
case AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
|
||||||
LOG_INFO("Getting module config: Store & Forward\n");
|
LOG_INFO("Getting module config: Store & Forward\n");
|
||||||
@@ -477,7 +476,8 @@ void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdminModule::handleGetDeviceMetadata(const MeshPacket &req) {
|
void AdminModule::handleGetDeviceMetadata(const MeshPacket &req)
|
||||||
|
{
|
||||||
AdminMessage r = AdminMessage_init_default;
|
AdminMessage r = AdminMessage_init_default;
|
||||||
|
|
||||||
DeviceMetadata deviceMetadata;
|
DeviceMetadata deviceMetadata;
|
||||||
@@ -487,6 +487,8 @@ void AdminModule::handleGetDeviceMetadata(const MeshPacket &req) {
|
|||||||
deviceMetadata.hasBluetooth = HAS_BLUETOOTH;
|
deviceMetadata.hasBluetooth = HAS_BLUETOOTH;
|
||||||
deviceMetadata.hasWifi = HAS_WIFI;
|
deviceMetadata.hasWifi = HAS_WIFI;
|
||||||
deviceMetadata.hasEthernet = HAS_ETHERNET;
|
deviceMetadata.hasEthernet = HAS_ETHERNET;
|
||||||
|
deviceMetadata.role = config.device.role;
|
||||||
|
deviceMetadata.position_flags = config.position.position_flags;
|
||||||
|
|
||||||
r.get_device_metadata_response = deviceMetadata;
|
r.get_device_metadata_response = deviceMetadata;
|
||||||
r.which_payload_variant = AdminMessage_get_device_metadata_response_tag;
|
r.which_payload_variant = AdminMessage_get_device_metadata_response_tag;
|
||||||
@@ -519,8 +521,7 @@ void AdminModule::saveChanges(int saveWhat, bool shouldReboot)
|
|||||||
} else {
|
} else {
|
||||||
LOG_INFO("Delaying save of changes to disk until the open transaction is committed\n");
|
LOG_INFO("Delaying save of changes to disk until the open transaction is committed\n");
|
||||||
}
|
}
|
||||||
if (shouldReboot)
|
if (shouldReboot) {
|
||||||
{
|
|
||||||
reboot(DEFAULT_REBOOT_SECONDS);
|
reboot(DEFAULT_REBOOT_SECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
#if HAS_SCREEN
|
#if HAS_SCREEN
|
||||||
#include "CannedMessageModule.h"
|
#include "CannedMessageModule.h"
|
||||||
#include "FSCommon.h"
|
#include "FSCommon.h"
|
||||||
#include "NodeDB.h"
|
|
||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h" // neede for button bypass
|
#include "PowerFSM.h" // neede for button bypass
|
||||||
#include "mesh/generated/cannedmessages.pb.h"
|
#include "mesh/generated/meshtastic/cannedmessages.pb.h"
|
||||||
|
|
||||||
#ifdef OLED_RU
|
#ifdef OLED_RU
|
||||||
#include "graphics/fonts/OLEDDisplayFontsRU.h"
|
#include "graphics/fonts/OLEDDisplayFontsRU.h"
|
||||||
@@ -163,7 +163,8 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
|||||||
if (event->inputEvent == static_cast<char>(ANYKEY)) {
|
if (event->inputEvent == static_cast<char>(ANYKEY)) {
|
||||||
LOG_DEBUG("Canned message event any key pressed\n");
|
LOG_DEBUG("Canned message event any key pressed\n");
|
||||||
// when inactive, this will switch to the freetext mode
|
// when inactive, this will switch to the freetext mode
|
||||||
if ((this->runState == CANNED_MESSAGE_RUN_STATE_INACTIVE) || (this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) || (this->runState == CANNED_MESSAGE_RUN_STATE_DISABLED)) {
|
if ((this->runState == CANNED_MESSAGE_RUN_STATE_INACTIVE) || (this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) ||
|
||||||
|
(this->runState == CANNED_MESSAGE_RUN_STATE_DISABLED)) {
|
||||||
this->runState = CANNED_MESSAGE_RUN_STATE_FREETEXT;
|
this->runState = CANNED_MESSAGE_RUN_STATE_FREETEXT;
|
||||||
}
|
}
|
||||||
// pass the pressed key
|
// pass the pressed key
|
||||||
@@ -224,7 +225,8 @@ int32_t CannedMessageModule::runOnce()
|
|||||||
this->cursor = 0;
|
this->cursor = 0;
|
||||||
this->destSelect = false;
|
this->destSelect = false;
|
||||||
this->notifyObservers(&e);
|
this->notifyObservers(&e);
|
||||||
} else if (((this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) || (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT)) && ((millis() - this->lastTouchMillis) > INACTIVATE_AFTER_MS)) {
|
} else if (((this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) || (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT)) &&
|
||||||
|
((millis() - this->lastTouchMillis) > INACTIVATE_AFTER_MS)) {
|
||||||
// Reset module
|
// Reset module
|
||||||
LOG_DEBUG("Reset due to lack of activity.\n");
|
LOG_DEBUG("Reset due to lack of activity.\n");
|
||||||
e.frameChanged = true;
|
e.frameChanged = true;
|
||||||
@@ -337,7 +339,8 @@ int32_t CannedMessageModule::runOnce()
|
|||||||
if (this->cursor == this->freetext.length()) {
|
if (this->cursor == this->freetext.length()) {
|
||||||
this->freetext = this->freetext.substring(0, this->freetext.length() - 1);
|
this->freetext = this->freetext.substring(0, this->freetext.length() - 1);
|
||||||
} else {
|
} else {
|
||||||
this->freetext = this->freetext.substring(0, this->cursor - 1) + this->freetext.substring(this->cursor, this->freetext.length());
|
this->freetext = this->freetext.substring(0, this->cursor - 1) +
|
||||||
|
this->freetext.substring(this->cursor, this->freetext.length());
|
||||||
}
|
}
|
||||||
this->cursor--;
|
this->cursor--;
|
||||||
}
|
}
|
||||||
@@ -353,9 +356,8 @@ int32_t CannedMessageModule::runOnce()
|
|||||||
if (this->cursor == this->freetext.length()) {
|
if (this->cursor == this->freetext.length()) {
|
||||||
this->freetext += this->payload;
|
this->freetext += this->payload;
|
||||||
} else {
|
} else {
|
||||||
this->freetext = this->freetext.substring(0, this->cursor)
|
this->freetext =
|
||||||
+ this->payload
|
this->freetext.substring(0, this->cursor) + this->payload + this->freetext.substring(this->cursor);
|
||||||
+ this->freetext.substring(this->cursor);
|
|
||||||
}
|
}
|
||||||
this->cursor += 1;
|
this->cursor += 1;
|
||||||
if (this->freetext.length() > Constants_DATA_PAYLOAD_LEN) {
|
if (this->freetext.length() > Constants_DATA_PAYLOAD_LEN) {
|
||||||
@@ -391,7 +393,8 @@ const char *CannedMessageModule::getNextMessage()
|
|||||||
{
|
{
|
||||||
return this->messages[this->getNextIndex()];
|
return this->messages[this->getNextIndex()];
|
||||||
}
|
}
|
||||||
const char* CannedMessageModule::getNodeName(NodeNum node) {
|
const char *CannedMessageModule::getNodeName(NodeNum node)
|
||||||
|
{
|
||||||
if (node == NODENUM_BROADCAST) {
|
if (node == NODENUM_BROADCAST) {
|
||||||
return "Broadcast";
|
return "Broadcast";
|
||||||
} else {
|
} else {
|
||||||
@@ -460,7 +463,9 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st
|
|||||||
display->drawString(x + display->getWidth() - display->getStringWidth(buffer) - 1, y + 0, buffer);
|
display->drawString(x + display->getWidth() - display->getStringWidth(buffer) - 1, y + 0, buffer);
|
||||||
}
|
}
|
||||||
display->setColor(WHITE);
|
display->setColor(WHITE);
|
||||||
display->drawStringMaxWidth(0 + x, 0 + y + FONT_HEIGHT_SMALL, x + display->getWidth(), cannedMessageModule->drawWithCursor(cannedMessageModule->freetext, cannedMessageModule->cursor));
|
display->drawStringMaxWidth(
|
||||||
|
0 + x, 0 + y + FONT_HEIGHT_SMALL, x + display->getWidth(),
|
||||||
|
cannedMessageModule->drawWithCursor(cannedMessageModule->freetext, cannedMessageModule->cursor));
|
||||||
} else {
|
} else {
|
||||||
if (this->messagesCount > 0) {
|
if (this->messagesCount > 0) {
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
@@ -498,8 +503,8 @@ bool CannedMessageModule::saveProtoForModule()
|
|||||||
FS.mkdir("/prefs");
|
FS.mkdir("/prefs");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
okay &= nodeDB.saveProto(cannedMessagesConfigFile, CannedMessageModuleConfig_size,
|
okay &= nodeDB.saveProto(cannedMessagesConfigFile, CannedMessageModuleConfig_size, &CannedMessageModuleConfig_msg,
|
||||||
&CannedMessageModuleConfig_msg, &cannedMessageModuleConfig);
|
&cannedMessageModuleConfig);
|
||||||
|
|
||||||
return okay;
|
return okay;
|
||||||
}
|
}
|
||||||
@@ -551,11 +556,11 @@ void CannedMessageModule::handleGetCannedMessageModuleMessages(const MeshPacket
|
|||||||
LOG_DEBUG("*** handleGetCannedMessageModuleMessages\n");
|
LOG_DEBUG("*** handleGetCannedMessageModuleMessages\n");
|
||||||
if (req.decoded.want_response) {
|
if (req.decoded.want_response) {
|
||||||
response->which_payload_variant = AdminMessage_get_canned_message_module_messages_response_tag;
|
response->which_payload_variant = AdminMessage_get_canned_message_module_messages_response_tag;
|
||||||
strncpy(response->get_canned_message_module_messages_response, cannedMessageModuleConfig.messages, sizeof(response->get_canned_message_module_messages_response));
|
strncpy(response->get_canned_message_module_messages_response, cannedMessageModuleConfig.messages,
|
||||||
|
sizeof(response->get_canned_message_module_messages_response));
|
||||||
} // Don't send anything if not instructed to. Better than asserting.
|
} // Don't send anything if not instructed to. Better than asserting.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CannedMessageModule::handleSetCannedMessageModuleMessages(const char *from_msg)
|
void CannedMessageModule::handleSetCannedMessageModuleMessages(const char *from_msg)
|
||||||
{
|
{
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
@@ -573,9 +578,7 @@ void CannedMessageModule::handleSetCannedMessageModuleMessages(const char *from_
|
|||||||
|
|
||||||
String CannedMessageModule::drawWithCursor(String text, int cursor)
|
String CannedMessageModule::drawWithCursor(String text, int cursor)
|
||||||
{
|
{
|
||||||
String result = text.substring(0, cursor)
|
String result = text.substring(0, cursor) + "_" + text.substring(cursor);
|
||||||
+ "_"
|
|
||||||
+ text.substring(cursor);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "Router.h"
|
#include "Router.h"
|
||||||
#include "buzz/buzz.h"
|
#include "buzz/buzz.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "mesh/generated/rtttl.pb.h"
|
#include "mesh/generated/meshtastic/rtttl.pb.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#ifndef PIN_BUZZER
|
#ifndef PIN_BUZZER
|
||||||
@@ -58,19 +58,19 @@ int32_t ExternalNotificationModule::runOnce()
|
|||||||
|
|
||||||
// If the output is turned on, turn it back off after the given period of time.
|
// If the output is turned on, turn it back off after the given period of time.
|
||||||
if (isNagging) {
|
if (isNagging) {
|
||||||
if (externalTurnedOn[0] + (moduleConfig.external_notification.output_ms
|
if (externalTurnedOn[0] + (moduleConfig.external_notification.output_ms ? moduleConfig.external_notification.output_ms
|
||||||
? moduleConfig.external_notification.output_ms
|
: EXT_NOTIFICATION_MODULE_OUTPUT_MS) <
|
||||||
: EXT_NOTIFICATION_MODULE_OUTPUT_MS) < millis()) {
|
millis()) {
|
||||||
getExternal(0) ? setExternalOff(0) : setExternalOn(0);
|
getExternal(0) ? setExternalOff(0) : setExternalOn(0);
|
||||||
}
|
}
|
||||||
if (externalTurnedOn[1] + (moduleConfig.external_notification.output_ms
|
if (externalTurnedOn[1] + (moduleConfig.external_notification.output_ms ? moduleConfig.external_notification.output_ms
|
||||||
? moduleConfig.external_notification.output_ms
|
: EXT_NOTIFICATION_MODULE_OUTPUT_MS) <
|
||||||
: EXT_NOTIFICATION_MODULE_OUTPUT_MS) < millis()) {
|
millis()) {
|
||||||
getExternal(1) ? setExternalOff(1) : setExternalOn(1);
|
getExternal(1) ? setExternalOff(1) : setExternalOn(1);
|
||||||
}
|
}
|
||||||
if (externalTurnedOn[2] + (moduleConfig.external_notification.output_ms
|
if (externalTurnedOn[2] + (moduleConfig.external_notification.output_ms ? moduleConfig.external_notification.output_ms
|
||||||
? moduleConfig.external_notification.output_ms
|
: EXT_NOTIFICATION_MODULE_OUTPUT_MS) <
|
||||||
: EXT_NOTIFICATION_MODULE_OUTPUT_MS) < millis()) {
|
millis()) {
|
||||||
getExternal(2) ? setExternalOff(2) : setExternalOn(2);
|
getExternal(2) ? setExternalOff(2) : setExternalOn(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,8 @@ bool ExternalNotificationModule::getExternal(uint8_t index)
|
|||||||
return externalCurrentState[index];
|
return externalCurrentState[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalNotificationModule::stopNow() {
|
void ExternalNotificationModule::stopNow()
|
||||||
|
{
|
||||||
rtttl::stop();
|
rtttl::stop();
|
||||||
nagCycleCutoff = 1; // small value
|
nagCycleCutoff = 1; // small value
|
||||||
isNagging = false;
|
isNagging = false;
|
||||||
@@ -165,13 +166,14 @@ ExternalNotificationModule::ExternalNotificationModule()
|
|||||||
if (moduleConfig.external_notification.enabled) {
|
if (moduleConfig.external_notification.enabled) {
|
||||||
if (!nodeDB.loadProto(rtttlConfigFile, RTTTLConfig_size, sizeof(RTTTLConfig), &RTTTLConfig_msg, &rtttlConfig)) {
|
if (!nodeDB.loadProto(rtttlConfigFile, RTTTLConfig_size, sizeof(RTTTLConfig), &RTTTLConfig_msg, &rtttlConfig)) {
|
||||||
memset(rtttlConfig.ringtone, 0, sizeof(rtttlConfig.ringtone));
|
memset(rtttlConfig.ringtone, 0, sizeof(rtttlConfig.ringtone));
|
||||||
strncpy(rtttlConfig.ringtone, "a:d=8,o=5,b=125:4d#6,a#,2d#6,16p,g#,4a#,4d#.,p,16g,16a#,d#6,a#,f6,2d#6,16p,c#.6,16c6,16a#,g#.,2a#", sizeof(rtttlConfig.ringtone));
|
strncpy(rtttlConfig.ringtone,
|
||||||
|
"a:d=8,o=5,b=125:4d#6,a#,2d#6,16p,g#,4a#,4d#.,p,16g,16a#,d#6,a#,f6,2d#6,16p,c#.6,16c6,16a#,g#.,2a#",
|
||||||
|
sizeof(rtttlConfig.ringtone));
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("Initializing External Notification Module\n");
|
LOG_INFO("Initializing External Notification Module\n");
|
||||||
|
|
||||||
output = moduleConfig.external_notification.output
|
output = moduleConfig.external_notification.output ? moduleConfig.external_notification.output
|
||||||
? moduleConfig.external_notification.output
|
|
||||||
: EXT_NOTIFICATION_MODULE_OUTPUT;
|
: EXT_NOTIFICATION_MODULE_OUTPUT;
|
||||||
|
|
||||||
// Set the direction of a pin
|
// Set the direction of a pin
|
||||||
@@ -192,9 +194,7 @@ ExternalNotificationModule::ExternalNotificationModule()
|
|||||||
setExternalOff(2);
|
setExternalOff(2);
|
||||||
externalTurnedOn[2] = 0;
|
externalTurnedOn[2] = 0;
|
||||||
} else {
|
} else {
|
||||||
config.device.buzzer_gpio = config.device.buzzer_gpio
|
config.device.buzzer_gpio = config.device.buzzer_gpio ? config.device.buzzer_gpio : PIN_BUZZER;
|
||||||
? config.device.buzzer_gpio
|
|
||||||
: PIN_BUZZER;
|
|
||||||
// in PWM Mode we force the buzzer pin if it is set
|
// in PWM Mode we force the buzzer pin if it is set
|
||||||
LOG_INFO("Using Pin %i in PWM mode\n", config.device.buzzer_gpio);
|
LOG_INFO("Using Pin %i in PWM mode\n", config.device.buzzer_gpio);
|
||||||
}
|
}
|
||||||
@@ -274,7 +274,6 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (moduleConfig.external_notification.alert_message_vibra) {
|
if (moduleConfig.external_notification.alert_message_vibra) {
|
||||||
LOG_INFO("externalNotificationModule - Notification Module (Vibra)\n");
|
LOG_INFO("externalNotificationModule - Notification Module (Vibra)\n");
|
||||||
isNagging = true;
|
isNagging = true;
|
||||||
@@ -320,7 +319,8 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
|
|||||||
* @return AdminMessageHandleResult HANDLED if message was handled
|
* @return AdminMessageHandleResult HANDLED if message was handled
|
||||||
* HANDLED_WITH_RESULT if a result is also prepared.
|
* HANDLED_WITH_RESULT if a result is also prepared.
|
||||||
*/
|
*/
|
||||||
AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule(const MeshPacket &mp, AdminMessage *request, AdminMessage *response)
|
AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule(const MeshPacket &mp, AdminMessage *request,
|
||||||
|
AdminMessage *response)
|
||||||
{
|
{
|
||||||
AdminMessageHandleResult result;
|
AdminMessageHandleResult result;
|
||||||
|
|
||||||
@@ -353,7 +353,6 @@ void ExternalNotificationModule::handleGetRingtone(const MeshPacket &req, AdminM
|
|||||||
} // Don't send anything if not instructed to. Better than asserting.
|
} // Don't send anything if not instructed to. Better than asserting.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExternalNotificationModule::handleSetRingtone(const char *from_msg)
|
void ExternalNotificationModule::handleSetRingtone(const char *from_msg)
|
||||||
{
|
{
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ProtobufModule.h"
|
#include "ProtobufModule.h"
|
||||||
#include "mesh/generated/remote_hardware.pb.h"
|
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
|
#include "mesh/generated/meshtastic/remote_hardware.pb.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A module that provides easy low-level remote access to device hardware.
|
* A module that provides easy low-level remote access to device hardware.
|
||||||
@@ -16,6 +16,7 @@ class RemoteHardwareModule : public ProtobufModule<HardwareMessage>, private con
|
|||||||
|
|
||||||
/// The timestamp of our last watch event (we throttle watches to 1 change every 30 seconds)
|
/// The timestamp of our last watch event (we throttle watches to 1 change every 30 seconds)
|
||||||
uint32_t lastWatchMsec = 0;
|
uint32_t lastWatchMsec = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Constructor
|
/** Constructor
|
||||||
* name is for debugging output
|
* name is for debugging output
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "DeviceTelemetry.h"
|
#include "DeviceTelemetry.h"
|
||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
#include <OLEDDisplayUi.h>
|
#include <OLEDDisplayUi.h>
|
||||||
#include "MeshService.h"
|
|
||||||
|
|
||||||
int32_t DeviceTelemetryModule::runOnce()
|
int32_t DeviceTelemetryModule::runOnce()
|
||||||
{
|
{
|
||||||
@@ -32,12 +31,9 @@ bool DeviceTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Telemet
|
|||||||
if (t->which_variant == Telemetry_device_metrics_tag) {
|
if (t->which_variant == Telemetry_device_metrics_tag) {
|
||||||
const char *sender = getSenderShortName(mp);
|
const char *sender = getSenderShortName(mp);
|
||||||
|
|
||||||
LOG_INFO("(Received from %s): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f\n",
|
LOG_INFO("(Received from %s): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f\n", sender,
|
||||||
sender,
|
t->variant.device_metrics.air_util_tx, t->variant.device_metrics.channel_utilization,
|
||||||
t->variant.device_metrics.air_util_tx,
|
t->variant.device_metrics.battery_level, t->variant.device_metrics.voltage);
|
||||||
t->variant.device_metrics.channel_utilization,
|
|
||||||
t->variant.device_metrics.battery_level,
|
|
||||||
t->variant.device_metrics.voltage);
|
|
||||||
|
|
||||||
lastMeasurementPacket = packetPool.allocCopy(mp);
|
lastMeasurementPacket = packetPool.allocCopy(mp);
|
||||||
|
|
||||||
@@ -59,10 +55,8 @@ bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||||||
t.variant.device_metrics.voltage = powerStatus->getBatteryVoltageMv() / 1000.0;
|
t.variant.device_metrics.voltage = powerStatus->getBatteryVoltageMv() / 1000.0;
|
||||||
|
|
||||||
LOG_INFO("(Sending): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f\n",
|
LOG_INFO("(Sending): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f\n",
|
||||||
t.variant.device_metrics.air_util_tx,
|
t.variant.device_metrics.air_util_tx, t.variant.device_metrics.channel_utilization,
|
||||||
t.variant.device_metrics.channel_utilization,
|
t.variant.device_metrics.battery_level, t.variant.device_metrics.voltage);
|
||||||
t.variant.device_metrics.battery_level,
|
|
||||||
t.variant.device_metrics.voltage);
|
|
||||||
|
|
||||||
MeshPacket *p = allocDataProtobuf(t);
|
MeshPacket *p = allocDataProtobuf(t);
|
||||||
p->to = dest;
|
p->to = dest;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "ProtobufModule.h"
|
#include "ProtobufModule.h"
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "EnvironmentTelemetry.h"
|
#include "EnvironmentTelemetry.h"
|
||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
@@ -9,18 +9,17 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
#include <OLEDDisplayUi.h>
|
#include <OLEDDisplayUi.h>
|
||||||
#include "MeshService.h"
|
|
||||||
|
|
||||||
// Sensors
|
// Sensors
|
||||||
#include "Sensor/BMP280Sensor.h"
|
|
||||||
#include "Sensor/BME280Sensor.h"
|
#include "Sensor/BME280Sensor.h"
|
||||||
#include "Sensor/BME680Sensor.h"
|
#include "Sensor/BME680Sensor.h"
|
||||||
#include "Sensor/MCP9808Sensor.h"
|
#include "Sensor/BMP280Sensor.h"
|
||||||
#include "Sensor/INA260Sensor.h"
|
|
||||||
#include "Sensor/INA219Sensor.h"
|
#include "Sensor/INA219Sensor.h"
|
||||||
#include "Sensor/SHTC3Sensor.h"
|
#include "Sensor/INA260Sensor.h"
|
||||||
#include "Sensor/LPS22HBSensor.h"
|
#include "Sensor/LPS22HBSensor.h"
|
||||||
|
#include "Sensor/MCP9808Sensor.h"
|
||||||
#include "Sensor/SHT31Sensor.h"
|
#include "Sensor/SHT31Sensor.h"
|
||||||
|
#include "Sensor/SHTC3Sensor.h"
|
||||||
|
|
||||||
BMP280Sensor bmp280Sensor;
|
BMP280Sensor bmp280Sensor;
|
||||||
BME280Sensor bme280Sensor;
|
BME280Sensor bme280Sensor;
|
||||||
@@ -64,8 +63,7 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
|||||||
// moduleConfig.telemetry.environment_screen_enabled = 1;
|
// moduleConfig.telemetry.environment_screen_enabled = 1;
|
||||||
// moduleConfig.telemetry.environment_update_interval = 45;
|
// moduleConfig.telemetry.environment_update_interval = 45;
|
||||||
|
|
||||||
if (!(moduleConfig.telemetry.environment_measurement_enabled ||
|
if (!(moduleConfig.telemetry.environment_measurement_enabled || moduleConfig.telemetry.environment_screen_enabled)) {
|
||||||
moduleConfig.telemetry.environment_screen_enabled)) {
|
|
||||||
// If this module is not enabled, and the user doesn't want the display screen don't waste any OSThread time on it
|
// If this module is not enabled, and the user doesn't want the display screen don't waste any OSThread time on it
|
||||||
return disable();
|
return disable();
|
||||||
}
|
}
|
||||||
@@ -173,13 +171,15 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt
|
|||||||
}
|
}
|
||||||
display->drawString(x, y += fontHeight(FONT_MEDIUM) - 2, "From: " + String(lastSender) + "(" + String(agoSecs) + "s)");
|
display->drawString(x, y += fontHeight(FONT_MEDIUM) - 2, "From: " + String(lastSender) + "(" + String(agoSecs) + "s)");
|
||||||
display->drawString(x, y += fontHeight(FONT_SMALL) - 2,
|
display->drawString(x, y += fontHeight(FONT_SMALL) - 2,
|
||||||
"Temp/Hum: " + last_temp + " / " + String(lastMeasurement.variant.environment_metrics.relative_humidity, 0) + "%");
|
"Temp/Hum: " + last_temp + " / " +
|
||||||
|
String(lastMeasurement.variant.environment_metrics.relative_humidity, 0) + "%");
|
||||||
if (lastMeasurement.variant.environment_metrics.barometric_pressure != 0)
|
if (lastMeasurement.variant.environment_metrics.barometric_pressure != 0)
|
||||||
display->drawString(x, y += fontHeight(FONT_SMALL),
|
display->drawString(x, y += fontHeight(FONT_SMALL),
|
||||||
"Press: " + String(lastMeasurement.variant.environment_metrics.barometric_pressure, 0) + "hPA");
|
"Press: " + String(lastMeasurement.variant.environment_metrics.barometric_pressure, 0) + "hPA");
|
||||||
if (lastMeasurement.variant.environment_metrics.voltage != 0)
|
if (lastMeasurement.variant.environment_metrics.voltage != 0)
|
||||||
display->drawString(x, y += fontHeight(FONT_SMALL),
|
display->drawString(x, y += fontHeight(FONT_SMALL),
|
||||||
"Volt/Cur: " + String(lastMeasurement.variant.environment_metrics.voltage, 0) + "V / " + String(lastMeasurement.variant.environment_metrics.current, 0) + "mA");
|
"Volt/Cur: " + String(lastMeasurement.variant.environment_metrics.voltage, 0) + "V / " +
|
||||||
|
String(lastMeasurement.variant.environment_metrics.current, 0) + "mA");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EnvironmentTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Telemetry *t)
|
bool EnvironmentTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Telemetry *t)
|
||||||
@@ -187,14 +187,11 @@ bool EnvironmentTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Te
|
|||||||
if (t->which_variant == Telemetry_environment_metrics_tag) {
|
if (t->which_variant == Telemetry_environment_metrics_tag) {
|
||||||
const char *sender = getSenderShortName(mp);
|
const char *sender = getSenderShortName(mp);
|
||||||
|
|
||||||
LOG_INFO("(Received from %s): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, voltage=%f\n",
|
LOG_INFO("(Received from %s): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, "
|
||||||
sender,
|
"temperature=%f, voltage=%f\n",
|
||||||
t->variant.environment_metrics.barometric_pressure,
|
sender, t->variant.environment_metrics.barometric_pressure, t->variant.environment_metrics.current,
|
||||||
t->variant.environment_metrics.current,
|
t->variant.environment_metrics.gas_resistance, t->variant.environment_metrics.relative_humidity,
|
||||||
t->variant.environment_metrics.gas_resistance,
|
t->variant.environment_metrics.temperature, t->variant.environment_metrics.voltage);
|
||||||
t->variant.environment_metrics.relative_humidity,
|
|
||||||
t->variant.environment_metrics.temperature,
|
|
||||||
t->variant.environment_metrics.voltage);
|
|
||||||
|
|
||||||
lastMeasurementPacket = packetPool.allocCopy(mp);
|
lastMeasurementPacket = packetPool.allocCopy(mp);
|
||||||
}
|
}
|
||||||
@@ -234,13 +231,11 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||||||
if (ina260Sensor.hasSensor())
|
if (ina260Sensor.hasSensor())
|
||||||
ina260Sensor.getMetrics(&m);
|
ina260Sensor.getMetrics(&m);
|
||||||
|
|
||||||
LOG_INFO("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, voltage=%f\n",
|
LOG_INFO(
|
||||||
m.variant.environment_metrics.barometric_pressure,
|
"(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, voltage=%f\n",
|
||||||
m.variant.environment_metrics.current,
|
m.variant.environment_metrics.barometric_pressure, m.variant.environment_metrics.current,
|
||||||
m.variant.environment_metrics.gas_resistance,
|
m.variant.environment_metrics.gas_resistance, m.variant.environment_metrics.relative_humidity,
|
||||||
m.variant.environment_metrics.relative_humidity,
|
m.variant.environment_metrics.temperature, m.variant.environment_metrics.voltage);
|
||||||
m.variant.environment_metrics.temperature,
|
|
||||||
m.variant.environment_metrics.voltage);
|
|
||||||
|
|
||||||
sensor_read_error_count = 0;
|
sensor_read_error_count = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "ProtobufModule.h"
|
#include "ProtobufModule.h"
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include "BME280Sensor.h"
|
#include "BME280Sensor.h"
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include <Adafruit_BME280.h>
|
#include <Adafruit_BME280.h>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
BME280Sensor::BME280Sensor() :
|
BME280Sensor::BME280Sensor() : TelemetrySensor(TelemetrySensorType_BME280, "BME280") {}
|
||||||
TelemetrySensor(TelemetrySensorType_BME280, "BME280")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t BME280Sensor::runOnce() {
|
int32_t BME280Sensor::runOnce()
|
||||||
|
{
|
||||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||||
if (!hasSensor()) {
|
if (!hasSensor()) {
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
@@ -21,15 +19,15 @@ int32_t BME280Sensor::runOnce() {
|
|||||||
Adafruit_BME280::SAMPLING_X1, // Temp. oversampling
|
Adafruit_BME280::SAMPLING_X1, // Temp. oversampling
|
||||||
Adafruit_BME280::SAMPLING_X1, // Pressure oversampling
|
Adafruit_BME280::SAMPLING_X1, // Pressure oversampling
|
||||||
Adafruit_BME280::SAMPLING_X1, // Humidity oversampling
|
Adafruit_BME280::SAMPLING_X1, // Humidity oversampling
|
||||||
Adafruit_BME280::FILTER_OFF,
|
Adafruit_BME280::FILTER_OFF, Adafruit_BME280::STANDBY_MS_1000);
|
||||||
Adafruit_BME280::STANDBY_MS_1000);
|
|
||||||
|
|
||||||
return initI2CSensor();
|
return initI2CSensor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BME280Sensor::setup() {}
|
void BME280Sensor::setup() {}
|
||||||
|
|
||||||
bool BME280Sensor::getMetrics(Telemetry *measurement) {
|
bool BME280Sensor::getMetrics(Telemetry *measurement)
|
||||||
|
{
|
||||||
LOG_DEBUG("BME280Sensor::getMetrics\n");
|
LOG_DEBUG("BME280Sensor::getMetrics\n");
|
||||||
bme280.takeForcedMeasurement();
|
bme280.takeForcedMeasurement();
|
||||||
measurement->variant.environment_metrics.temperature = bme280.readTemperature();
|
measurement->variant.environment_metrics.temperature = bme280.readTemperature();
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <Adafruit_BME280.h>
|
#include <Adafruit_BME280.h>
|
||||||
|
|
||||||
class BME280Sensor : virtual public TelemetrySensor {
|
class BME280Sensor : virtual public TelemetrySensor
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
Adafruit_BME280 bme280;
|
Adafruit_BME280 bme280;
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include "BME680Sensor.h"
|
#include "BME680Sensor.h"
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include <Adafruit_BME680.h>
|
#include <Adafruit_BME680.h>
|
||||||
|
|
||||||
BME680Sensor::BME680Sensor() :
|
BME680Sensor::BME680Sensor() : TelemetrySensor(TelemetrySensorType_BME680, "BME680") {}
|
||||||
TelemetrySensor(TelemetrySensorType_BME680, "BME680")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t BME680Sensor::runOnce() {
|
int32_t BME680Sensor::runOnce()
|
||||||
|
{
|
||||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||||
if (!hasSensor()) {
|
if (!hasSensor()) {
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
@@ -21,7 +19,8 @@ int32_t BME680Sensor::runOnce() {
|
|||||||
|
|
||||||
void BME680Sensor::setup() {}
|
void BME680Sensor::setup() {}
|
||||||
|
|
||||||
bool BME680Sensor::getMetrics(Telemetry *measurement) {
|
bool BME680Sensor::getMetrics(Telemetry *measurement)
|
||||||
|
{
|
||||||
bme680.performReading();
|
bme680.performReading();
|
||||||
measurement->variant.environment_metrics.temperature = bme680.temperature;
|
measurement->variant.environment_metrics.temperature = bme680.temperature;
|
||||||
measurement->variant.environment_metrics.relative_humidity = bme680.humidity;
|
measurement->variant.environment_metrics.relative_humidity = bme680.humidity;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <Adafruit_BME680.h>
|
#include <Adafruit_BME680.h>
|
||||||
|
|
||||||
class BME680Sensor : virtual public TelemetrySensor {
|
class BME680Sensor : virtual public TelemetrySensor
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
Adafruit_BME680 bme680;
|
Adafruit_BME680 bme680;
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include "BMP280Sensor.h"
|
#include "BMP280Sensor.h"
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include <Adafruit_BMP280.h>
|
#include <Adafruit_BMP280.h>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
BMP280Sensor::BMP280Sensor() :
|
BMP280Sensor::BMP280Sensor() : TelemetrySensor(TelemetrySensorType_BMP280, "BMP280") {}
|
||||||
TelemetrySensor(TelemetrySensorType_BMP280, "BMP280")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t BMP280Sensor::runOnce() {
|
int32_t BMP280Sensor::runOnce()
|
||||||
|
{
|
||||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||||
if (!hasSensor()) {
|
if (!hasSensor()) {
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
@@ -20,15 +18,15 @@ int32_t BMP280Sensor::runOnce() {
|
|||||||
bmp280.setSampling(Adafruit_BMP280::MODE_FORCED,
|
bmp280.setSampling(Adafruit_BMP280::MODE_FORCED,
|
||||||
Adafruit_BMP280::SAMPLING_X1, // Temp. oversampling
|
Adafruit_BMP280::SAMPLING_X1, // Temp. oversampling
|
||||||
Adafruit_BMP280::SAMPLING_X1, // Pressure oversampling
|
Adafruit_BMP280::SAMPLING_X1, // Pressure oversampling
|
||||||
Adafruit_BMP280::FILTER_OFF,
|
Adafruit_BMP280::FILTER_OFF, Adafruit_BMP280::STANDBY_MS_1000);
|
||||||
Adafruit_BMP280::STANDBY_MS_1000);
|
|
||||||
|
|
||||||
return initI2CSensor();
|
return initI2CSensor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BMP280Sensor::setup() {}
|
void BMP280Sensor::setup() {}
|
||||||
|
|
||||||
bool BMP280Sensor::getMetrics(Telemetry *measurement) {
|
bool BMP280Sensor::getMetrics(Telemetry *measurement)
|
||||||
|
{
|
||||||
LOG_DEBUG("BMP280Sensor::getMetrics\n");
|
LOG_DEBUG("BMP280Sensor::getMetrics\n");
|
||||||
bmp280.takeForcedMeasurement();
|
bmp280.takeForcedMeasurement();
|
||||||
measurement->variant.environment_metrics.temperature = bmp280.readTemperature();
|
measurement->variant.environment_metrics.temperature = bmp280.readTemperature();
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <Adafruit_BMP280.h>
|
#include <Adafruit_BMP280.h>
|
||||||
|
|
||||||
class BMP280Sensor : virtual public TelemetrySensor {
|
class BMP280Sensor : virtual public TelemetrySensor
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
Adafruit_BMP280 bmp280;
|
Adafruit_BMP280 bmp280;
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include "INA219Sensor.h"
|
#include "INA219Sensor.h"
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include <Adafruit_INA219.h>
|
#include <Adafruit_INA219.h>
|
||||||
|
|
||||||
INA219Sensor::INA219Sensor() :
|
INA219Sensor::INA219Sensor() : TelemetrySensor(TelemetrySensorType_INA219, "INA219") {}
|
||||||
TelemetrySensor(TelemetrySensorType_INA219, "INA219")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t INA219Sensor::runOnce() {
|
int32_t INA219Sensor::runOnce()
|
||||||
|
{
|
||||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||||
if (!hasSensor()) {
|
if (!hasSensor()) {
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
@@ -19,11 +17,10 @@ int32_t INA219Sensor::runOnce() {
|
|||||||
return initI2CSensor();
|
return initI2CSensor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void INA219Sensor::setup()
|
void INA219Sensor::setup() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool INA219Sensor::getMetrics(Telemetry *measurement) {
|
bool INA219Sensor::getMetrics(Telemetry *measurement)
|
||||||
|
{
|
||||||
measurement->variant.environment_metrics.voltage = ina219.getBusVoltage_V();
|
measurement->variant.environment_metrics.voltage = ina219.getBusVoltage_V();
|
||||||
measurement->variant.environment_metrics.current = ina219.getCurrent_mA();
|
measurement->variant.environment_metrics.current = ina219.getCurrent_mA();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <Adafruit_INA219.h>
|
#include <Adafruit_INA219.h>
|
||||||
|
|
||||||
|
class INA219Sensor : virtual public TelemetrySensor
|
||||||
class INA219Sensor : virtual public TelemetrySensor {
|
{
|
||||||
private:
|
private:
|
||||||
Adafruit_INA219 ina219;
|
Adafruit_INA219 ina219;
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include "INA260Sensor.h"
|
#include "INA260Sensor.h"
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include <Adafruit_INA260.h>
|
#include <Adafruit_INA260.h>
|
||||||
|
|
||||||
INA260Sensor::INA260Sensor() :
|
INA260Sensor::INA260Sensor() : TelemetrySensor(TelemetrySensorType_INA260, "INA260") {}
|
||||||
TelemetrySensor(TelemetrySensorType_INA260, "INA260")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t INA260Sensor::runOnce() {
|
int32_t INA260Sensor::runOnce()
|
||||||
|
{
|
||||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||||
if (!hasSensor()) {
|
if (!hasSensor()) {
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
@@ -18,11 +16,10 @@ int32_t INA260Sensor::runOnce() {
|
|||||||
return initI2CSensor();
|
return initI2CSensor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void INA260Sensor::setup()
|
void INA260Sensor::setup() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool INA260Sensor::getMetrics(Telemetry *measurement) {
|
bool INA260Sensor::getMetrics(Telemetry *measurement)
|
||||||
|
{
|
||||||
// mV conversion to V
|
// mV conversion to V
|
||||||
measurement->variant.environment_metrics.voltage = ina260.readBusVoltage() / 1000;
|
measurement->variant.environment_metrics.voltage = ina260.readBusVoltage() / 1000;
|
||||||
measurement->variant.environment_metrics.current = ina260.readCurrent();
|
measurement->variant.environment_metrics.current = ina260.readCurrent();
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <Adafruit_INA260.h>
|
#include <Adafruit_INA260.h>
|
||||||
|
|
||||||
|
class INA260Sensor : virtual public TelemetrySensor
|
||||||
class INA260Sensor : virtual public TelemetrySensor {
|
{
|
||||||
private:
|
private:
|
||||||
Adafruit_INA260 ina260 = Adafruit_INA260();
|
Adafruit_INA260 ina260 = Adafruit_INA260();
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include "LPS22HBSensor.h"
|
#include "LPS22HBSensor.h"
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include <Adafruit_LPS2X.h>
|
#include <Adafruit_LPS2X.h>
|
||||||
#include <Adafruit_Sensor.h>
|
#include <Adafruit_Sensor.h>
|
||||||
|
|
||||||
LPS22HBSensor::LPS22HBSensor() :
|
LPS22HBSensor::LPS22HBSensor() : TelemetrySensor(TelemetrySensorType_LPS22, "LPS22HB") {}
|
||||||
TelemetrySensor(TelemetrySensorType_LPS22, "LPS22HB")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t LPS22HBSensor::runOnce() {
|
int32_t LPS22HBSensor::runOnce()
|
||||||
|
{
|
||||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||||
if (!hasSensor()) {
|
if (!hasSensor()) {
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
@@ -24,7 +22,8 @@ void LPS22HBSensor::setup()
|
|||||||
lps22hb.setDataRate(LPS22_RATE_10_HZ);
|
lps22hb.setDataRate(LPS22_RATE_10_HZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LPS22HBSensor::getMetrics(Telemetry *measurement) {
|
bool LPS22HBSensor::getMetrics(Telemetry *measurement)
|
||||||
|
{
|
||||||
sensors_event_t temp;
|
sensors_event_t temp;
|
||||||
sensors_event_t pressure;
|
sensors_event_t pressure;
|
||||||
lps22hb.getEvent(&pressure, &temp);
|
lps22hb.getEvent(&pressure, &temp);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <Adafruit_LPS2X.h>
|
#include <Adafruit_LPS2X.h>
|
||||||
#include <Adafruit_Sensor.h>
|
#include <Adafruit_Sensor.h>
|
||||||
|
|
||||||
class LPS22HBSensor : virtual public TelemetrySensor {
|
class LPS22HBSensor : virtual public TelemetrySensor
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
Adafruit_LPS22 lps22hb;
|
Adafruit_LPS22 lps22hb;
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include "MCP9808Sensor.h"
|
#include "MCP9808Sensor.h"
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include <Adafruit_MCP9808.h>
|
#include <Adafruit_MCP9808.h>
|
||||||
|
|
||||||
MCP9808Sensor::MCP9808Sensor() :
|
MCP9808Sensor::MCP9808Sensor() : TelemetrySensor(TelemetrySensorType_MCP9808, "MCP9808") {}
|
||||||
TelemetrySensor(TelemetrySensorType_MCP9808, "MCP9808")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t MCP9808Sensor::runOnce() {
|
int32_t MCP9808Sensor::runOnce()
|
||||||
|
{
|
||||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||||
if (!hasSensor()) {
|
if (!hasSensor()) {
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
@@ -18,11 +16,13 @@ int32_t MCP9808Sensor::runOnce() {
|
|||||||
return initI2CSensor();
|
return initI2CSensor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCP9808Sensor::setup() {
|
void MCP9808Sensor::setup()
|
||||||
|
{
|
||||||
mcp9808.setResolution(2);
|
mcp9808.setResolution(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCP9808Sensor::getMetrics(Telemetry *measurement) {
|
bool MCP9808Sensor::getMetrics(Telemetry *measurement)
|
||||||
|
{
|
||||||
LOG_DEBUG("MCP9808Sensor::getMetrics\n");
|
LOG_DEBUG("MCP9808Sensor::getMetrics\n");
|
||||||
measurement->variant.environment_metrics.temperature = mcp9808.readTempC();
|
measurement->variant.environment_metrics.temperature = mcp9808.readTempC();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <Adafruit_MCP9808.h>
|
#include <Adafruit_MCP9808.h>
|
||||||
|
|
||||||
class MCP9808Sensor : virtual public TelemetrySensor {
|
class MCP9808Sensor : virtual public TelemetrySensor
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
Adafruit_MCP9808 mcp9808;
|
Adafruit_MCP9808 mcp9808;
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include "SHT31Sensor.h"
|
#include "SHT31Sensor.h"
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include <Adafruit_SHT31.h>
|
#include <Adafruit_SHT31.h>
|
||||||
|
|
||||||
SHT31Sensor::SHT31Sensor() :
|
SHT31Sensor::SHT31Sensor() : TelemetrySensor(TelemetrySensorType_SHT31, "SHT31") {}
|
||||||
TelemetrySensor(TelemetrySensorType_SHT31, "SHT31")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t SHT31Sensor::runOnce() {
|
int32_t SHT31Sensor::runOnce()
|
||||||
|
{
|
||||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||||
if (!hasSensor()) {
|
if (!hasSensor()) {
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
@@ -23,7 +21,8 @@ void SHT31Sensor::setup()
|
|||||||
// Set up oversampling and filter initialization
|
// Set up oversampling and filter initialization
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SHT31Sensor::getMetrics(Telemetry *measurement) {
|
bool SHT31Sensor::getMetrics(Telemetry *measurement)
|
||||||
|
{
|
||||||
measurement->variant.environment_metrics.temperature = sht31.readTemperature();
|
measurement->variant.environment_metrics.temperature = sht31.readTemperature();
|
||||||
measurement->variant.environment_metrics.relative_humidity = sht31.readHumidity();
|
measurement->variant.environment_metrics.relative_humidity = sht31.readHumidity();
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <Adafruit_SHT31.h>
|
#include <Adafruit_SHT31.h>
|
||||||
|
|
||||||
class SHT31Sensor : virtual public TelemetrySensor {
|
class SHT31Sensor : virtual public TelemetrySensor
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
Adafruit_SHT31 sht31 = Adafruit_SHT31();
|
Adafruit_SHT31 sht31 = Adafruit_SHT31();
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include "SHTC3Sensor.h"
|
#include "SHTC3Sensor.h"
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include <Adafruit_SHTC3.h>
|
#include <Adafruit_SHTC3.h>
|
||||||
|
|
||||||
SHTC3Sensor::SHTC3Sensor() :
|
SHTC3Sensor::SHTC3Sensor() : TelemetrySensor(TelemetrySensorType_SHTC3, "SHTC3") {}
|
||||||
TelemetrySensor(TelemetrySensorType_SHTC3, "SHTC3")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t SHTC3Sensor::runOnce() {
|
int32_t SHTC3Sensor::runOnce()
|
||||||
|
{
|
||||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||||
if (!hasSensor()) {
|
if (!hasSensor()) {
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
@@ -23,7 +21,8 @@ void SHTC3Sensor::setup()
|
|||||||
// Set up oversampling and filter initialization
|
// Set up oversampling and filter initialization
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SHTC3Sensor::getMetrics(Telemetry *measurement) {
|
bool SHTC3Sensor::getMetrics(Telemetry *measurement)
|
||||||
|
{
|
||||||
sensors_event_t humidity, temp;
|
sensors_event_t humidity, temp;
|
||||||
shtc3.getEvent(&humidity, &temp);
|
shtc3.getEvent(&humidity, &temp);
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <Adafruit_SHTC3.h>
|
#include <Adafruit_SHTC3.h>
|
||||||
|
|
||||||
class SHTC3Sensor : virtual public TelemetrySensor {
|
class SHTC3Sensor : virtual public TelemetrySensor
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
Adafruit_SHTC3 shtc3 = Adafruit_SHTC3();
|
Adafruit_SHTC3 shtc3 = Adafruit_SHTC3();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
@@ -19,7 +19,8 @@ class TelemetrySensor
|
|||||||
TelemetrySensorType sensorType;
|
TelemetrySensorType sensorType;
|
||||||
unsigned status;
|
unsigned status;
|
||||||
|
|
||||||
int32_t initI2CSensor() {
|
int32_t initI2CSensor()
|
||||||
|
{
|
||||||
if (!status) {
|
if (!status) {
|
||||||
LOG_WARN("Could not connect to detected %s sensor.\n Removing from nodeTelemetrySensorsMap.\n", sensorName);
|
LOG_WARN("Could not connect to detected %s sensor.\n Removing from nodeTelemetrySensorsMap.\n", sensorName);
|
||||||
nodeTelemetrySensorsMap[sensorType] = 0;
|
nodeTelemetrySensorsMap[sensorType] = 0;
|
||||||
@@ -32,9 +33,7 @@ class TelemetrySensor
|
|||||||
virtual void setup();
|
virtual void setup();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool hasSensor() {
|
bool hasSensor() { return sensorType < sizeof(nodeTelemetrySensorsMap) && nodeTelemetrySensorsMap[sensorType] > 0; }
|
||||||
return sensorType < sizeof(nodeTelemetrySensorsMap) && nodeTelemetrySensorsMap[sensorType] > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual int32_t runOnce() = 0;
|
virtual int32_t runOnce() = 0;
|
||||||
virtual bool getMetrics(Telemetry *measurement) = 0;
|
virtual bool getMetrics(Telemetry *measurement) = 0;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "airtime.h"
|
#include "airtime.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
#include "mesh/generated/storeforward.pb.h"
|
#include "mesh/generated/meshtastic/storeforward.pb.h"
|
||||||
#include "modules/ModuleDev.h"
|
#include "modules/ModuleDev.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
@@ -63,7 +63,8 @@ void StoreForwardModule::populatePSRAM()
|
|||||||
https://learn.upesy.com/en/programmation/psram.html#psram-tab
|
https://learn.upesy.com/en/programmation/psram.html#psram-tab
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LOG_DEBUG("*** Before PSRAM initilization: heap %d/%d PSRAM %d/%d\n", ESP.getFreeHeap(), ESP.getHeapSize(), ESP.getFreePsram(), ESP.getPsramSize());
|
LOG_DEBUG("*** Before PSRAM initilization: heap %d/%d PSRAM %d/%d\n", ESP.getFreeHeap(), ESP.getHeapSize(),
|
||||||
|
ESP.getFreePsram(), ESP.getPsramSize());
|
||||||
|
|
||||||
this->packetHistoryTXQueue =
|
this->packetHistoryTXQueue =
|
||||||
static_cast<PacketHistoryStruct *>(ps_calloc(this->historyReturnMax, sizeof(PacketHistoryStruct)));
|
static_cast<PacketHistoryStruct *>(ps_calloc(this->historyReturnMax, sizeof(PacketHistoryStruct)));
|
||||||
@@ -76,7 +77,8 @@ void StoreForwardModule::populatePSRAM()
|
|||||||
|
|
||||||
this->packetHistory = static_cast<PacketHistoryStruct *>(ps_calloc(numberOfPackets, sizeof(PacketHistoryStruct)));
|
this->packetHistory = static_cast<PacketHistoryStruct *>(ps_calloc(numberOfPackets, sizeof(PacketHistoryStruct)));
|
||||||
|
|
||||||
LOG_DEBUG("*** After PSRAM initilization: heap %d/%d PSRAM %d/%d\n", ESP.getFreeHeap(), ESP.getHeapSize(), ESP.getFreePsram(), ESP.getPsramSize());
|
LOG_DEBUG("*** After PSRAM initilization: heap %d/%d PSRAM %d/%d\n", ESP.getFreeHeap(), ESP.getHeapSize(), ESP.getFreePsram(),
|
||||||
|
ESP.getPsramSize());
|
||||||
LOG_DEBUG("*** numberOfPackets for packetHistory - %u\n", numberOfPackets);
|
LOG_DEBUG("*** numberOfPackets for packetHistory - %u\n", numberOfPackets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +361,8 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
|
|||||||
if (is_client) {
|
if (is_client) {
|
||||||
LOG_DEBUG("*** StoreAndForward_RequestResponse_ROUTER_BUSY\n");
|
LOG_DEBUG("*** StoreAndForward_RequestResponse_ROUTER_BUSY\n");
|
||||||
// retry in messages_saved * packetTimeMax ms
|
// retry in messages_saved * packetTimeMax ms
|
||||||
retry_delay = millis() + packetHistoryCurrent * packetTimeMax * (StoreAndForward_RequestResponse_ROUTER_ERROR ? 2 : 1);
|
retry_delay =
|
||||||
|
millis() + packetHistoryCurrent * packetTimeMax * (StoreAndForward_RequestResponse_ROUTER_ERROR ? 2 : 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -406,7 +409,8 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
|
|||||||
// These fields only have informational purpose on a client. Fill them to consume later.
|
// These fields only have informational purpose on a client. Fill them to consume later.
|
||||||
if (p->which_variant == StoreAndForward_history_tag) {
|
if (p->which_variant == StoreAndForward_history_tag) {
|
||||||
this->historyReturnWindow = p->variant.history.window / 60000;
|
this->historyReturnWindow = p->variant.history.window / 60000;
|
||||||
LOG_INFO("*** Router Response HISTORY - Sending %d messages from last %d minutes\n", p->variant.history.history_messages, this->historyReturnWindow);
|
LOG_INFO("*** Router Response HISTORY - Sending %d messages from last %d minutes\n",
|
||||||
|
p->variant.history.history_messages, this->historyReturnWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -437,7 +441,8 @@ StoreForwardModule::StoreForwardModule()
|
|||||||
if (moduleConfig.store_forward.enabled) {
|
if (moduleConfig.store_forward.enabled) {
|
||||||
|
|
||||||
// Router
|
// Router
|
||||||
if ((config.device.role == Config_DeviceConfig_Role_ROUTER) || (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) {
|
if ((config.device.role == Config_DeviceConfig_Role_ROUTER) ||
|
||||||
|
(config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) {
|
||||||
LOG_INFO("*** Initializing Store & Forward Module in Router mode\n");
|
LOG_INFO("*** Initializing Store & Forward Module in Router mode\n");
|
||||||
if (ESP.getPsramSize() > 0) {
|
if (ESP.getPsramSize() > 0) {
|
||||||
if (ESP.getFreePsram() >= 1024 * 1024) {
|
if (ESP.getFreePsram() >= 1024 * 1024) {
|
||||||
@@ -474,7 +479,8 @@ StoreForwardModule::StoreForwardModule()
|
|||||||
|
|
||||||
// Client
|
// Client
|
||||||
}
|
}
|
||||||
if ((config.device.role == Config_DeviceConfig_Role_CLIENT) || (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) {
|
if ((config.device.role == Config_DeviceConfig_Role_CLIENT) ||
|
||||||
|
(config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) {
|
||||||
is_client = true;
|
is_client = true;
|
||||||
LOG_INFO("*** Initializing Store & Forward Module in Client mode\n");
|
LOG_INFO("*** Initializing Store & Forward Module in Client mode\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "ProtobufModule.h"
|
#include "ProtobufModule.h"
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
#include "mesh/generated/storeforward.pb.h"
|
#include "mesh/generated/meshtastic/storeforward.pb.h"
|
||||||
|
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
@@ -100,7 +100,6 @@ class StoreForwardModule : private concurrency::OSThread, public ProtobufModule<
|
|||||||
*/
|
*/
|
||||||
virtual ProcessMessage handleReceived(const MeshPacket &mp) override;
|
virtual ProcessMessage handleReceived(const MeshPacket &mp) override;
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, StoreAndForward *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, StoreAndForward *p);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern StoreForwardModule *storeForwardModule;
|
extern StoreForwardModule *storeForwardModule;
|
||||||
|
|||||||
+38
-18
@@ -5,15 +5,15 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mesh/Channels.h"
|
#include "mesh/Channels.h"
|
||||||
#include "mesh/Router.h"
|
#include "mesh/Router.h"
|
||||||
#include "mesh/generated/mqtt.pb.h"
|
#include "mesh/generated/meshtastic/mqtt.pb.h"
|
||||||
#include "mesh/generated/telemetry.pb.h"
|
#include "mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#if HAS_WIFI
|
#if HAS_WIFI
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#endif
|
#endif
|
||||||
#include <assert.h>
|
|
||||||
#include "mqtt/JSON.h"
|
#include "mqtt/JSON.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
MQTT *mqtt;
|
MQTT *mqtt;
|
||||||
|
|
||||||
@@ -55,11 +55,15 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
|
|||||||
}
|
}
|
||||||
LOG_DEBUG("Looking for Channel name: %s\n", ptr);
|
LOG_DEBUG("Looking for Channel name: %s\n", ptr);
|
||||||
Channel sendChannel = channels.getByName(ptr);
|
Channel sendChannel = channels.getByName(ptr);
|
||||||
LOG_DEBUG("Found Channel name: %s (Index %d)\n", channels.getGlobalId(sendChannel.settings.channel_num), sendChannel.settings.channel_num);
|
LOG_DEBUG("Found Channel name: %s (Index %d)\n", channels.getGlobalId(sendChannel.settings.channel_num),
|
||||||
|
sendChannel.settings.channel_num);
|
||||||
|
|
||||||
if ((json.find("sender") != json.end()) && (json.find("payload") != json.end()) && (json.find("type") != json.end()) && json["type"]->IsString() && (json["type"]->AsString().compare("sendtext") == 0)) {
|
if ((json.find("sender") != json.end()) && (json.find("payload") != json.end()) &&
|
||||||
|
(json.find("type") != json.end()) && json["type"]->IsString() &&
|
||||||
|
(json["type"]->AsString().compare("sendtext") == 0)) {
|
||||||
// this is a valid envelope
|
// this is a valid envelope
|
||||||
if (json["payload"]->IsString() && json["type"]->IsString() && (json["sender"]->AsString().compare(owner.id) != 0)) {
|
if (json["payload"]->IsString() && json["type"]->IsString() &&
|
||||||
|
(json["sender"]->AsString().compare(owner.id) != 0)) {
|
||||||
std::string jsonPayloadStr = json["payload"]->AsString();
|
std::string jsonPayloadStr = json["payload"]->AsString();
|
||||||
LOG_INFO("JSON payload %s, length %u\n", jsonPayloadStr.c_str(), jsonPayloadStr.length());
|
LOG_INFO("JSON payload %s, length %u\n", jsonPayloadStr.c_str(), jsonPayloadStr.length());
|
||||||
|
|
||||||
@@ -77,14 +81,18 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
|
|||||||
LOG_WARN("Received MQTT json payload too long, dropping\n");
|
LOG_WARN("Received MQTT json payload too long, dropping\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_WARN("Received MQTT json payload on channel %s, but downlink is disabled, dropping\n", sendChannel.settings.name);
|
LOG_WARN("Received MQTT json payload on channel %s, but downlink is disabled, dropping\n",
|
||||||
|
sendChannel.settings.name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("JSON Ignoring downlink message we originally sent.\n");
|
LOG_DEBUG("JSON Ignoring downlink message we originally sent.\n");
|
||||||
}
|
}
|
||||||
} else if ((json.find("sender") != json.end()) && (json.find("payload") != json.end()) && (json.find("type") != json.end()) && json["type"]->IsString() && (json["type"]->AsString().compare("sendposition") == 0)) {
|
} else if ((json.find("sender") != json.end()) && (json.find("payload") != json.end()) &&
|
||||||
|
(json.find("type") != json.end()) && json["type"]->IsString() &&
|
||||||
|
(json["type"]->AsString().compare("sendposition") == 0)) {
|
||||||
// invent the "sendposition" type for a valid envelope
|
// invent the "sendposition" type for a valid envelope
|
||||||
if (json["payload"]->IsObject() && json["type"]->IsString() && (json["sender"]->AsString().compare(owner.id) != 0)) {
|
if (json["payload"]->IsObject() && json["type"]->IsString() &&
|
||||||
|
(json["sender"]->AsString().compare(owner.id) != 0)) {
|
||||||
JSONObject posit;
|
JSONObject posit;
|
||||||
posit = json["payload"]->AsObject(); // get nested JSON Position
|
posit = json["payload"]->AsObject(); // get nested JSON Position
|
||||||
Position pos = Position_init_default;
|
Position pos = Position_init_default;
|
||||||
@@ -98,10 +106,12 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
|
|||||||
p->decoded.portnum = PortNum_POSITION_APP;
|
p->decoded.portnum = PortNum_POSITION_APP;
|
||||||
p->channel = sendChannel.settings.channel_num;
|
p->channel = sendChannel.settings.channel_num;
|
||||||
if (sendChannel.settings.downlink_enabled) {
|
if (sendChannel.settings.downlink_enabled) {
|
||||||
p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &Position_msg, &pos); //make the Data protobuf from position
|
p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes),
|
||||||
|
&Position_msg, &pos); // make the Data protobuf from position
|
||||||
service.sendToMesh(p, RX_SRC_LOCAL);
|
service.sendToMesh(p, RX_SRC_LOCAL);
|
||||||
} else {
|
} else {
|
||||||
LOG_WARN("Received MQTT json payload on channel %s, but downlink is disabled, dropping\n", sendChannel.settings.name);
|
LOG_WARN("Received MQTT json payload on channel %s, but downlink is disabled, dropping\n",
|
||||||
|
sendChannel.settings.name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("JSON Ignoring downlink message we originally sent.\n");
|
LOG_DEBUG("JSON Ignoring downlink message we originally sent.\n");
|
||||||
@@ -192,7 +202,8 @@ void MQTT::reconnect()
|
|||||||
pubSub.setServer(serverAddr, serverPort);
|
pubSub.setServer(serverAddr, serverPort);
|
||||||
pubSub.setBufferSize(512);
|
pubSub.setBufferSize(512);
|
||||||
|
|
||||||
LOG_INFO("Connecting to MQTT server %s, port: %d, username: %s, password: %s\n", serverAddr, serverPort, mqttUsername, mqttPassword);
|
LOG_INFO("Connecting to MQTT server %s, port: %d, username: %s, password: %s\n", serverAddr, serverPort, mqttUsername,
|
||||||
|
mqttPassword);
|
||||||
auto myStatus = (statusTopic + owner.id);
|
auto myStatus = (statusTopic + owner.id);
|
||||||
bool connected = pubSub.connect(owner.id, mqttUsername, mqttPassword, myStatus.c_str(), 1, true, "offline");
|
bool connected = pubSub.connect(owner.id, mqttUsername, mqttPassword, myStatus.c_str(), 1, true, "offline");
|
||||||
if (connected) {
|
if (connected) {
|
||||||
@@ -277,7 +288,8 @@ int32_t MQTT::runOnce()
|
|||||||
if (wantConnection) {
|
if (wantConnection) {
|
||||||
reconnect();
|
reconnect();
|
||||||
|
|
||||||
// If we succeeded, empty the queue one by one and start reading rapidly, else try again in 30 seconds (TCP connections are EXPENSIVE so try rarely)
|
// If we succeeded, empty the queue one by one and start reading rapidly, else try again in 30 seconds (TCP
|
||||||
|
// connections are EXPENSIVE so try rarely)
|
||||||
if (pubSub.connected()) {
|
if (pubSub.connected()) {
|
||||||
if (!mqttQueue.isEmpty()) {
|
if (!mqttQueue.isEmpty()) {
|
||||||
// FIXME - this size calculation is super sloppy, but it will go away once we dynamically alloc meshpackets
|
// FIXME - this size calculation is super sloppy, but it will go away once we dynamically alloc meshpackets
|
||||||
@@ -295,7 +307,8 @@ int32_t MQTT::runOnce()
|
|||||||
auto jsonString = this->downstreamPacketToJson(env->packet);
|
auto jsonString = this->downstreamPacketToJson(env->packet);
|
||||||
if (jsonString.length() != 0) {
|
if (jsonString.length() != 0) {
|
||||||
String topicJson = jsonTopic + env->channel_id + "/" + owner.id;
|
String topicJson = jsonTopic + env->channel_id + "/" + owner.id;
|
||||||
LOG_INFO("JSON publish message to %s, %u bytes: %s\n", topicJson.c_str(), jsonString.length(), jsonString.c_str());
|
LOG_INFO("JSON publish message to %s, %u bytes: %s\n", topicJson.c_str(), jsonString.length(),
|
||||||
|
jsonString.c_str());
|
||||||
pubSub.publish(topicJson.c_str(), jsonString.c_str(), false);
|
pubSub.publish(topicJson.c_str(), jsonString.c_str(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -348,7 +361,8 @@ void MQTT::onSend(const MeshPacket &mp, ChannelIndex chIndex)
|
|||||||
auto jsonString = this->downstreamPacketToJson((MeshPacket *)&mp);
|
auto jsonString = this->downstreamPacketToJson((MeshPacket *)&mp);
|
||||||
if (jsonString.length() != 0) {
|
if (jsonString.length() != 0) {
|
||||||
String topicJson = jsonTopic + channelId + "/" + owner.id;
|
String topicJson = jsonTopic + channelId + "/" + owner.id;
|
||||||
LOG_INFO("JSON publish message to %s, %u bytes: %s\n", topicJson.c_str(), jsonString.length(), jsonString.c_str());
|
LOG_INFO("JSON publish message to %s, %u bytes: %s\n", topicJson.c_str(), jsonString.length(),
|
||||||
|
jsonString.c_str());
|
||||||
pubSub.publish(topicJson.c_str(), jsonString.c_str(), false);
|
pubSub.publish(topicJson.c_str(), jsonString.c_str(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -453,11 +467,17 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp)
|
|||||||
memset(&scratch, 0, sizeof(scratch));
|
memset(&scratch, 0, sizeof(scratch));
|
||||||
if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &Position_msg, &scratch)) {
|
if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &Position_msg, &scratch)) {
|
||||||
decoded = &scratch;
|
decoded = &scratch;
|
||||||
if((int)decoded->time){msgPayload["time"] = new JSONValue((int)decoded->time);}
|
if ((int)decoded->time) {
|
||||||
if ((int)decoded->timestamp){msgPayload["timestamp"] = new JSONValue((int)decoded->timestamp);}
|
msgPayload["time"] = new JSONValue((int)decoded->time);
|
||||||
|
}
|
||||||
|
if ((int)decoded->timestamp) {
|
||||||
|
msgPayload["timestamp"] = new JSONValue((int)decoded->timestamp);
|
||||||
|
}
|
||||||
msgPayload["latitude_i"] = new JSONValue((int)decoded->latitude_i);
|
msgPayload["latitude_i"] = new JSONValue((int)decoded->latitude_i);
|
||||||
msgPayload["longitude_i"] = new JSONValue((int)decoded->longitude_i);
|
msgPayload["longitude_i"] = new JSONValue((int)decoded->longitude_i);
|
||||||
if((int)decoded->altitude){msgPayload["altitude"] = new JSONValue((int)decoded->altitude);}
|
if ((int)decoded->altitude) {
|
||||||
|
msgPayload["altitude"] = new JSONValue((int)decoded->altitude);
|
||||||
|
}
|
||||||
jsonObj["payload"] = new JSONValue(msgPayload);
|
jsonObj["payload"] = new JSONValue(msgPayload);
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("Error decoding protobuf for position message!\n");
|
LOG_ERROR("Error decoding protobuf for position message!\n");
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
#include "mesh/Channels.h"
|
#include "mesh/Channels.h"
|
||||||
#include "mesh/generated/mqtt.pb.h"
|
#include "mesh/generated/meshtastic/mqtt.pb.h"
|
||||||
#include <PubSubClient.h>
|
#include <PubSubClient.h>
|
||||||
#if HAS_WIFI
|
#if HAS_WIFI
|
||||||
#include <WiFiClient.h>
|
#include <WiFiClient.h>
|
||||||
|
|||||||
+221
@@ -0,0 +1,221 @@
|
|||||||
|
/***********************************************************************************************************************
|
||||||
|
* based on XMODEM implementation by Georges Menie (www.menie.org)
|
||||||
|
***********************************************************************************************************************
|
||||||
|
* Copyright 2001-2019 Georges Menie (www.menie.org)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Adapted for protobuf encapsulation. this is not really Xmodem any more.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the University of California, Berkeley nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
**********************************************************************************************************************/
|
||||||
|
|
||||||
|
#include "xmodem.h"
|
||||||
|
|
||||||
|
XModemAdapter xModem;
|
||||||
|
|
||||||
|
XModemAdapter::XModemAdapter()
|
||||||
|
{
|
||||||
|
xmodemStore = (XModem *)malloc(XModem_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short XModemAdapter::crc16_ccitt(const pb_byte_t *buffer, int length)
|
||||||
|
{
|
||||||
|
unsigned short crc16 = 0;
|
||||||
|
while (length != 0) {
|
||||||
|
crc16 = (unsigned char)(crc16 >> 8) | (crc16 << 8);
|
||||||
|
crc16 ^= *buffer;
|
||||||
|
crc16 ^= (unsigned char)(crc16 & 0xff) >> 4;
|
||||||
|
crc16 ^= (crc16 << 8) << 4;
|
||||||
|
crc16 ^= ((crc16 & 0xff) << 4) << 1;
|
||||||
|
buffer++;
|
||||||
|
length--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return crc16;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XModemAdapter::check(const pb_byte_t *buf, int sz, unsigned short tcrc)
|
||||||
|
{
|
||||||
|
unsigned short crc = crc16_ccitt(buf, sz);
|
||||||
|
if (crc == tcrc)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XModemAdapter::sendControl(XModem_Control c)
|
||||||
|
{
|
||||||
|
memset(xmodemStore, 0, XModem_size);
|
||||||
|
xmodemStore->control = c;
|
||||||
|
LOG_DEBUG("XModem: Notify Sending control %d.\n", c);
|
||||||
|
packetReady.notifyObservers(packetno);
|
||||||
|
}
|
||||||
|
|
||||||
|
XModem *XModemAdapter::getForPhone()
|
||||||
|
{
|
||||||
|
if (xmodemStore) {
|
||||||
|
return xmodemStore;
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XModemAdapter::handlePacket(XModem xmodemPacket)
|
||||||
|
{
|
||||||
|
switch (xmodemPacket.control) {
|
||||||
|
case XModem_Control_SOH:
|
||||||
|
case XModem_Control_STX:
|
||||||
|
if ((xmodemPacket.seq == 0) && !isReceiving && !isTransmitting) {
|
||||||
|
// NULL packet has the destination filename
|
||||||
|
memcpy(filename, &xmodemPacket.buffer.bytes, xmodemPacket.buffer.size);
|
||||||
|
if (xmodemPacket.control == XModem_Control_SOH) { // Receive this file and put to Flash
|
||||||
|
file = FSCom.open(filename, FILE_O_WRITE);
|
||||||
|
if (file) {
|
||||||
|
sendControl(XModem_Control_ACK);
|
||||||
|
isReceiving = true;
|
||||||
|
packetno = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sendControl(XModem_Control_NAK);
|
||||||
|
isReceiving = false;
|
||||||
|
break;
|
||||||
|
} else { // Transmit this file from Flash
|
||||||
|
LOG_INFO("XModem: Transmitting file %s\n", filename);
|
||||||
|
file = FSCom.open(filename, FILE_O_READ);
|
||||||
|
if (file) {
|
||||||
|
packetno = 1;
|
||||||
|
isTransmitting = true;
|
||||||
|
memset(xmodemStore, 0, XModem_size);
|
||||||
|
xmodemStore->control = XModem_Control_SOH;
|
||||||
|
xmodemStore->seq = packetno;
|
||||||
|
xmodemStore->buffer.size = file.read(xmodemStore->buffer.bytes, sizeof(XModem_buffer_t::bytes));
|
||||||
|
xmodemStore->crc16 = crc16_ccitt(xmodemStore->buffer.bytes, xmodemStore->buffer.size);
|
||||||
|
LOG_DEBUG("XModem: STX Notify Sending packet %d, %d Bytes.\n", packetno, xmodemStore->buffer.size);
|
||||||
|
if (xmodemStore->buffer.size < sizeof(XModem_buffer_t::bytes)) {
|
||||||
|
isEOT = true;
|
||||||
|
// send EOT on next Ack
|
||||||
|
}
|
||||||
|
packetReady.notifyObservers(packetno);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sendControl(XModem_Control_NAK);
|
||||||
|
isTransmitting = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isReceiving) {
|
||||||
|
// normal file data packet
|
||||||
|
if ((xmodemPacket.seq == packetno) &&
|
||||||
|
check(xmodemPacket.buffer.bytes, xmodemPacket.buffer.size, xmodemPacket.crc16)) {
|
||||||
|
// valid packet
|
||||||
|
file.write(xmodemPacket.buffer.bytes, xmodemPacket.buffer.size);
|
||||||
|
sendControl(XModem_Control_ACK);
|
||||||
|
packetno++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// invalid packet
|
||||||
|
sendControl(XModem_Control_NAK);
|
||||||
|
break;
|
||||||
|
} else if (isTransmitting) {
|
||||||
|
// just received something weird.
|
||||||
|
sendControl(XModem_Control_CAN);
|
||||||
|
isTransmitting = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case XModem_Control_EOT:
|
||||||
|
// End of transmission
|
||||||
|
sendControl(XModem_Control_ACK);
|
||||||
|
file.close();
|
||||||
|
isReceiving = false;
|
||||||
|
break;
|
||||||
|
case XModem_Control_CAN:
|
||||||
|
// Cancel transmission and remove file
|
||||||
|
sendControl(XModem_Control_ACK);
|
||||||
|
file.close();
|
||||||
|
FSCom.remove(filename);
|
||||||
|
isReceiving = false;
|
||||||
|
break;
|
||||||
|
case XModem_Control_ACK:
|
||||||
|
// Acknowledge Send the next packet
|
||||||
|
if (isTransmitting) {
|
||||||
|
if (isEOT) {
|
||||||
|
sendControl(XModem_Control_EOT);
|
||||||
|
file.close();
|
||||||
|
LOG_INFO("XModem: Finished sending file %s\n", filename);
|
||||||
|
isTransmitting = false;
|
||||||
|
isEOT = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
retrans = MAXRETRANS; // reset retransmit counter
|
||||||
|
packetno++;
|
||||||
|
memset(xmodemStore, 0, XModem_size);
|
||||||
|
xmodemStore->control = XModem_Control_SOH;
|
||||||
|
xmodemStore->seq = packetno;
|
||||||
|
xmodemStore->buffer.size = file.read(xmodemStore->buffer.bytes, sizeof(XModem_buffer_t::bytes));
|
||||||
|
xmodemStore->crc16 = crc16_ccitt(xmodemStore->buffer.bytes, xmodemStore->buffer.size);
|
||||||
|
LOG_DEBUG("XModem: ACK Notify Sending packet %d, %d Bytes.\n", packetno, xmodemStore->buffer.size);
|
||||||
|
if (xmodemStore->buffer.size < sizeof(XModem_buffer_t::bytes)) {
|
||||||
|
isEOT = true;
|
||||||
|
// send EOT on next Ack
|
||||||
|
}
|
||||||
|
packetReady.notifyObservers(packetno);
|
||||||
|
} else {
|
||||||
|
// just received something weird.
|
||||||
|
sendControl(XModem_Control_CAN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case XModem_Control_NAK:
|
||||||
|
// Negative acknowledge. Send the same buffer again
|
||||||
|
if (isTransmitting) {
|
||||||
|
if (--retrans <= 0) {
|
||||||
|
sendControl(XModem_Control_CAN);
|
||||||
|
file.close();
|
||||||
|
LOG_INFO("XModem: Retransmit timeout, cancelling file %s\n", filename);
|
||||||
|
isTransmitting = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
memset(xmodemStore, 0, XModem_size);
|
||||||
|
xmodemStore->control = XModem_Control_SOH;
|
||||||
|
xmodemStore->seq = packetno;
|
||||||
|
file.seek((packetno - 1) * sizeof(XModem_buffer_t::bytes));
|
||||||
|
xmodemStore->buffer.size = file.read(xmodemStore->buffer.bytes, sizeof(XModem_buffer_t::bytes));
|
||||||
|
xmodemStore->crc16 = crc16_ccitt(xmodemStore->buffer.bytes, xmodemStore->buffer.size);
|
||||||
|
LOG_DEBUG("XModem: NAK Notify Sending packet %d, %d Bytes.\n", packetno, xmodemStore->buffer.size);
|
||||||
|
if (xmodemStore->buffer.size < sizeof(XModem_buffer_t::bytes)) {
|
||||||
|
isEOT = true;
|
||||||
|
// send EOT on next Ack
|
||||||
|
}
|
||||||
|
packetReady.notifyObservers(packetno);
|
||||||
|
} else {
|
||||||
|
// just received something weird.
|
||||||
|
sendControl(XModem_Control_CAN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Unknown control character
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/***********************************************************************************************************************
|
||||||
|
* based on XMODEM implementation by Georges Menie (www.menie.org)
|
||||||
|
***********************************************************************************************************************
|
||||||
|
* Copyright 2001-2019 Georges Menie (www.menie.org)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Adapted for protobuf encapsulation. this is not really Xmodem any more.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the University of California, Berkeley nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
**********************************************************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "FSCommon.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
#include "mesh/generated/meshtastic/xmodem.pb.h"
|
||||||
|
|
||||||
|
#define MAXRETRANS 25
|
||||||
|
|
||||||
|
class XModemAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Called when we put a fragment in the outgoing memory
|
||||||
|
Observable<uint32_t> packetReady;
|
||||||
|
|
||||||
|
XModemAdapter();
|
||||||
|
|
||||||
|
void handlePacket(XModem xmodemPacket);
|
||||||
|
XModem *getForPhone();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isReceiving = false;
|
||||||
|
bool isTransmitting = false;
|
||||||
|
bool isEOT = false;
|
||||||
|
|
||||||
|
int retrans = MAXRETRANS;
|
||||||
|
|
||||||
|
uint16_t packetno = 0;
|
||||||
|
|
||||||
|
#ifdef ARCH_NRF52
|
||||||
|
File file = File(FSCom);
|
||||||
|
#else
|
||||||
|
File file;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char filename[sizeof(XModem_buffer_t::bytes)] = {0};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
XModem *xmodemStore = NULL;
|
||||||
|
unsigned short crc16_ccitt(const pb_byte_t *buffer, int length);
|
||||||
|
int check(const pb_byte_t *buf, int sz, unsigned short tcrc);
|
||||||
|
void sendControl(XModem_Control c);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern XModemAdapter xModem;
|
||||||
Reference in New Issue
Block a user