Merge pull request #742 from geeksville/portduino

wifi now works on portduino
1.2-legacy
Kevin Hester 2021-03-17 20:43:47 +08:00 zatwierdzone przez GitHub
commit 449a3959b0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
25 zmienionych plików z 2319 dodań i 30 usunięć

Wyświetl plik

@ -32,5 +32,5 @@ jobs:
- name: Build for lora-relay-v1
run: platformio run -e lora-relay-v1
# Turn off linux for now
#- name: Build for linux
# run: platformio run -e linux
name: Build for native
run: platformio run -e native

3
.gitignore vendored
Wyświetl plik

@ -15,7 +15,8 @@ Thumbs.db
.built
.context
.cproject
.idea/*
.vagrant
nanopb*
flash.uf2
cmake-build*

Wyświetl plik

@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<clangFormatSettings>
<option name="ENABLED" value="true" />
</clangFormatSettings>
</code_scheme>
</component>

Wyświetl plik

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

Wyświetl plik

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

4
.idea/misc.xml 100644
Wyświetl plik

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

Wyświetl plik

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/meshtastic-esp32.iml" filepath="$PROJECT_DIR$/.idea/meshtastic-esp32.iml" />
</modules>
</component>
</project>

9
.idea/vcs.xml 100644
Wyświetl plik

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/design" vcs="Git" />
<mapping directory="$PROJECT_DIR$/proto" vcs="Git" />
<mapping directory="$PROJECT_DIR$/sdk-nrfxlib" vcs="Git" />
</component>
</project>

137
.idea/workspace.xml 100644
Wyświetl plik

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true">
<generated>
<config projectName="meshtastic-esp32" targetName="Debug" />
<config projectName="meshtastic-esp32" targetName="Production" />
<config projectName="meshtastic-esp32" targetName="Z_DUMMY_TARGET" />
</generated>
</component>
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="native" CONFIG_NAME="native" ENABLED="true" />
</configurations>
</component>
<component name="ChangeListManager">
<list default="true" id="58922733-b05b-4b90-9655-b9b18914977a" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docs/software/TODO.md" beforeDir="false" afterPath="$PROJECT_DIR$/docs/software/TODO.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/proto" beforeDir="false" afterPath="$PROJECT_DIR$/proto" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/mesh/generated/mesh.pb.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/mesh/generated/mesh.pb.h" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:native" />
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1pmWHw2wau2TbdKvXvmQUB0EUE9" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="cf.advertisement.text.overridden" value="true" />
<property name="cf.first.check.clang-format" value="false" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.path.for.package.eslint" value="project" />
<property name="node.js.path.for.package.tslint" value="project" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="node.js.selected.package.tslint" value="(autodetect)" />
<property name="settings.editor.selected.configurable" value="CMakeSettings" />
</component>
<component name="RunManager" selected="PlatformIO.PlatformIO Upload">
<configuration default="true" type="CLion_Remote" version="1" remoteCommand="tcp:localhost:2345" symbolFile="" sysroot="">
<debugger kind="GDB" isBundled="true" />
<method v="2" />
</configuration>
<configuration name="gdbremote-localhost-2345" type="CLion_Remote" version="1" remoteCommand="tcp:localhost:2345" symbolFile="" sysroot="">
<debugger kind="GDB" isBundled="true" />
<method v="2" />
</configuration>
<configuration name="Z_DUMMY_TARGET" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="meshtastic-esp32" TARGET_NAME="Z_DUMMY_TARGET" CONFIG_NAME="native" RUN_TARGET_PROJECT_NAME="meshtastic-esp32" RUN_TARGET_NAME="Z_DUMMY_TARGET">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration default="true" type="GradleAppRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" PASS_PARENT_ENVS_2="true">
<method v="2">
<option name="com.jetbrains.cidr.cpp.gradle.execution.GradleNativeBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="PlatformIO Debug" type="platformio" factoryName="PlatformIO Debug" REDIRECT_INPUT="false" ELEVATE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="meshtastic-esp32" TARGET_NAME="Debug" CONFIG_NAME="native" RUN_TARGET_PROJECT_NAME="meshtastic-esp32" RUN_TARGET_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="PlatformIO Upload" type="platformio" factoryName="PlatformIO Upload" REDIRECT_INPUT="false" ELEVATE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="meshtastic-esp32" TARGET_NAME="Production" CONFIG_NAME="native" RUN_TARGET_PROJECT_NAME="meshtastic-esp32" RUN_TARGET_NAME="Production">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<list>
<item itemvalue="CMake Application.Z_DUMMY_TARGET" />
<item itemvalue="GDB Remote Debug.gdbremote-localhost-2345" />
<item itemvalue="PlatformIO.PlatformIO Debug" />
<item itemvalue="PlatformIO.PlatformIO Upload" />
</list>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="58922733-b05b-4b90-9655-b9b18914977a" name="Default Changelist" comment="" />
<created>1615788661896</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1615788661896</updated>
<workItem from="1615788663210" duration="6661000" />
<workItem from="1615938346019" duration="1208000" />
<workItem from="1615971126983" duration="5945000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
<url>file://$PROJECT_DIR$/src/mesh/StreamAPI.cpp</url>
<line>20</line>
<option name="timeStamp" value="4" />
</line-breakpoint>
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
<url>file://$PROJECT_DIR$/src/mesh/wifi/WiFiServerAPI.cpp</url>
<line>53</line>
<option name="timeStamp" value="6" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
<select />
</component>
</project>

Wyświetl plik

@ -69,6 +69,7 @@
"wifi"
],
"C_Cpp.dimInactiveRegions": true,
"cmake.configureOnOpen": true,
"protoc": {
"compile_on_save": false,
"compile_all_path": "/home/kevinh/development/meshtastic/meshtastic-esp32/proto",

36
CMakeLists.txt 100644
Wyświetl plik

@ -0,0 +1,36 @@
# !!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE
# https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
#
# If you need to override existing CMake configuration or add extra,
# please create `CMakeListsUser.txt` in the root of project.
# The `CMakeListsUser.txt` will not be overwritten by PlatformIO.
cmake_minimum_required(VERSION 3.13)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)
project("meshtastic-esp32" C CXX)
include(CMakeListsPrivate.txt)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeListsUser.txt)
include(CMakeListsUser.txt)
endif()
include_directories("$ENV{HOME}/.platformio/packages/framework-portduino")
include_directories("/usr/include")
add_custom_target(
Production ALL
COMMAND platformio -c clion run "$<$<NOT:$<CONFIG:All>>:-e${CMAKE_BUILD_TYPE}>"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(
Debug ALL
COMMAND platformio -c clion run --target debug "$<$<NOT:$<CONFIG:All>>:-e${CMAKE_BUILD_TYPE}>"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_executable(Z_DUMMY_TARGET ${SRC_LIST})

2041
CMakeListsPrivate.txt 100644

Plik diff jest za duży Load Diff

Wyświetl plik

@ -0,0 +1,3 @@
set -e
pio run --environment native
gdbserver --once localhost:2345 .pio/build/native/program

Wyświetl plik

@ -0,0 +1,3 @@
set -e
pio run --environment native
.pio/build/native/program

Wyświetl plik

@ -0,0 +1 @@
esptool.py --baud 921600 write_flash 0x10000 release/archive/firmware-tbeam-1.1.50.bin

11
bin/run-both.sh 100755
Wyświetl plik

@ -0,0 +1,11 @@
set -e
pio run
echo uploading to usb1
pio run --upload-port /dev/ttyUSB1 -t upload &
echo uploading to usb0
pio run --upload-port /dev/ttyUSB0 -t upload &
wait

Wyświetl plik

@ -4,6 +4,9 @@ You probably don't care about this section - skip to the next one.
## 1.2 cleanup & multichannel support:
* before next relase: test empty channel sets on android
* test link sharing on android
* DONE cleanup the external notification and serial plugins
* non ack version of stress test fails sometimes!
* timestamps on oled screen are wrong - don't seem to be updating based on message rx

Wyświetl plik

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = tbeam
;default_envs = tbeam
;default_envs = tbeam0.7
;default_envs = heltec
;default_envs = tlora-v1
@ -17,7 +17,7 @@ default_envs = tbeam
;default_envs = lora-relay-v1 # nrf board
;default_envs = eink
;default_envs = nrf52840dk-geeksville
;default_envs = linux # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
[common]
; common is not currently used
@ -355,19 +355,20 @@ lib_deps =
TFT_eSPI
; The Portduino based sim environment on top of linux
[env:linux]
platform = https://github.com/geeksville/platform-portduino.git
[env:native]
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
framework = arduino
board = linux_x86_64
board = native
lib_deps =
${arduino_base.lib_deps}
rweather/Crypto
; The GenieBlocks LORA prototype board
[env:genieblocks_lora]
extends = esp32_base
board = genieblocks_lora
build_flags =
${esp32_base.build_flags} -D GENIEBLOCKS
; note: @geeksville disabled because genieblocks_lora is not checked into the boards directory, please send in a PR to add it ;-)
;[env:genieblocks_lora]
;extends = esp32_base
;board = genieblocks_lora
;build_flags =
; ${esp32_base.build_flags} -D GENIEBLOCKS

2
proto

@ -1 +1 @@
Subproject commit e68763737e3345ebf12c4776c84d27d83e1e9e1a
Subproject commit 39bb8b26bbc107aae3586d5a5e11a06ea12680bc

Wyświetl plik

@ -32,6 +32,10 @@
#include "nimble/BluetoothUtil.h"
#endif
#ifdef PORTDUINO
#include "mesh/wifi/WiFiServerAPI.h"
#endif
#include "RF95Interface.h"
#include "SX1262Interface.h"
@ -539,6 +543,10 @@ void setup()
webServerThread = new WebServerThread();
#endif
#ifdef PORTDUINO
initApiServer();
#endif
// Start airtime logger thread.
airTime = new AirTime();

Wyświetl plik

@ -26,7 +26,8 @@ typedef enum _HardwareModel {
HardwareModel_PPR = 34,
HardwareModel_GENIEBLOCKS = 35,
HardwareModel_NRF52_UNKNOWN = 36,
HardwareModel_PORTDUINO = 37
HardwareModel_PORTDUINO = 37,
HardwareModel_ANDROID_SIM = 38
} HardwareModel;
typedef enum _Constants {
@ -193,8 +194,8 @@ typedef struct _ToRadio {
/* Helper constants for enums */
#define _HardwareModel_MIN HardwareModel_UNSET
#define _HardwareModel_MAX HardwareModel_PORTDUINO
#define _HardwareModel_ARRAYSIZE ((HardwareModel)(HardwareModel_PORTDUINO+1))
#define _HardwareModel_MAX HardwareModel_ANDROID_SIM
#define _HardwareModel_ARRAYSIZE ((HardwareModel)(HardwareModel_ANDROID_SIM+1))
#define _Constants_MIN Constants_Unused
#define _Constants_MAX Constants_DATA_PAYLOAD_LEN

Wyświetl plik

@ -14,8 +14,6 @@ static void WiFiEvent(WiFiEvent_t event);
// DNS Server for the Captive Portal
DNSServer dnsServer;
static WiFiServerPort *apiPort;
uint8_t wifiDisconnectReason = 0;
// Stores our hostname
@ -180,14 +178,7 @@ void initWifi(bool forceSoftAP)
DEBUG_MSG("Not using WIFI\n");
}
static void initApiServer()
{
// Start API server on port 4403
if (!apiPort) {
apiPort = new WiFiServerPort();
apiPort->init();
}
}
// Called by the Espressif SDK to
static void WiFiEvent(WiFiEvent_t event)

Wyświetl plik

@ -3,6 +3,17 @@
#include "configuration.h"
#include <Arduino.h>
static WiFiServerPort *apiPort;
void initApiServer()
{
// Start API server on port 4403
if (!apiPort) {
apiPort = new WiFiServerPort();
apiPort->init();
}
}
WiFiServerAPI::WiFiServerAPI(WiFiClient &_client) : StreamAPI(&client), client(_client)
{
DEBUG_MSG("Incoming wifi connection\n");
@ -50,7 +61,7 @@ WiFiServerPort::WiFiServerPort() : WiFiServer(MESHTASTIC_PORTNUM), concurrency::
void WiFiServerPort::init()
{
DEBUG_MSG("API server sistening on TCP port %d\n", MESHTASTIC_PORTNUM);
DEBUG_MSG("API server listening on TCP port %d\n", MESHTASTIC_PORTNUM);
begin();
}

Wyświetl plik

@ -48,3 +48,5 @@ class WiFiServerPort : public WiFiServer, private concurrency::OSThread
int32_t runOnce();
};
void initApiServer();

Wyświetl plik

@ -28,7 +28,7 @@ void getMacAddr(uint8_t *dmac)
void setBluetoothEnable(bool on)
{
notImplemented("setBluetoothEnable");
// not needed
}
void cpuDeepSleep(uint64_t msecs) {
@ -88,7 +88,10 @@ public:
*/
void portduinoSetup() {
printf("Setting up Meshtastic on Porduino...\n");
gpioBind(new R595PolledIrqPin());
// FIXME: disable while not testing with real hardware
// gpioBind(new R595PolledIrqPin());
// gpioBind((new SimGPIOPin(LORA_RESET, "LORA_RESET")));
// gpioBind((new SimGPIOPin(RF95_NSS, "RF95_NSS"))->setSilent());
}