Compare commits

...

44 Commits

Author SHA1 Message Date
Kevin Hester
451b085c13 update protos 2021-05-28 11:01:01 +08:00
Kevin Hester
3c4f3316c0 remove google play link (for now) 2021-05-28 10:11:58 +08:00
Kevin Hester
2f607d5a8c Merge pull request #812 from geeksville/dev
main Native build on OS-X (probably)
2021-05-26 10:42:31 +08:00
Kevin Hester
42f3154079 store elfs (for later debugging) in github artifacts 2021-05-26 10:21:26 +08:00
Kevin Hester
e7e09cb7ed fix wifistubs to not be on esp32 2021-05-26 10:20:44 +08:00
Kevin Hester
c6092ea520 Merge remote-tracking branch 'root/master' into dev
# Conflicts:
#	bin/build-all.sh
2021-05-26 10:10:57 +08:00
Kevin Hester
29ff778e22 fix #811 nodes rebooting due to invalid printf call, thanks @IZ1IVA
Ouch, this was nasty - printf format string wasn't matching the parameters
passed in causing a NPE due to a missing last param.

I'll investigate why printf format strings were
not being checked by the compiler (normally gcc offers that feature)
2021-05-26 10:00:23 +08:00
Sacha Weatherstone
d80814a12e Merge pull request #813 from michelepagot/master
Add device-install.bat and device-update.bat to the release package
2021-05-26 11:30:03 +10:00
Michele
cfeb0b47e9 Merge branch 'meshtastic:master' into master 2021-05-25 23:06:36 +02:00
michelepagot
6f14d017d8 add both device-install/update.bat to the release package 2021-05-25 22:54:04 +02:00
Kevin Hester
cf4e508fb3 1.2.38 2021-05-25 09:02:26 +08:00
Kevin Hester
96fc1f5272 use long versions for release names 2021-05-25 08:45:47 +08:00
Kevin Hester
5b65fd5754 force new revision names, incase we mess up builds 2021-05-25 08:33:14 +08:00
Kevin Hester
29587d4c4e 1.2.37 fix release script 2021-05-25 08:30:03 +08:00
Kevin Hester
a98bf80c24 fix release script 2021-05-25 08:30:03 +08:00
Kevin Hester
49869ca044 Merge pull request #810 from geeksville/dev
1.2.36
2021-05-25 08:05:11 +08:00
Kevin Hester
54d4fb7d46 1.2.36 2021-05-25 08:04:06 +08:00
Kevin Hester
5699abc8ad Merge remote-tracking branch 'mine/dev' into windev 2021-05-25 05:12:44 +08:00
Kevin Hester
6b56583023 copy windows install scripts into build dir 2021-05-25 11:18:36 +08:00
Kevin Hester
abe95ae1a4 most of the changes needed to build native on Windows 2021-05-25 05:08:57 +08:00
Kevin Hester
4e8e85c9f1 Merge branch 'master' of https://github.com/meshtastic/Meshtastic-device into windev
# Conflicts:
#	geeksville-private/windows-build-instructions.md
#	src/graphics/Screen.h
2021-05-25 03:43:47 +08:00
Kevin Hester
26bb4ffe79 windows build wip 2021-05-25 03:38:06 +08:00
Kevin Hester
c857e5707e Merge pull request #808 from geeksville/dev
fix wifi api bug
2021-05-24 10:01:11 +08:00
Kevin Hester
aaf1570938 Merge remote-tracking branch 'root/master' into dev 2021-05-24 09:43:45 +08:00
Kevin Hester
a8feb40ae9 cleanup 2021-05-24 09:42:25 +08:00
Kevin Hester
be410a3913 Fix #807 TCP API on ESP32. thanks @jfirwin your hint made the problem easy to find! 2021-05-24 09:42:21 +08:00
Kevin Hester
069b0d38be Fix wifi to allow usage with unsecured networks 2021-05-24 09:21:52 +08:00
Kevin Hester
7cae8dc50f Merge pull request #806 from geeksville/dev
back in the saddle
2021-05-23 18:22:30 +08:00
Kevin Hester
70b0a73572 Split native build into a cross-platform target vs a linux only target 2021-05-23 17:57:20 +08:00
Kevin Hester
72d7142751 also check in the gpiod .h file 2021-05-23 17:36:08 +08:00
Kevin Hester
8367b9b159 add gpiod lib prebuilt binaries for linux 2021-05-23 17:25:35 +08:00
Kevin Hester
ad1cbf60b4 Merge remote-tracking branch 'root/master' into dev 2021-05-23 17:05:47 +08:00
Kevin Hester
1c4bf8ac18 Merge pull request #805 from michelepagot/master
.bat porting of install and update scripts
2021-05-23 17:05:20 +08:00
Kevin Hester
13199f13c2 reeneable simulator in CI builds 2021-05-23 17:02:47 +08:00
Kevin Hester
7f2bbcd95e fix debug spam for api calls (possibly corrupting protocol) 2021-05-23 12:07:28 +08:00
Kevin Hester
68cb62ab23 auto probe for pinelora devices 2021-05-23 12:00:54 +08:00
Kevin Hester
5a3ff137f9 Cope with missing portuino hardware 2021-05-23 11:46:57 +08:00
michelepagot
0206e65152 fix device-install.bat about star usage 2021-05-23 02:33:15 +02:00
michelepagot
b16004dcdf .bat porting of install and update scripts 2021-05-23 01:46:31 +02:00
Kevin Hester
844189671f work queue TODO 2021-05-12 09:02:27 +08:00
Kevin Hester
e582615eda Merge pull request #800 from geeksville/pinelora
Pinelora
2021-05-11 10:59:04 +08:00
Kevin Hester
7f51517961 better support for heltec 2021-05-11 09:44:41 +08:00
Kevin Hester
2e832774a2 provide short versions to android 2021-05-09 10:57:12 +08:00
Kevin Hester
7475e3c105 give more margin for heltec no battery voltage 2021-05-09 10:31:42 +08:00
27 changed files with 280 additions and 91 deletions

View File

@@ -59,14 +59,14 @@ jobs:
pio upgrade pio upgrade
# 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 for tbeam # - name: Build for tbeam
# run: platformio run -e tbeam # run: platformio run -e tbeam
@@ -78,9 +78,16 @@ jobs:
- name: Build everything - name: Build everything
run: bin/build-all.sh run: bin/build-all.sh
- name: Store release zip as an artifact - name: Store binaries as an artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: built name: built
path: release/archive/firmware-*.zip path: release/archive/firmware-*.zip
retention-days: 30 retention-days: 30
- name: Store debugging elf files as an artifact
uses: actions/upload-artifact@v2
with:
name: debug-elfs
path: release/archive/elfs-*.zip
retention-days: 7

View File

@@ -49,7 +49,7 @@ jobs:
# Will be available in steps.version.outputs.version # Will be available in steps.version.outputs.version
- name: Get version string - name: Get version string
run: echo "::set-output name=version::$(./bin/buildinfo.py)" run: echo "::set-output name=version::$(./bin/buildinfo.py long)"
id: version id: version
- name: Build everything - name: Build everything
@@ -69,7 +69,7 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
- name: Add artifact to release - name: Add bins to release
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
@@ -78,3 +78,13 @@ jobs:
asset_path: release/archive/firmware-${{ steps.version.outputs.version }}.zip asset_path: release/archive/firmware-${{ steps.version.outputs.version }}.zip
asset_name: firmware-${{ steps.version.outputs.version }}.zip asset_name: firmware-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip asset_content_type: application/zip
- name: Add debug elfs to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release/archive/elfs-${{ steps.version.outputs.version }}.zip
asset_name: debug-elfs-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip

View File

@@ -187,7 +187,7 @@ Hard resetting via RTS pin...
# Meshtastic Android app # Meshtastic Android app
The companion (optional) Meshtastic Android app is [here](https://play.google.com/store/apps/details?id=com.geeksville.mesh&referrer=utm_source%3Dgithub-dev-readme). You can also download it on Google Play. The companion (optional, free, open-source) Meshtastic Android app is available on various appstores [see this page for details](https://github.com/meshtastic/Meshtastic-Android/blob/master/README.md).
# Python API # Python API

View File

@@ -2,13 +2,15 @@
set -e set -e
VERSION=`bin/buildinfo.py` VERSION=`bin/buildinfo.py long`
SHORT_VERSION=`bin/buildinfo.py short`
BOARDS_ESP32="tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec tbeam0.7" BOARDS_ESP32="tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v2.0 heltec-v2.1 tbeam0.7"
#BOARDS_ESP32=tbeam #BOARDS_ESP32=tbeam
# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine # FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine
BOARDS_NRF52="rak4631 t-echo" BOARDS_NRF52="rak4631 t-echo"
#BOARDS_NRF52=""
OUTDIR=release/latest OUTDIR=release/latest
@@ -91,11 +93,15 @@ Generated by bin/buildall.sh -->
<resources> <resources>
<string name="cur_firmware_version" translatable="false">$VERSION</string> <string name="cur_firmware_version" translatable="false">$VERSION</string>
<string name="short_firmware_version" translatable="false">$SHORT_VERSION</string>
</resources> </resources>
XML XML
echo Generating $ARCHIVEDIR/firmware-$VERSION.zip echo Generating $ARCHIVEDIR/firmware-$VERSION.zip
rm -f $ARCHIVEDIR/firmware-$VERSION.zip rm -f $ARCHIVEDIR/firmware-$VERSION.zip
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $ARCHIVEDIR/spiffs-$VERSION.bin $OUTDIR/bins/universal/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh bin/device-update.sh zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $ARCHIVEDIR/spiffs-$VERSION.bin $OUTDIR/bins/universal/firmware-*-$VERSION.* images/system-info.bin bin/device-install.* bin/device-update.*
echo Generating $ARCHIVEDIR/elfs-$VERSION.zip
rm -f $ARCHIVEDIR/elfs-$VERSION.zip
zip --junk-paths $ARCHIVEDIR/elfs-$VERSION.zip $OUTDIR/elfs/universal/firmware-*-$VERSION.*
echo BUILT ALL echo BUILT ALL

View File

@@ -1,7 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import configparser import configparser
import sys
from readprops import readProps from readprops import readProps
verObj = readProps('version.properties') verObj = readProps('version.properties')
print(f"{verObj['long']}") propName = sys.argv[1]
print(f"{verObj[propName]}")

42
bin/device-install.bat Normal file
View File

@@ -0,0 +1,42 @@
@ECHO OFF
set PYTHON=python
goto GETOPTS
:HELP
echo Usage: %~nx0 [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME^|FILENAME]
echo Flash image file to device, but first erasing and writing system information
echo.
echo -h Display this help and exit
echo -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous).
echo -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: %PYTHON%)
echo -f FILENAME The .bin file to flash. Custom to your device type and region.
goto EOF
:GETOPTS
if /I "%1"=="-h" goto HELP
if /I "%1"=="--help" goto HELP
if /I "%1"=="-F" set "FILENAME=%2" & SHIFT
if /I "%1"=="-p" set ESPTOOL_PORT=%2 & SHIFT
if /I "%1"=="-P" set PYTHON=%2 & SHIFT
SHIFT
IF NOT "__%1__"=="____" goto GETOPTS
IF "__%FILENAME%__" == "____" (
echo "Missing FILENAME"
goto HELP
)
IF EXIST %FILENAME% (
echo Trying to flash update %FILENAME%, but first erasing and writing system information"
%PYTHON% -m esptool --baud 921600 erase_flash
%PYTHON% -m esptool --baud 921600 write_flash 0x1000 system-info.bin
for %%f in (spiffs-*.bin) do (
%PYTHON% -m esptool --baud 921600 write_flash 0x00390000 %%f
)
%PYTHON% -m esptool --baud 921600 write_flash 0x10000 %FILENAME%
) else (
echo "Invalid file: %FILENAME%"
goto HELP
)
:EOF

39
bin/device-update.bat Normal file
View File

@@ -0,0 +1,39 @@
@ECHO OFF
set PYTHON=python
goto GETOPTS
:HELP
echo Usage: %~nx0 [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME^|FILENAME]
echo Flash image file to device, leave existing system intact.
echo.
echo -h Display this help and exit
echo -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous).
echo -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: %PYTHON%)
echo -f FILENAME The .bin file to flash. Custom to your device type and region.
goto EOF
:GETOPTS
if /I "%1"=="-h" goto HELP
if /I "%1"=="--help" goto HELP
if /I "%1"=="-F" set "FILENAME=%2" & SHIFT
if /I "%1"=="-p" set ESPTOOL_PORT=%2 & SHIFT
if /I "%1"=="-P" set PYTHON=%2 & SHIFT
SHIFT
IF NOT "__%1__"=="____" goto GETOPTS
IF "__%FILENAME%__" == "____" (
echo "Missing FILENAME"
goto HELP
)
IF EXIST %FILENAME% (
echo Trying to flash update %FILENAME%
%PYTHON% -m esptool --baud 921600 write_flash 0x10000 %FILENAME%
echo Erasing the otadata partition, which will turn off flash flippy-flop and force the first image to be used
%PYTHON% -m esptool --baud 921600 erase_region 0xe000 0x2000
) else (
echo "Invalid file: %FILENAME%"
goto HELP
)
:EOF

View File

@@ -1,6 +1,8 @@
set -e
echo "This script is only for developers who are publishing new builds on github. Most users don't need it" echo "This script is only for developers who are publishing new builds on github. Most users don't need it"
VERSION=`bin/buildinfo.py` VERSION=`bin/buildinfo.py long`
# Must have a V prefix to trigger github # Must have a V prefix to trigger github
git tag "v${VERSION}" git tag "v${VERSION}"

9
bin/test-simulator.sh Executable file
View File

@@ -0,0 +1,9 @@
set -e
echo "Starting simulator"
.pio/build/native/program &
sleep 20 # 5 seconds was not enough
echo "Simulator started, launching python test..."
python3 -c 'from meshtastic.test import testSimulator; testSimulator()'

View File

@@ -2,23 +2,22 @@
You probably don't care about this section - skip to the next one. You probably don't care about this section - skip to the next one.
## before next release * list portduino on platformio
* router mode dropping messages? https://meshtastic.discourse.group/t/router-mode-missing-messages/3329/3
* turn on setTx(timeout) and state = setDioIrqParams(SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT, SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT); in sx1262 code * fix ttgo eink screen
* figure our wss for mqtt.meshtastic - use cloudflare? 2052 ws, 2053 crypt
* measure rak4630 power draw and turn off power for GPS most of the time. We should be able to run on the small solar panel.
* pine64 lora module * pine64 lora module
* nrf52 USB is unreliable while sleeping?
* @havealoha fixedposition not working * @havealoha fixedposition not working
* merge https://meshtastic.discourse.group/t/spanish-translation-update/2986/5
* @luxonn reports that after a while the android app stops showing new messages
* nrf52 shows as "sleeping" in android app? (but led is blinking)
* ask for vercel access * ask for vercel access
* fix heltec battery scaling * finish plan for riot.im
* check android 1.2.20 usage, possibly release to general * turn on setTx(timeout) and state = setDioIrqParams(SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT, SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT); in sx1262 code
* release android APK
* add rak4600 support (with rf95 radio and limited ram) * add rak4600 support (with rf95 radio and limited ram)
* store esp32 crashes to flash (and 64KB coredump partition) - https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/core_dump.html
*
* Switch to use https://github.com/adafruit/Adafruit_nRF52_Arduino.git when available (see arduino code for examples) * Switch to use https://github.com/adafruit/Adafruit_nRF52_Arduino.git when available (see arduino code for examples)
* DONE @luxonn reports that after a while the android app stops showing new messages
* DONE release android APK - fix recent 1.2.28 crash report
* DONE remote admin busted? * DONE remote admin busted?
* DONE check android code - @havealoha comments about odd sleep behavior * DONE check android code - @havealoha comments about odd sleep behavior
* ABANDONED test github actions locally on linux * ABANDONED test github actions locally on linux

View File

@@ -0,0 +1,7 @@
* install python
* install git (including git-bash)
* install platformio
* install vscode
* install https://sourceforge.net/projects/mingw-w64/ (for windows gcc/g++) - you'll need to add the bin directory to your PATH

View File

@@ -11,7 +11,7 @@
[platformio] [platformio]
default_envs = tbeam default_envs = tbeam
;default_envs = tbeam0.7 ;default_envs = tbeam0.7
;default_envs = heltec ;default_envs = heltec-v2.0
;default_envs = tlora-v1 ;default_envs = tlora-v1
;default_envs = tlora_v1_3 ;default_envs = tlora_v1_3
;default_envs = tlora-v2 ;default_envs = tlora-v2
@@ -151,10 +151,19 @@ board = ttgo-t-beam
build_flags = build_flags =
${esp32_base.build_flags} -D TBEAM_V07 ${esp32_base.build_flags} -D TBEAM_V07
[env:heltec] [env:heltec-v2.0]
;build_type = debug ; to make it possible to step through our jtag debugger ;build_type = debug ; to make it possible to step through our jtag debugger
extends = esp32_base extends = esp32_base
board = heltec_wifi_lora_32_V2 board = heltec_wifi_lora_32_V2
build_flags =
${esp32_base.build_flags} -D HELTEC_V2_0
[env:heltec-v2.1]
;build_type = debug ; to make it possible to step through our jtag debugger
extends = esp32_base
board = heltec_wifi_lora_32_V2
build_flags =
${esp32_base.build_flags} -D HELTEC_V2_1
[env:tlora-v1] [env:tlora-v1]
extends = esp32_base extends = esp32_base
@@ -184,13 +193,13 @@ build_flags =
; The Heltec Cubecell plus ; The Heltec Cubecell plus
; IMPORTANT NOTE: This target doesn't yet work and probably won't ever work. I'm keeping it around for now. ; IMPORTANT NOTE: This target doesn't yet work and probably won't ever work. I'm keeping it around for now.
; For more details see my post in the forum. ; For more details see my post in the forum.
[env:cubecellplus] ;[env:cubecellplus]
platform = https://github.com/HelTecAutomation/platform-asrmicro650x.git ; we use top-of-tree because stable version has too many bugs - asrmicro650x ;platform = https://github.com/HelTecAutomation/platform-asrmicro650x.git ; we use top-of-tree because stable version has too many bugs - asrmicro650x
board = cubecell_board_plus ;board = cubecell_board_plus
; FIXME, bug in cubecell arduino - they are supposed to set ARDUINO ; FIXME, bug in cubecell arduino - they are supposed to set ARDUINO
build_flags = ${arduino_base.build_flags} -DARDUINO=100 -Isrc/cubecell ;build_flags = ${arduino_base.build_flags} -DARDUINO=100 -Isrc/cubecell
src_filter = ;src_filter =
${arduino_base.src_filter} -<esp32/> -<nrf52/> ; ${arduino_base.src_filter} -<esp32/> -<nrf52/>
; Common settings for NRF52 based targets ; Common settings for NRF52 based targets
[nrf52_base] [nrf52_base]
@@ -312,6 +321,7 @@ debug_tool = jlink
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
;upload_protocol = jlink ;upload_protocol = jlink
; Note, this board is not yet supported! It will not work without futher development.
; THIS IS UNTESTED (I don't have this board), but other developers can use it as a starting point ; THIS IS UNTESTED (I don't have this board), but other developers can use it as a starting point
[env:rak4600] [env:rak4600]
extends = nrf52_base extends = nrf52_base
@@ -415,13 +425,24 @@ lib_deps =
SparkFun BQ27441 LiPo Fuel Gauge Arduino Library SparkFun BQ27441 LiPo Fuel Gauge Arduino Library
TFT_eSPI TFT_eSPI
; The Portduino based sim environment on top of linux ; The Portduino based sim environment on top of any host OS, all hardware will be simulated
[env:native] [env:native]
platform = https://github.com/geeksville/platform-native.git platform = https://github.com/geeksville/platform-native.git
src_filter = ${env.src_filter} -<esp32/> -<nimble/> -<nrf52/> -<mesh/http/> -<plugins/esp32> src_filter = ${env.src_filter} -<esp32/> -<nimble/> -<nrf52/> -<mesh/http/> -<plugins/esp32>
build_flags = ${arduino_base.build_flags} -O0
framework = arduino
board = cross_platform
lib_deps =
${arduino_base.lib_deps}
rweather/Crypto
; The Portduino based sim environment on top of a linux OS and touching linux hardware devices
[env:linux]
platform = https://github.com/geeksville/platform-native.git
src_filter = ${env.src_filter} -<esp32/> -<nimble/> -<nrf52/> -<mesh/http/> -<plugins/esp32>
build_flags = ${arduino_base.build_flags} -O0 -lgpiod build_flags = ${arduino_base.build_flags} -O0 -lgpiod
framework = arduino framework = arduino
board = native board = linux_hardware
lib_deps = lib_deps =
${arduino_base.lib_deps} ${arduino_base.lib_deps}
rweather/Crypto rweather/Crypto

2
proto

Submodule proto updated: 5be5307c90...f5b3d0643b

View File

@@ -102,7 +102,8 @@ class AnalogBatteryLevel : public HasBatteryLevel
last_read_time_ms = millis(); last_read_time_ms = millis();
uint32_t raw = analogRead(BATTERY_PIN); uint32_t raw = analogRead(BATTERY_PIN);
float scaled = 1000.0 * ADC_MULTIPLIER * (AREF_VOLTAGE / 1024.0) * raw; float scaled = 1000.0 * ADC_MULTIPLIER * (AREF_VOLTAGE / 1024.0) * raw;
// DEBUG_MSG("raw val=%u scaled=%u\n", raw, (uint32_t)(scaled));
// DEBUG_MSG("battery gpio %d raw val=%u scaled=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled));
last_read_value = scaled; last_read_value = scaled;
return scaled; return scaled;
} else { } else {
@@ -129,7 +130,9 @@ class AnalogBatteryLevel : public HasBatteryLevel
private: private:
/// If we see a battery voltage higher than physics allows - assume charger is pumping /// If we see a battery voltage higher than physics allows - assume charger is pumping
/// in power /// in power
const float fullVolt = 4200, emptyVolt = 3270, chargingVolt = 4210, noBatVolt = 2100;
/// For heltecs with no battery connected, the measured voltage is 2204, so raising to 2230 from 2100
const float fullVolt = 4200, emptyVolt = 3270, chargingVolt = 4210, noBatVolt = 2230;
float last_read_value = 0.0; float last_read_value = 0.0;
uint32_t last_read_time_ms = 0; uint32_t last_read_time_ms = 0;
} analogLevel; } analogLevel;
@@ -139,7 +142,7 @@ Power::Power() : OSThread("Power") {}
bool Power::analogInit() bool Power::analogInit()
{ {
#ifdef BATTERY_PIN #ifdef BATTERY_PIN
DEBUG_MSG("Using analog input for battery level\n"); DEBUG_MSG("Using analog input %d for battery level\n", BATTERY_PIN);
// disable any internal pullups // disable any internal pullups
pinMode(BATTERY_PIN, INPUT); pinMode(BATTERY_PIN, INPUT);

View File

@@ -5,6 +5,7 @@
#include <assert.h> #include <assert.h>
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>
#include <cstring>
/** /**
* A printer that doesn't go anywhere * A printer that doesn't go anywhere

View File

@@ -227,8 +227,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define GPS_TX_PIN 15 #define GPS_TX_PIN 15
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2) #elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2)
// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR HardwareModel_HELTEC
// the default ESP32 Pin of 15 is the Oled SCL, set to 36 and 37 and works fine. // the default ESP32 Pin of 15 is the Oled SCL, set to 36 and 37 and works fine.
// Tested on Neo6m module. // Tested on Neo6m module.
@@ -256,6 +254,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define LORA_DIO1 35 // Not really used #define LORA_DIO1 35 // Not really used
#define LORA_DIO2 34 // Not really used #define LORA_DIO2 34 // Not really used
// ratio of voltage divider = 3.20 (R1=100k, R2=220k)
#define ADC_MULTIPLIER 3.2
#ifdef HELTEC_V2_0
// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR HardwareModel_HELTEC_V2_0
#define BATTERY_PIN 13 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#endif
#ifdef HELTEC_V2_1
// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR HardwareModel_HELTEC_V2_1
#define BATTERY_PIN 37 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#endif
#elif defined(TLORA_V1) #elif defined(TLORA_V1)
// This string must exactly match the case used in release file names or the android updater won't work // This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR HardwareModel_TLORA_V1 #define HW_VENDOR HardwareModel_TLORA_V1

View File

@@ -4,8 +4,6 @@
#include <queue> #include <queue>
#include <unordered_set> #include <unordered_set>
using namespace std;
/// We clear our old flood record five minute after we see the last of it /// We clear our old flood record five minute after we see the last of it
#define FLOOD_EXPIRE_TIME (5 * 60 * 1000L) #define FLOOD_EXPIRE_TIME (5 * 60 * 1000L)
@@ -23,7 +21,7 @@ struct PacketRecord {
class PacketRecordHashFunction class PacketRecordHashFunction
{ {
public: public:
size_t operator()(const PacketRecord &p) const { return (hash<NodeNum>()(p.sender)) ^ (hash<PacketId>()(p.id)); } size_t operator()(const PacketRecord &p) const { return (std::hash<NodeNum>()(p.sender)) ^ (std::hash<PacketId>()(p.id)); }
}; };
/// Order packet records by arrival time, we want the oldest packets to be in the front of our heap /// Order packet records by arrival time, we want the oldest packets to be in the front of our heap
@@ -54,7 +52,7 @@ class PacketHistory
/** FIXME: really should be a std::unordered_set with the key being sender,id. /** FIXME: really should be a std::unordered_set with the key being sender,id.
* This would make checking packets in wasSeenRecently faster. * This would make checking packets in wasSeenRecently faster.
*/ */
vector<PacketRecord> recentPackets; std::vector<PacketRecord> recentPackets;
// priority_queue<PacketRecord, vector<PacketRecord>, PacketRecordOrderFunction> arrivalTimes; // priority_queue<PacketRecord, vector<PacketRecord>, PacketRecordOrderFunction> arrivalTimes;
// unordered_set<PacketRecord, PacketRecordHashFunction> recentPackets; // unordered_set<PacketRecord, PacketRecordHashFunction> recentPackets;

View File

@@ -51,7 +51,7 @@ struct PendingPacket {
class GlobalPacketIdHashFunction class GlobalPacketIdHashFunction
{ {
public: public:
size_t operator()(const GlobalPacketId &p) const { return (hash<NodeNum>()(p.node)) ^ (hash<PacketId>()(p.id)); } size_t operator()(const GlobalPacketId &p) const { return (std::hash<NodeNum>()(p.node)) ^ (std::hash<PacketId>()(p.id)); }
}; };
/** /**
@@ -60,7 +60,7 @@ class GlobalPacketIdHashFunction
class ReliableRouter : public FloodingRouter class ReliableRouter : public FloodingRouter
{ {
private: private:
unordered_map<GlobalPacketId, PendingPacket, GlobalPacketIdHashFunction> pending; std::unordered_map<GlobalPacketId, PendingPacket, GlobalPacketIdHashFunction> pending;
public: public:
/** /**

View File

@@ -45,7 +45,7 @@ int32_t StreamAPI::readStream()
} else if (ptr >= HEADER_LEN - 1) { // we have at least read our 4 byte framing } else if (ptr >= HEADER_LEN - 1) { // we have at least read our 4 byte framing
uint32_t len = (rxBuf[2] << 8) + rxBuf[3]; // big endian 16 bit length follows framing uint32_t len = (rxBuf[2] << 8) + rxBuf[3]; // big endian 16 bit length follows framing
console->printf("len %d\n", len); // console->printf("len %d\n", len);
if (ptr == HEADER_LEN - 1) { if (ptr == HEADER_LEN - 1) {
// we _just_ finished our 4 byte header, validate length now (note: a length of zero is a valid // we _just_ finished our 4 byte header, validate length now (note: a length of zero is a valid

View File

@@ -17,11 +17,12 @@ typedef enum _HardwareModel {
HardwareModel_TLORA_V1 = 2, HardwareModel_TLORA_V1 = 2,
HardwareModel_TLORA_V2_1_1p6 = 3, HardwareModel_TLORA_V2_1_1p6 = 3,
HardwareModel_TBEAM = 4, HardwareModel_TBEAM = 4,
HardwareModel_HELTEC = 5, HardwareModel_HELTEC_V2_0 = 5,
HardwareModel_TBEAM0p7 = 6, HardwareModel_TBEAM0p7 = 6,
HardwareModel_T_ECHO = 7, HardwareModel_T_ECHO = 7,
HardwareModel_TLORA_V1_1p3 = 8, HardwareModel_TLORA_V1_1p3 = 8,
HardwareModel_RAK4631 = 9, HardwareModel_RAK4631 = 9,
HardwareModel_HELTEC_V2_1 = 10,
HardwareModel_LORA_RELAY_V1 = 32, HardwareModel_LORA_RELAY_V1 = 32,
HardwareModel_NRF52840DK = 33, HardwareModel_NRF52840DK = 33,
HardwareModel_PPR = 34, HardwareModel_PPR = 34,
@@ -33,7 +34,7 @@ typedef enum _HardwareModel {
typedef enum _Constants { typedef enum _Constants {
Constants_Unused = 0, Constants_Unused = 0,
Constants_DATA_PAYLOAD_LEN = 240 Constants_DATA_PAYLOAD_LEN = 237
} Constants; } Constants;
typedef enum _CriticalErrorCode { typedef enum _CriticalErrorCode {

View File

@@ -32,11 +32,10 @@ bool isWifiAvailable()
{ {
// If wifi status is connected, return true regardless of the radio configuration. // If wifi status is connected, return true regardless of the radio configuration.
if (isSoftAPForced()) { if (isSoftAPForced()) {
return 1; return true;
} }
const char *wifiName = radioConfig.preferences.wifi_ssid; const char *wifiName = radioConfig.preferences.wifi_ssid;
const char *wifiPsw = radioConfig.preferences.wifi_password;
// strcpy(radioConfig.preferences.wifi_ssid, "meshtastic"); // strcpy(radioConfig.preferences.wifi_ssid, "meshtastic");
// strcpy(radioConfig.preferences.wifi_password, "meshtastic!"); // strcpy(radioConfig.preferences.wifi_password, "meshtastic!");
@@ -47,10 +46,10 @@ bool isWifiAvailable()
// radioConfig.preferences.wifi_ap_mode = true; // radioConfig.preferences.wifi_ap_mode = true;
// radioConfig.preferences.wifi_ap_mode = false; // radioConfig.preferences.wifi_ap_mode = false;
if (*wifiName && *wifiPsw) { if (*wifiName) {
return 1; return true;
} else { } else {
return 0; return false;
} }
} }
@@ -96,7 +95,10 @@ void initWifi(bool forceSoftAP)
const char *wifiName = radioConfig.preferences.wifi_ssid; const char *wifiName = radioConfig.preferences.wifi_ssid;
const char *wifiPsw = radioConfig.preferences.wifi_password; const char *wifiPsw = radioConfig.preferences.wifi_password;
if ((*wifiName && *wifiPsw) || forceSoftAP) { if (!*wifiPsw) // Treat empty password as no password
wifiPsw = NULL;
if (*wifiName || forceSoftAP) {
if (forceSoftAP) { if (forceSoftAP) {
DEBUG_MSG("Forcing SoftAP\n"); DEBUG_MSG("Forcing SoftAP\n");
@@ -178,8 +180,6 @@ void initWifi(bool forceSoftAP)
DEBUG_MSG("Not using WIFI\n"); DEBUG_MSG("Not using WIFI\n");
} }
// Called by the Espressif SDK to // Called by the Espressif SDK to
static void WiFiEvent(WiFiEvent_t event) static void WiFiEvent(WiFiEvent_t event)
{ {
@@ -304,12 +304,15 @@ void handleDNSResponse()
void reconnectWiFi() void reconnectWiFi()
{ {
const char *wifiName = radioConfig.preferences.wifi_ssid;
const char *wifiPsw = radioConfig.preferences.wifi_password;
if (radioConfig.has_preferences) { if (radioConfig.has_preferences) {
if (*wifiName && *wifiPsw) { const char *wifiName = radioConfig.preferences.wifi_ssid;
const char *wifiPsw = radioConfig.preferences.wifi_password;
if (!*wifiPsw) // Treat empty password as no password
wifiPsw = NULL;
if (*wifiName) {
DEBUG_MSG("... Reconnecting to WiFi access point"); DEBUG_MSG("... Reconnecting to WiFi access point");

View File

@@ -18,7 +18,7 @@ size_t pb_encode_to_bytes(uint8_t *destbuf, size_t destbufsize, const pb_msgdesc
pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize); pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize);
if (!pb_encode(&stream, fields, src_struct)) { if (!pb_encode(&stream, fields, src_struct)) {
DEBUG_MSG("Panic: can't encode protobuf reason='%s', reason=%s\n", PB_GET_ERROR(&stream)); DEBUG_MSG("Panic: can't encode protobuf reason='%s'\n", PB_GET_ERROR(&stream));
assert(0); // If this asser fails it probably means you made a field too large for the max limits specified in mesh.options assert(0); // If this asser fails it probably means you made a field too large for the max limits specified in mesh.options
} else { } else {
return stream.bytes_written; return stream.bytes_written;
@@ -30,7 +30,7 @@ bool pb_decode_from_bytes(const uint8_t *srcbuf, size_t srcbufsize, const pb_msg
{ {
pb_istream_t stream = pb_istream_from_buffer(srcbuf, srcbufsize); pb_istream_t stream = pb_istream_from_buffer(srcbuf, srcbufsize);
if (!pb_decode(&stream, fields, dest_struct)) { if (!pb_decode(&stream, fields, dest_struct)) {
DEBUG_MSG("Error: can't decode protobuf reason='%s', pb_msgdesc 0x%p, reason=%s\n", PB_GET_ERROR(&stream), fields); DEBUG_MSG("Error: can't decode protobuf reason='%s', pb_msgdesc 0x%p\n", PB_GET_ERROR(&stream), fields);
return false; return false;
} else { } else {
return true; return true;

View File

@@ -22,6 +22,9 @@ class WiFiServerAPI : public StreamAPI
protected: protected:
/// We override this method to prevent publishing EVENT_SERIAL_CONNECTED/DISCONNECTED for wifi links (we want the board to stay in the POWERED state to prevent disabling wifi)
virtual void onConnectionChanged(bool connected) {}
virtual int32_t runOnce(); // Check for dropped client connections virtual int32_t runOnce(); // Check for dropped client connections
/// Check the current underlying physical link to see if the client is currently connected /// Check the current underlying physical link to see if the client is currently connected

View File

@@ -1,5 +1,6 @@
#include "CryptoEngine.h" #include "CryptoEngine.h"
#include "PortduinoGPIO.h" #include "PortduinoGPIO.h"
#include "SPIChip.h"
#include "mesh/RF95Interface.h" #include "mesh/RF95Interface.h"
#include "sleep.h" #include "sleep.h"
#include "target_specific.h" #include "target_specific.h"
@@ -48,7 +49,7 @@ class PolledIrqPin : public GPIOPin
} }
}; };
GPIOPin *loraIrq; static GPIOPin *loraIrq;
/** apps run under portduino can optionally define a portduinoSetup() to /** apps run under portduino can optionally define a portduinoSetup() to
* use portduino specific init code (such as gpioBind) to setup portduino on their host machine, * use portduino specific init code (such as gpioBind) to setup portduino on their host machine,
@@ -58,26 +59,45 @@ void portduinoSetup()
{ {
printf("Setting up Meshtastic on Porduino...\n"); printf("Setting up Meshtastic on Porduino...\n");
// FIXME: remove this hack once interrupts are confirmed to work on new pine64 board #ifdef PORTDUINO_LINUX_HARDWARE
// loraIrq = new PolledIrqPin(); SPI.begin(); // We need to create SPI
loraIrq = new LinuxGPIOPin(LORA_DIO1, "ch341", "int", "loraIrq"); // or "err"? bool usePineLora = !spiChip->isSimulated();
loraIrq->setSilent(); if(usePineLora) {
gpioBind(loraIrq); printf("Connecting to PineLora board...\n");
// BUSY hw was busted on current board - just use the simulated pin (which will read low) // FIXME: remove this hack once interrupts are confirmed to work on new pine64 board
auto busy = new LinuxGPIOPin(SX1262_BUSY, "ch341", "slct", "loraBusy"); // loraIrq = new PolledIrqPin();
busy->setSilent(); loraIrq = new LinuxGPIOPin(LORA_DIO1, "ch341", "int", "loraIrq"); // or "err"?
gpioBind(busy); loraIrq->setSilent();
//auto fakeBusy = new SimGPIOPin(SX1262_BUSY, "fakeBusy"); gpioBind(loraIrq);
//fakeBusy->writePin(LOW);
//fakeBusy->setSilent(true);
//gpioBind(fakeBusy);
gpioBind(new LinuxGPIOPin(SX1262_RESET, "ch341", "ini", "loraReset")); // BUSY hw was busted on current board - just use the simulated pin (which will read low)
auto busy = new LinuxGPIOPin(SX1262_BUSY, "ch341", "slct", "loraBusy");
busy->setSilent();
gpioBind(busy);
auto loraCs = new LinuxGPIOPin(SX1262_CS, "ch341", "cs0", "loraCs"); gpioBind(new LinuxGPIOPin(SX1262_RESET, "ch341", "ini", "loraReset"));
loraCs->setSilent();
gpioBind(loraCs); auto loraCs = new LinuxGPIOPin(SX1262_CS, "ch341", "cs0", "loraCs");
loraCs->setSilent();
gpioBind(loraCs);
}
else
#endif
{
auto fakeBusy = new SimGPIOPin(SX1262_BUSY, "fakeBusy");
fakeBusy->writePin(LOW);
fakeBusy->setSilent(true);
gpioBind(fakeBusy);
auto cs = new SimGPIOPin(SX1262_CS, "fakeLoraCS");
cs->setSilent(true);
gpioBind(cs);
gpioBind(new SimGPIOPin(SX1262_RESET, "fakeLoraReset"));
gpioBind(new SimGPIOPin(LORA_DIO1, "fakeLoraIrq"));
}
// gpioBind((new SimGPIOPin(LORA_RESET, "LORA_RESET"))); // gpioBind((new SimGPIOPin(LORA_RESET, "LORA_RESET")));
// gpioBind((new SimGPIOPin(RF95_NSS, "RF95_NSS"))->setSilent()); // gpioBind((new SimGPIOPin(RF95_NSS, "RF95_NSS"))->setSilent());

View File

@@ -1 +0,0 @@
../nrf52/wifi-stubs.cpp

View File

@@ -1,7 +1,7 @@
//#include "mesh/wifi/WebServer.h" //#include "mesh/wifi/WebServer.h"
#include "configuration.h" #include "configuration.h"
#ifndef NO_ESP32 #ifdef NO_ESP32
//#include "mesh/wifi/WiFiAPClient.h" //#include "mesh/wifi/WiFiAPClient.h"

View File

@@ -1,4 +1,4 @@
[VERSION] [VERSION]
major = 1 major = 1
minor = 2 minor = 2
build = 30 build = 38