Compare commits

...

23 Commits

Author SHA1 Message Date
Kevin Hester
e5db458c6c fix release script 2021-05-25 08:06:59 +08:00
Kevin Hester
54d4fb7d46 1.2.36 2021-05-25 08:04:06 +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
18 changed files with 239 additions and 73 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

View File

@@ -2,9 +2,10 @@
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
@@ -91,6 +92,7 @@ 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

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 short`
# 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,25 @@
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 * DONE investigate TCP on ESP32 https://github.com/meshtastic/Meshtastic-device/issues/807
* DONE fix python tool problem with windows and the heartbeat
* turn on setTx(timeout) and state = setDioIrqParams(SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT, SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT); in sx1262 code * router mode dropping messages? https://meshtastic.discourse.group/t/router-mode-missing-messages/3329/3
* fix ttgo eink screen
* list portduino on platformio
* DONE make native sim not touch hardware
* DONE reenable sim in CI builds
* figure our wss for mqtt.meshtastic - use cloudflare? 2052 ws, 2053 crypt
* 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 * DONE fix this sleep problem: https://meshtastic.discourse.group/t/new-device-release-1-2-30-ready-for-alpha-testing/3272/13?u=geeksville
* add rak4600 support (with rf95 radio and limited ram) * add rak4600 support (with rf95 radio and limited ram)
* 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

@@ -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 -lgpiod build_flags = ${arduino_base.build_flags} -O0
framework = arduino framework = arduino
board = native 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
framework = arduino
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...dfcfba8d1a

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

@@ -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

@@ -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,

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

@@ -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,4 +1,4 @@
[VERSION] [VERSION]
major = 1 major = 1
minor = 2 minor = 2
build = 30 build = 36