Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
ccf8904
Add workaround to build on VS/Pio (Windows)
Xelack Jul 6, 2021
92669f3
Add ESP32 target
OpenDevelopper Jul 11, 2021
f5437e5
Optimise ESP32 CPUs power consumption
OpenDevelopper Jul 12, 2021
24e5322
Revert "Optimise ESP32 CPUs power consumption"
OpenDevelopper Jul 12, 2021
1924ff3
Optimise ESP32 CPUs power consumption
OpenDevelopper Jul 12, 2021
ec9b464
Fix a bug on mavlink msg parsing
OpenDevelopper Jul 12, 2021
e1d140e
Change default SSID
OpenDevelopper Jul 12, 2021
416b9be
Fix backup bug on reboot cmd (via QGroundStation)
OpenDevelopper Jul 12, 2021
1ddfb81
Settings to avoid accidental use of debug version
OpenDevelopper Jul 12, 2021
6958d1b
Just move ESP32 target at first
OpenDevelopper Jul 14, 2021
cc3f4f6
Fix DNS ip resolution with static Name EspMavX2
OpenDevelopper Jul 14, 2021
8c9c594
Add RSSI of WiFi Station (Mode) on Status Web page
OpenDevelopper Jul 14, 2021
8e7e84d
Create python-app.yml
Xelack Jul 15, 2021
4b709bc
Fix build targets
Xelack Jul 15, 2021
75f809c
Build All Targets (Ubuntu)
Xelack Jul 15, 2021
52050a5
Create build_esp32.yml
Xelack Jul 15, 2021
e03bf0a
Build ESP32
Xelack Jul 15, 2021
c8de719
Update PIO Platforms Libs
OpenDevelopper Jul 15, 2021
3d0c711
Update python-app.yml
Xelack Jul 15, 2021
4dfb43a
update ld build flag
OpenDevelopper Jul 15, 2021
3394504
Update python-app.yml
Xelack Jul 15, 2021
3e0ac7c
disable gcc warning on Mavlink lib
OpenDevelopper Jul 15, 2021
9d2cf7e
Change on targets build flags
OpenDevelopper Jul 15, 2021
b2b8715
Fix CI on local.eagle.app.v6.common.ld not found
OpenDevelopper Jul 15, 2021
3661e59
Revert "Fix CI on local.eagle.app.v6.common.ld not found"
OpenDevelopper Jul 15, 2021
919babd
reFix CI on local.eagle.app.v6.common.ld not found
OpenDevelopper Jul 15, 2021
8764c5a
add firmware name from cppdefine flag
OpenDevelopper Jul 16, 2021
5aa1928
Forward firmware filename in build flags
OpenDevelopper Jul 16, 2021
7355ec2
Remove pragma clause for ESP32 targets
OpenDevelopper Jul 16, 2021
73154cd
Fix firmware upload
OpenDevelopper Jul 16, 2021
dfe4095
fix esp8622 builds
OpenDevelopper Jul 16, 2021
2386cc8
Add Upload Status led
OpenDevelopper Jul 17, 2021
335abc5
Rework update(md5 check, lost upload link catch)
OpenDevelopper Jul 17, 2021
49fd211
fix ESP8266 update rework
OpenDevelopper Jul 19, 2021
6279f03
fix debug mode on esp8266
OpenDevelopper Jul 19, 2021
45ab72e
add info to parameters
OpenDevelopper Jul 19, 2021
6cba80c
add details to readme for last changes done
OpenDevelopper Jul 19, 2021
22f6b30
add CUAV PW_LINK
OpenDevelopper Jul 19, 2021
5111c64
Add pseudo brand name in web interface
OpenDevelopper Jul 19, 2021
0eefbcb
update with pw_link target
OpenDevelopper Jul 19, 2021
e70d857
Rework on restore/reset button
OpenDevelopper Jul 21, 2021
e7c7ff6
fix abs issue on ESP8266
OpenDevelopper Jul 21, 2021
ab1f369
add new function to send msg to gcs
OpenDevelopper Jul 21, 2021
bf7afd5
fix reset on action
OpenDevelopper Jul 21, 2021
253e023
log rework
OpenDevelopper Jul 21, 2021
5f726d5
Add reboot method to harmonize behaviour
OpenDevelopper Jul 21, 2021
2160dea
add function to know if GSC is connected
OpenDevelopper Jul 21, 2021
2ebf847
add page to send msg to GSC
OpenDevelopper Jul 21, 2021
46522a6
reboot harmonization and gcs isConnected (debug)
OpenDevelopper Jul 21, 2021
c8d2cfa
fix GSC com's issue due to process latency
OpenDevelopper Jul 22, 2021
9ef1709
Add lock on update when GSC is connected
OpenDevelopper Jul 22, 2021
d40cd0d
Update python-app.yml
Xelack Jul 22, 2021
15dac42
Delete build_esp32.yml
Xelack Jul 22, 2021
2a12689
Update CI
Xelack Jul 22, 2021
3d89842
change esp32 restore btn pin
OpenDevelopper Jul 22, 2021
9999387
Release re-init V1.0.0
Xelack Jul 22, 2021
68dd916
update readme
Xelack Jul 22, 2021
702f340
Update README for RC V1.0.0
Xelack Jul 22, 2021
87bf877
fix wording
Xelack Jul 22, 2021
0bc9f39
fix wording
Xelack Jul 22, 2021
67346b9
Update README.md
Xelack Jul 22, 2021
c66d45b
Update README.md
Xelack Jul 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: CI-MavEspX2

on: [push]

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
git submodule update --init
shell: bash
- name: Run PlatformIO
run: pio run -e esp32 -e esp12e -e esp01_1m -e pw_link
shell: bash
3 changes: 2 additions & 1 deletion PARAMETERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If this message is sent specifically to the MavESP8266 component ID, it will ret

##### MAVLINK_MSG_ID_PARAM_SET

If this message is sent specifically to the MavESP8266 component ID, it will set the new value for the specified parameter. Note that this only sets the value for the current session. It does not write the values to EEPROM. See MAV_CMD_PREFLIGHT_STORAGE below.
If this message is sent specifically to the MavESP8266 component ID, it will set the new value for the specified parameter. Note that this only sets the value for the current session. It does not write the values to EEPROM. To apply parameters changes a reboot is mandatory (ref to. MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN). See MAV_CMD_PREFLIGHT_STORAGE below.

#### Available Parameters

Expand Down Expand Up @@ -55,6 +55,7 @@ If this message is sent specifically to the MavESP8266 component ID, it will set
* (2) MavLink parameter messages only support a 32-Bit parameter (be it a float, an uint32_t, etc.) In other to fit a 16-character SSID and a 16-character Password, 4 paramaters are used for each. The 32-Bit storage is used to contain 4 bytes for the string.
* (3) The mode defaults to 0. Set to 0 to act as an Access Point. Set to 1 to connect to an existing WiFi network using the STA (Station Mode) SSID and password. When in *Station Mode*, the module will attempt to connect for up to one minute. If after that it cannot connect, it reverts to AP mode.
* (4) Defaults to 0 for an unset address. If either the STA IP, Gateway, or Subnet are set, then all three need to be set for it to work properly.
* (5) The WiFi RSSI status from ESP device is only availlable in Station mode. In AP mode this information is availlable on device (laptop, smartphone, etc...) connected to ESP.

#### MAVLINK_MSG_ID_COMMAND_LONG

Expand Down
75 changes: 64 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,52 @@
# MavESP8266
# MavEspx2

## Current Binary

Download the current version (MAVLink V2) from here: [Firmware version 1.2.2](http://www.grubba.com/mavesp8266/firmware-1.2.2.bin)
* Release Candidate Version 1.0.0
Download the current version (MAVLink V2) from here: [Firmware version 1.0.0] (https://github.com/Xelack/mavespx2/releases/tag/RC-V1.0.0)

Download the legacy version (MAVLink V1) from here: [Firmware version 1.1.1](http://www.grubba.com/mavesp8266/firmware-1.1.1.bin)
Important Note : Please pay attention to select the correct firmware for your device. If you have any doubts don't take the risk and ask me.

## ESP8266 WiFi Access Point and MavLink Bridge
* mavespx2-esp01-x_x_x.bin : for board based on module ESP8266 with 512kb Flash (80kb ram).
* mavespx2-esp12e-x_x_x.bin : for board based on module ESP8266 with 4mb Flash (80k ram), the major part of the market.
* mavespx2-pw_link-x_x_x.bin : only for CUAV pw_link board (based on ESP8266EX chip).
* mavespx2-esp32dev-x_x_x.zip : for board based on module ESP32 with 4mb Flash (zip file including partition file and firmware).
* mavespx2-wemos_d1_mini32-x_x_x.zip : for D1 board based on module ESP32 with 4mb Flash (zip file including partition file and firmware).

[![Join the chat at https://gitter.im/dogmaphobic/mavesp8266](https://badges.gitter.im/dogmaphobic/mavesp8266.svg)](https://gitter.im/dogmaphobic/mavesp8266?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

This was developed using a [NodeMCU v2 Dev Kit](http://www.seeedstudio.com/depot/NodeMCU-v2-Lua-based-ESP8266-development-kit-p-2415.html) as it conveniently provides a secondary UART for debugging. It has been tested with the ESP-01 shipped with the [PixRacer](https://pixhawk.org/modules/pixracer) and it is stable at 921600 baud.
## WiFi Access Point and MavLink Bridge

The build enviroment is based on [PlatformIO](http://platformio.org). Follow the instructions found here: http://platformio.org/#!/get-started (only tested on Mac OS) for installing it but skip the ```platform init``` step as this has already been done, modified and it is included in this repository. In summary:
This is a fork of MAVEPS8266 of "dogmaphobic" port to ESP32 using a two [MINI D1 ESP32](https://www.az-delivery.de/fr/products/esp32-d1-mini) for debugging and test (on ground and on air mounted on Hexa with PIXHACK V3 (Arducopter V4.0.3)). Even though the ESP32 port showed better efficiency than the ESP8266, I decided to keep the ESP8266 code working, and finally I'm improving all of them.

For now I'don't have ESP8266 module (NodeMCU like) so I use [PW_LINK](http://doc.cuav.net/data-transmission/pw-link/en/) to test.
On this PW_LINK all it's working fine but I don't know why, I don't want boot at the first power-on, I need to unplug dc and replug it...(I'll have to get out my old cathode ray oscilloscope ^^ ).

The build enviroment is based on [PlatformIO](http://platformio.org). Follow the instructions found here: http://platformio.org/#!/get-started (only tested on Windows 10) for installing it but skip the ```platform init``` step as this has already been done, modified and it is included in this repository. In summary:

```
brew install platformio
git clone --recursive https://github.com/dogmaphobic/mavesp8266.git
git clone --recursive https://github.com/Xelack/mavespx2.git
cd mavesp8266
platformio run
```

When you run ```platformio run``` for the first time, it will download the toolchains and all necessary libraries automatically.

### Useful commands:
ESP32:
* ```platformio run -e esp32``` - process/build just the ESP32 target ("must common" ESP32 module with 4mo flash)

* ```platformio run``` - process/build all targets
ESP8266:
* ```platformio run -e esp12e``` - process/build just the ESP12e target (the NodeMcu v2, Adafruit HUZZAH, etc.)
* ```platformio run -e pw_link``` - process/build just the CUAV PW_LINK target (based on ESP8622EX with 4mo flash)
* ```platformio run -e esp12e -t upload``` - build and upload firmware to embedded board

ALL :
* ```platformio run``` - process/build all targets
* ```platformio run -t clean``` - clean project (remove compiled files)

The resulting image(s) can be found in the directory ```.pioenvs``` created during the build process.

The resulting image(s) can be found in the directory ```.pio\build\[target]``` created during the build process.

### MavLink Submodule

Expand All @@ -42,7 +58,44 @@ The ```git clone --recursive``` above not only cloned the MavESP8266 repository

User level (as well as wiring) instructions can be found [here for px4](https://docs.px4.io/en/telemetry/esp8266_wifi_module.html) and [here for ArduPilot](http://ardupilot.org/copter/docs/common-esp8266-telemetry.html)

* Resetting to Defaults: In case you change the parameters and get locked out of the module, all the parameters can be reset by bringing the GPIO02 pin low (Connect GPIO02 pin to GND pin).
For ESP8266:
FC (TX) -> (RX) GPIO03 (MAVESP - define by UART_MAVFC_RX in source code)
FC (RX) <- (TX) GPIO01 (MAVESP - define by UART_MAVFC_TX in source code)

For ESP32:
FC (TX) -> (RX) GPIO16 (MAVESP - define by UART_MAVFC_RX in source code)
FC (RX) <- (TX) GPIO17 (MAVESP - define by UART_MAVFC_TX in source code)

* Important Note: to ensure a RELIABLE and SECURE Communications with your WiFi bridge device, please use UART level shifter high speed (like TXB0102 (2 wires), TXB0104 (4 wires),etc...) between your FC and ESP UARTs port if your FC work in 5v. ALL ESP DEVICES ARE NOT 5v TOLERANT, SO INOPPORTUNE BURN COULD HAPPEN AT ANY TIME!

* Resetting to Defaults: In case you change the parameters and get locked out of the module, all the parameters can be reset by bringing the GPIO pin low.
For ESP8266: Connect GPIO02 pin to GND pin.
For ESP32: Connect GPIO22 pin to GND pin.

### Status LED

This feature is availlable for esp32 and PW_LINK with builtin led (GPIO02 is used by default).
For others boards you can add led on a availlabe GPIO but you need set this GPIO in source code and rebuild the firmware (or tell me ^^ ).

Meaning:
* blink at 1hz : On start, waiting wifi client.
* Stay on : update in progress.
* Blink at 2hz : reboot imminant.

### Actions on button

This feature is availlable for all board (except PW_LINK) with free GPIO (default GPIO : ref to wiring).
Just Plug a button to GPIO pin and GND pin.

* 2 presses : test (for debug, do nothing).
* 3 presses : request reboot.
* 4 presses : request restore default parameters.
* 5 presses : request factory reset.

* Sup. to 5 presses : reset button action after 2s.

Actions are commit and start only 2 seconds after the last push.
If the delay between first press and second press is superior at 5 seconds cancel the first press.

### MavLink Protocol

Expand Down
92 changes: 86 additions & 6 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

[version]
major = 1
minor = 2
build = 2
minor = 0
build = 0

# Generate version string (e.g "1.2.2") and flags

Expand All @@ -27,19 +27,99 @@ version_flags = "-DMAVESP8266_VERSION_MINOR="${version.minor} "-DMAVESP8266_VERS
# - Run prebuild script to set firmware name

[env]
platform = [email protected]
framework = arduino
build_flags = !echo "-DPIO_SRC_REV="$(git rev-parse HEAD) "-DPIO_BUILD_DATE="$(date +%%Y-%%m-%%d) "-DPIO_BUILD_TIME="$(date +%%H:%%M:%%S) ${version_env.version_flags}
build_flags = ${version_env.version_flags}
extra_scripts = pre:platformio_prebuild.py
monitor_speed = 115200

# Platform specific settings

###############################################################
# Platform specific settings #
###############################################################
[env:esp32]
#4m Flash - 320k ram
platform = [email protected]
board = esp32dev
build_flags = ${env.build_flags}
monitor_filters = colorize, esp32_exception_decoder
monitor_flags = --raw
# board_build.partitions = partitions.csv

[env:esp32_d1_mini32]
#4m Flash - 320k ram
platform = [email protected]
board = wemos_d1_mini32
build_flags = ${env.build_flags}
monitor_filters = colorize, esp32_exception_decoder
monitor_flags = --raw

[env:esp12e]
#4m Flash - 80k ram
platform = [email protected]
board = esp12e
build_flags = ${env.build_flags} -Wl,-Tesp8266.flash.4m.ld
build_flags = ${env.build_flags}
#board_build.ldscript= "eagle.flash.4m1m.ld" //already define in board manifest
### ld file name pattern detail : eagle.flash.xxyy.ld where "xx" = flash size and "yy" SPIFFS allocation size

[env:esp01_1m]
#1m Flash - 80kb ram
platform = [email protected]
build_flags = ${env.build_flags}
board = esp01_1m
#board_build.ldscript = "eagle.flash.1m256.ld" //already define in board manifest

[env:esp01]
#512k Flash - 80kb ram
platform = [email protected]
build_flags = ${env.build_flags}
board = esp01
#board_build.ldscript = "eagle.flash.512k64.ld" //already define in board manifest

[env:pw_link]
#4m Flash - 80k ram
platform = [email protected]
board = esp12e
build_flags = ${env.build_flags} "-DPW_LINK=pw_link"
#board_build.ldscript= "eagle.flash.4m1m.ld" //already define in board manifest

################################################################
# !DEBUG! Platform specific settings #
################################################################
# /!\ Please don't use these targets for any vehicules/devices #
# Targets only for test by dev team or official testers. #
# With these targets, the serial debug is enabled by default, #
# degreasing the globale performance. #
################################################################
[env:esp32_Debug]
platform = [email protected]
board = esp32dev
build_flags = ${env.build_flags} "-DENABLE_DEBUG=debug"
monitor_filters = colorize, esp32_exception_decoder
monitor_flags = --raw


#TEST BOARD : Xelack
[env:esp32_d1_mini32_Debug]
platform = [email protected]
board = wemos_d1_mini32
build_flags = ${env.build_flags} "-DENABLE_DEBUG=debug"
monitor_filters = colorize, esp32_exception_decoder
monitor_flags = --raw

[env:esp12e_Debug]
platform = [email protected]
board = esp12e
build_flags = ${env.build_flags} "-DENABLE_DEBUG=debug"
#board_build.ldscript= "eagle.flash.4m1m.ld" //already define in board manifest

[env:esp01_1m_Debug]
platform = [email protected]
board = esp01_1m
build_flags = ${env.build_flags} "-DENABLE_DEBUG=debug"
#board_build.ldscript = "eagle.flash.1m256.ld" //already define in board manifest

[env:esp01_Debug]
platform = [email protected]
board = esp01
build_flags = ${env.build_flags} "-DENABLE_DEBUG=debug"
#board_build.ldscript = "eagle.flash.512k64.ld" //already define in board manifest
40 changes: 35 additions & 5 deletions platformio_prebuild.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
import datetime
import subprocess

Import("env")

# get revivion from Git
revision = (
subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
.strip()
.decode("utf-8")
)
#get current date and time
curr_date = datetime.datetime.now()
date_str = f"{curr_date.year}-{curr_date.month:02}-{curr_date.day:02}"
time_str = f"{curr_date.hour:02}:{curr_date.minute:02}:{curr_date.second:02}"

# add revision and date/time as build informations to the existing build flags (workaround to fix compilation issue with "date +%%..." )
board_name = env["BOARD"]# e.g. "esp01m"
build_flags = env['BUILD_FLAGS']
rev_str = str(revision)
build_flags[0] = "!echo" +' "-DBOARD_NAME="' + board_name +' "-DPIO_SRC_REV="' + rev_str + ' "-DPIO_BUILD_DATE="' + date_str + ' "-DPIO_BUILD_TIME="' + time_str + " " + build_flags[0]

# retrieve build flags
my_flags = env.ParseFlags(env['BUILD_FLAGS'])
defines = {k: v for (k, v) in my_flags.get("CPPDEFINES")}

version_string = defines.get("VERSION_STRING") # e.g. "1.2.2"
board_name = env["BOARD"] # e.g. "esp01m"
debug = defines.get("ENABLE_DEBUG")
pwlink_target = defines.get("PW_LINK")

# replace dots in version if linker can't find the path
#version_string = version_string.replace(".","_")

version_string = version_string.replace(".","_")
#firmware_name = "mavesp-{}-{}".format(board_name, version_string)
# set board and version in firmware name
env.Replace(PROGNAME="mavesp-{}-{}".format(board_name, version_string))
firmware_name = "mavespx2-{}-{}-DEBUG-{}".format(board_name, version_string, rev_str)

if debug == None :
firmware_name = "mavespx2-{}-{}".format(board_name, version_string)

if pwlink_target != None :
firmware_name = "mavespx2-{}-{}".format(pwlink_target, version_string)

build_flags[0] = build_flags[0] + " -DFW_NAME='\"{}.bin\"'".format(firmware_name)

env.Replace(PROGNAME=firmware_name)
Loading