zs6buj / mav2pt Goto Github PK
View Code? Open in Web Editor NEWMavlink to FrSky Passthrough protocol telemetry
License: GNU General Public License v3.0
Mavlink to FrSky Passthrough protocol telemetry
License: GNU General Public License v3.0
Hi Eric,
I copy the text of the issue I have set up in the yaapu github (yaapu/FrskyTelemetryScript#17).
Maybe you can help me with that?
I connected my ULRS 1W module to a teensy 3.2 like shown in the ground side picture. If I connect the teensy to the Arduino Serial monitor, I can see Mavlink messages.
I set up the MavlinkToPassthru_v1.0.8 script as follows:
#define Target_Board 0
#define Ground_Mode
#define Battery_mAh_Source 2
My FC:
Pixhawk 4 with ArduPlane 3.9.4
These are the messages, which I can see in the serial monitor:
Mavlink in #30 Attitude: ap_roll degs=-0.8 ap_pitch degs=-0.3 ap_yaw degs=-86.3
Mavlink in #74 VFR_HUD: Airspeed= 1.35 Groundspeed= 0.10 Heading= 273 Throttle %= 0 Baro alt= 36 Climb rate= 0.03
Mavlink in #147 Battery Status: bat id= 0 bat current mA= 270 ap_current_consumed mAh= 54 my di/dt mAh= 1
Mavlink in #27 Raw_IMU: accX=-0.04 accY=0.01 accZ=-1.00
Mavlink in #29 Scaled_Pressure: press_abs=1029.4hPa press_diff=0.000hPa temperature=35.1C
Mavlink in #30 Attitude: ap_roll degs=-0.7 ap_pitch degs=-0.3 aMavlink in #30 Attitude: ap_roll degs=-0.7 ap_pitch degs=-0.2 ap_yaw degs=-86.3
Mavlink in #27 Raw_IMU: accX=-0.04 accY=0.01 accZ=-1.00
Mavlink in #29 Scaled_Pressure: press_abs=1029.5hPa press_diff=0.000hPa temperature=35.1C
Mavlink in #1 Sys_Status: Bat volts=18.851 Bat amps=0.3 mAh=0.037125 Total mAh=1.188 Bat1 cell count= 5
Mavlink in #125 Power Status: Vcc= 5019 Vservo= 5097 flags= 1
Mavlink in #24 GPS_RAW_INT: ap_fixtype=3 3D Fix sats visible=15 latitude=54.1732979 longitude=12.3405924 gps alt amsl=25.4 eph (hdop)=77 epv (vdop)=127 vel=0.130 cog=346.6
Mavlink in #65 RC_Channels: Channel count= 16 values: 1=1493 2=1494 3=982 4=1494 5=1494 6=1494 7=1494 8=1817 9=1494 10=1494 11=1494 12=1494 13=1494 14=1494 15=1494 16=982 Receive RSSI=49.21
Mavlink in #74 VFR_HUD: Airspeed= 1.32 Groundspeed= 0.13 Heading= 273 Throttle %= 0 Baro alt= 36 Climb rate= -0.17
Mavlink in #30 Attitude: ap_roll degs=-0.7 ap_pitch degs=-0.2 ap_yaw degs=-86.3
Mavlink in #147 Battery Status: bat id= 0 bat current mA= 270 ap_current_consumed mAh= 55 my di/dt mAh= 1
Mavlink in #30 Attitude: ap_roll degs=-0.7 ap_pitch degs=-0.3 ap_yaw degs=-86.3
Mavlink in #74 VFR_HUD: Airspeed= 1.31 Groundspeed= 0.13 Heading= 273 Throttle %= 0 Baro alt= 36 Climb rate= 0.45
Mavlink in #0 Heartbeat: ap_type=1 ap_autopilot=3 ap_base_mode=89 ap_custom_mode=11 ap_system_status=5 ap_mavlink_version=3
Mavlink in #0 Heartbeat: ap_type=27 ap_autopilot=8 ap_base_mode=4 ap_custom_mode=0 ap_system_status=1 ap_mavlink_version=3
Mavlink in #33 GPS Int: ap_lat=54.xxxxxx ap_lon=12.xxxxxx ap_amsl=36 ap_alt_ag=-0.0 ap_vx=0.00 ap_vy=0.00 ap_vz=0.00 ap_gps_hdg=273.7
Mavlink in #27 Raw_IMU: accX=-0.05 accY=0.01 accZ=-1.00
Mavlink in #29 Scaled_Pressure: press_abs=1029.4hPa press_diff=0.000hPa temperature=35.1C
Mavlink in #1 Sys_Status: Bat volts=18.852 Bat amps=0.3 mAh=0.045344 Total mAh=1.233 Bat1 cell count= 5
Mavlink in #125 Power Status: Vcc= 5027 Vservo= 5102 flags= 1
Mavlink in #24 GPS_RAW_INT: ap_fixtype=3 3D Fix sats visible=15 latitude=54.xxxxxxx longitude=12.xxxxxxx gps alt amsl=25.2 eph (hdop)=77 epv (vdop)=127 vel=0.180 cog=346.6
Mavlink in #65 RC_Channels: Channel count= 16 values: 1=1493 2=1494 3=982 4=1494 5=1494 6=1494 7=1494 8=1817 9=1494 10=1494 11=1494 12=1494 13=1494 14=1494 15=1494 16=982 Receive RSSI=49.21
But if I start my Taranis, the yaapu telemetry page tells me "no telemetry data". Is there anything I did wrong?
Please re-open issue #48, as the introduced change wrongly outputs for satellite count 16 to 254 zero.
Please consider the following instead:
if (ap24_sat_visible > 15)
{
if (ap24_sat_visible == 255)
pt_numsats = 0; // for special case 255 == unknown satellite count
else
pt_numsats = 15; // limit to 15 due to only 4 bits available
}
else
pt_numsats = ap24_sat_visible;
no issue.... removed.... Great work!
Plaftormio.ini :
[env:esp12e] ; Node MCU variant
; Remember to set the variant in config.h
platform = espressif8266
board = esp12e
framework = arduino
upload_speed = 115200
monitor_speed = 115200
upload_port = COM(40)
config.h:
//=================================================================================================
//=================================================================================================
//
// C O N F I G U R A T I O N
//
//=================================================================================================
//=================================================================================================
/*
Complete change log and debugging options are at the bottom of this tab
v2.58.4 2020-03-25 RPM fixed (library path).
*/
//===========================================================================================
//
// PLEASE SELECT YOUR DEFAULT OPTIONS BELOW BEFORE COMPILING
//
//===========================================================================================
#define webSupport // ESP only. Enable wifi web support, including OTA firmware updating. Browse to IP.
#define webPassword "changeme!" // Web password
//#define Reset_Web_Defaults // Settings in eeprom. Do this if eeprom settings are corrupt or wrong.
//#define SD_Support // Activate if you have an SD card reader attached
#define OLED_Support // Activate if you have an OLED display attached
//#define AutoBaud // Auto detect Mavlink serial-in baud rate
// NOTE: Set mvBaudFC = 57600 for Dragonlink and RFD900X
#define mvBaudFC 57600 // Mavlink to/from the flight controller - max 921600 - must match FC or long range radio
#define frBaud 57600 // S.Port baud setting - default 57600
// Do not enable for FlightDeck
#define PlusVersion // Added support for 0x5009 Mission WPs, 0x50F1 Servo_Channels, 0x50F2 VFR_Hud
//=================================================================================================
// D E F A U L T T R A N S L A T I O N M O D E S E T T I N G S
//=================================================================================================
// Choose only one of these three translation modes
#define Ground_Mode // Translator between Taranis et al and LRS transceiver (like Dragonlink, ULRS, RFD900...)
//#define Air_Mode // Translator between FrSky receiver (like XRS) and Flight Controller (like Pixhawk)
//#define Relay_Mode // Translator between LRS tranceiver (like Dragonlink) and FrSky receiver (like XRS) in relay box on the ground
//=================================================================================================
// D E F A U L T F L I G H T C O M P U T E R I / O S E T T I N G S
//=================================================================================================
// Choose only one of these default Flight-Controller-side I/O channels
// How does Mavlink telemetry enter this translator?
#define FC_Mavlink_IO 0 // Serial Port (default)
//#define FC_Mavlink_IO 1 // BlueTooth Classic - ESP32 only
//#define FC_Mavlink_IO 2 // WiFi - ESP32 or ESP8266 only
//#define FC_Mavlink_IO 3 // SD Card / TF - ESP32 only
//=================================================================================================
// D E F A U L T G R O U N D S T A T I O N I / O S E T T I N G S
//=================================================================================================
// Choose only one of these default GCS-side I/O channels
// How does Mavlink telemetry leave this translator?
// These are optional, and in addition to the S.Port telemetry output
//#define GCS_Mavlink_IO 0 // Serial Port - Only Teensy 3.x and Maple Mini have Serial3
//#define GCS_Mavlink_IO 1 // BlueTooth Classic - ESP32 only
//#define GCS_Mavlink_IO 2 // WiFi - ESP32 or ESP8266 only
#define GCS_Mavlink_IO 3 // WiFi AND Bluetooth simultaneously - ESP32 only
#ifndef GCS_Mavlink_IO
#define GCS_Mavlink_IO 9 // NONE (default)
#endif
// NOTE2: The Bluetooth class library uses a lot of application memory. During Compile/Flash
// You may need to select Tools/Partition Scheme: "Minimal SPIFFS (1.9MB APP ...) or similar
//#define GCS_Mavlink_SD // SD Card - ESP32 only - mutually inclusive with other GCS I/O
//=================================================================================================
// S E L E C T E S P B O A R D V A R I A N T
//=================================================================================================
//#define ESP32_Variant 1 // ESP32 Dev Module - Use Partition Scheme: "Minimal SPIFFS(1.9MB APP...)"
//#define ESP32_Variant 2 // Wemos® LOLIN ESP32-WROOM-32_OLED_Dual_26p
//#define ESP32_Variant 3 // Dragonlink V3 slim with internal ESP32 - contributed by Noircogi
#define ESP32_Variant 4 // Heltec Wifi Kit 32 - Use Partition Scheme: "Minimal SPIFFS(Large APPS ith OTA)" - contributed by Noircogi
//#define ESP8266_Variant 1 // NodeMCU ESP 12F - choose "NodeMCU 1.0(ESP-12E)" board in the IDE
#define ESP8266_Variant 2 // ESP-F Use me for RFD900X TX-MOD - use generic ESP8266 board on IDE
//=================================================================================================
// D E F A U L T B L U E T O O T H S E T T I N G S
//=================================================================================================
//#define BT_Mode 1 // Master Mode - we advertise the "host" name and slave connects to us
#define BT_Mode 2 // Slave Mode - we connect as slave to a master
#define BT_SlaveConnectTo "Crossfire 0277" // Example
//=================================================================================================
// D E F A U L T W I F I S E T T I N G S
//=================================================================================================
#define HostName "MavToPass" // This translator's host name
#define APssid "MavToPassthru" // The AP SSID that we advertise ====>
#define APpw "password" // Change me!
#define APchannel 9 // The wifi channel to use for our AP
#define STAssid "OmegaOffice" // Target AP to connect to <====
#define STApw "changeme" // Target AP password
#define Start_WiFi // Start WiFi at startup, override startWiFi Pin
// Choose one default mode for ESP only - AP means advertise as an access point (hotspot). STA means connect to a known host
//#define WiFi_Mode 1 //AP
//#define WiFi_Mode 2 // STA
#define WiFi_Mode 3 // STA failover to AP
// Choose one default protocol - for ESP32 only
//#define WiFi_Protocol 1 // TCP/IP
#define WiFi_Protocol 2 // UDP
//=================================================================================================
// O T H E R U S E R O P T I O N S
//=================================================================================================
//#define Battery_mAh_Source 1 // Get battery mAh from the FC - note both rx and tx lines must be connected
//#define Battery_mAh_Source 2 // Define bat1_capacity and bat2_capacity below and use those
const uint16_t bat1_capacity = 5200;
const uint16_t bat2_capacity = 0;
#define Battery_mAh_Source 3 // Define battery mAh in the LUA script on the Taranis/Horus - Recommended
#define SPort_Serial 1 // Teensy port1=pin1, port3=pin8. The default is Serial 1, but 3 is possible
// RSSI_Source is now automatic. Order of precedence:
// First: #109 SiK style RADIO_STATUS
// Second: #65 RC_CHANNELS
// Third: #35 RC_CHANNELS_RAW
//#define RSSI_Override // Dummy RSSI - fixed at 70%
//#define Rssi_In_Percent // Un-comment if RSSI is already %, not relative to (254/100)
// Status_Text messages place a huge burden on the meagre 4 byte FrSky telemetry payload bandwith
// The practice has been to send them 3 times to ensure that they arrive unscathed at the receiver
// but that makes the bandwidth limitation worse and may crowd out other message types. Try without
// sending 3 times, but if status_text gets distorted, un-comment the next line
//#define Send_status_Text_3_Times
//#define Send_Sensor_Health_Messages
//#define Request_Missions_From_FC // Un-comment if you need mission waypoint from FC - NOT NECESSARY RIGHT NOW
//#define Data_Streams_Enabled // Requests data streams from FC. Requires both rx and tx lines to FC. Rather set SRn in Mission Planner
#define Max_Waypoints 256 // Note. This is a global RAM trade-off. If exceeded then Debug message and shut down
//================================== Set your time zone here ======================================
// Only for SD / TF Card adapter option
// Date and time determines the TLog file name only
//const float Time_Zone = 10.5; // Adelaide, Australia
const float Time_Zone = 2.0; // Jo'burg
bool daylightSaving = false;
//=================================================================================================
// E X P E R I M E N T A L O P T I O N S
// Don't change anything here unless you are confident you know the outcome
//#define ESP32_SoftwareSerial // otherwise HardwareSerial is used
//#define ESP_Onewire // enable half_duplex on single (tx) pin and wire - Air/Relay
//#define ESP_Air_Relay_Blind_Inject_OK // Blind inject instead of interleaving
//=================================================================================================
// Auto Determine Target Platform
//=================================================================================================
//
// Don't change anything here
//
#if defined (__MK20DX128__) || defined(__MK20DX256__)
#define TEENSY3X
#elif defined ESP32
#define Target_Board 3 // Espressif ESP32 Dev Module
#elif defined ESP8266
#define Target_Board 4 // Espressif ESP8266
#else
#error "Unsupported board type!"
#endif
//=================================================================================================
// CHECK #define OPTIONS LOGIC
//=================================================================================================
#if defined PlusVersion
#define Request_Mission_Count_From_FC // Needed for yaapu's mission/waypoint script
#endif
#if (not defined ESP32) && (not defined ESP8266)
#if defined webSupport
#undef webSupport
// #error webSupport only available on ESP32 or ESP8266
#endif
#endif
#if defined ESP32
#include <iostream>
#include <sstream>
#include <driver/uart.h> // In Arduino ESP32 install repo
//C:\Users\<YourName>\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\tools\sdk\include\driver
#endif
#if (defined ESP32) || (defined ESP8266) // ESP32 or ESP8266 (UART0, UART1, and UART2)
#if (SPort_Serial == 3)
#error Board does not have Serial3. This configuration is not possible.
#endif
#endif
#if (defined TEENSY3X)
#if (FC_Mavlink_IO == 3) || (defined GCS_Mavlink_SD)
#error SD card not currently implemented for Teensy
#endif
#endif
#ifndef Battery_mAh_Source
#error Please choose at least one Battery_mAh_Source
#endif
#if (not defined ESP32) && (not defined ESP8266)
#if (FC_Mavlink_IO == 2) || (GCS_Mavlink_IO == 2) || (GCS_Mavlink_IO == 3) || (defined webSupport)
// #error WiFi and webSupport only work on an ESP32 or ESP8266 board
#if defined FC_Mavlink
#undef FC_Mavlink
#endif
#define FC_Mavlink_IO 0
#if defined GCS_Mavlink_IO
#undef GCS_Mavlink_IO
#endif
#define GCS_Mavlink_IO 9
#if defined webSupport
#undef webSupport
#endif
#endif
#endif
#if (defined ESP8266) && ((GCS_Mavlink_IO == 1) || (GCS_Mavlink_IO == 3)) // Can't do BT on 8266
#define GCS_Mavlink_IO 2 // WiFi Only
#endif
#if (not defined ESP32)
#if (FC_Mavlink_IO == 1) || (GCS_Mavlink_IO == 1) || (GCS_Mavlink_IO == 3)
#error Bluetooth works only on an ESP32 board
#endif
#endif
#ifndef FC_Mavlink_IO
#error Please choose at least one Mavlink FC IO channel
#endif
#if (defined ESP32)
#ifndef WiFi_Mode
#error Please define WiFi_Mode
#endif
#endif
#if (defined ESP32)
#ifndef WiFi_Protocol
#error Please define WiFi_Protocol
#endif
#endif
#if (defined ESP32)
#ifndef ESP32_Variant
#error Please define an ESP32 board variant
#endif
#endif
#if (defined ESP8266)
#ifndef ESP8266_Variant
#error Please define an ESP8266 board variant
#endif
#endif
//=================================================================================================
// S E T T I N G S A N D O P T I O N S S T R U C T U R E
//=================================================================================================
typedef enum trmode_set { ground = 1 , air = 2, relay = 3 } trmode_t; // translator operation mode
typedef enum fc_io_set { fc_ser = 0, fc_bt = 1 , fc_wifi = 2, fc_sd = 3 } fc_io_t;
typedef enum gs_io_set { gs_ser = 0, gs_bt = 1 , gs_wifi = 2, gs_wifi_bt = 3, gs_none = 9} gs_io_t;
typedef enum gs_sd_set { gs_off = 0 , gs_on = 1} gs_sd_t;
typedef enum wfmode_set { ap = 1 , sta = 2, sta_ap = 3 } wfmode_t;
typedef enum wf_proto_set { tcp = 1 , udp = 2, } wf_proto_t;
typedef enum btmode_set { master = 1, slave = 2 } btmode_t;
typedef struct {
byte validity_check; // 0xdc
trmode_t trmode;
fc_io_t fc_io;
gs_io_t gs_io;
gs_sd_t gs_sd;
wfmode_t wfmode;
wf_proto_t wfproto;
uint32_t baud;
uint8_t channel;
char apSSID[30];
char apPw[20];
char staSSID[30];
char staPw[20];
char host[20];
uint16_t tcp_localPort;
uint16_t udp_localPort;
uint16_t udp_remotePort;
btmode_t btmode;
char btSlaveConnectTo[20];
uint8_t rssi_override;
bool web_support; // this flag is not saved in eeprom
char* trmode1; //ground
char* trmode2; //air
char* trmode3; //relay
char* fc_io0; //ser
char* fc_io1; //bt
char* fc_io2; //wifi
char* fc_io3; //sd
char* gs_io0; //ser
char* gs_io1; //bt
char* gs_io2; // wifi
char* gs_io3; // wifi_bt
char* gs_io9; // none
char* gs_sd0; // off
char* gs_sd1; // on
char* wfmode1; // ap
char* wfmode2; // sta
char* wfmode3; // sta_ap
char* wfproto1; // tcp
char* wfproto2; // udp
char* btmode1; // master
char* btmode2; // slave
char* rssioverride; //rssi override
} settings_struct_t;
settings_struct_t set;
//=================================================================================================
// P L A T F O R M D E P E N D E N T S E T U P S
//=================================================================================================
#if defined TEENSY3X // Teensy3x
#define MavStatusLed 13
#define InvertMavLed false
#define BufStatusLed 14
#define FC_Mav_rxPin 9
#define FC_Mav_txPin 10
#if (SPort_Serial == 1)
#define Fr_txPin 1 // Not soft configurable. Change wiring
#define GC_Mav_rxPin 7
#define GC_Mav_txPin 8
#elif (SPort_Serial == 3)
define Fr_txPin 8 // Not soft configurable. Change wiring
#endif
#if (defined SD_Support) || (defined OLED_Support)
#endif
#elif defined ESP32 // ESP32 Platform
#if (ESP32_Variant == 1) // ESP32 Dev Module
#define MavStatusLed 02 // Onboard LED
#define InvertMavLed false
#define BufStatusLed 27 // untested pin
#define FC_Mav_rxPin 16 // Mavlink to FC
#define FC_Mav_txPin 17 // Mavlink from FC
#define Fr_rxPin 13 // SPort - Not used in 1-wire mode
#define Fr_txPin 4 // SPort - Use me
#if (defined SD_Support) || (defined OLED_Support)
#define SDA 21 // I2C OLED board
#define SCL 22 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#endif
int16_t wifi_rssi;
uint8_t startWiFiPin = 15; // D15
uint8_t WiFiPinState = 0;
/*
SPI/CS Pin 05 For optional TF/SD Card Adapter
SPI/MOSI Pin 23 For optional TF/SD Card Adapter
SPI/MISO Pin 19 For optional TF/SD Card Adapter
SPI/SCK Pin 18 For optional TF/SD Card Adapter
*/
#endif
#if (ESP32_Variant == 2) // Wemos® LOLIN ESP32-WROOM-32_OLED_Dual_26p
#define MavStatusLed 15 // No Onboard LED
#define InvertMavLed false
#define BufStatusLed 99 // None
#define FC_Mav_rxPin 25 // Mavlink to FC
#define FC_Mav_txPin 26 // Mavlink from FC
#define Fr_rxPin 12 // SPort - Not used in single wire mode
#define Fr_txPin 14 // SPort - Use me
#if (defined SD_Support) || (defined OLED_Support)
#define SDA 05 // I2C OLED board
#define SCL 04 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#endif
int16_t wifi_rssi;
uint8_t startWiFiPin = 13;
uint8_t WiFiPinState = 0;
#endif
#if (ESP32_Variant == 3) // Dragonlink V3 slim with internal ESP32
#if defined mvBaudFC
#undef mvBaudFC
#define mvBaudFC 115200 // Force baud rate to DragonLink rate
#endif
#define MavStatusLed 18 // Blue LED
#define InvertMavLed false
#define BufStatusLed 19 // Green LED
#define FC_Mav_rxPin 16 // Mavlink to FC
#define FC_Mav_txPin 17 // Mavlink from FC
#define Fr_rxPin 12 // SPort - Not used in single wire mode
#define Fr_txPin 01 // SPort - Use me
#if (defined SD_Support) || (defined OLED_Support)
#define SDA 05 // I2C OLED board
#define SCL 04 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#endif
int16_t wifi_rssi;
uint8_t startWiFiPin = 13;
uint8_t WiFiPinState = 0;
#endif
#if (ESP32_Variant == 4) // Heltec Wifi Kit 32 (NOTE! 8MB)
#define MavStatusLed 25 // Onboard LED
#define InvertMavLed false
#define BufStatusLed 99
#define FC_Mav_rxPin 27 // Mavlink to FC
#define FC_Mav_txPin 17 // Mavlink from FC
#define Fr_rxPin 12 // SPort - Not used in single wire mode
#define Fr_txPin 14 // SPort - Use me
#if !defined OLED_Support // I2C OLED board is built into Heltec WiFi Kit 32
#define OLED_Support
#endif
#if (defined SD_Support) || (defined OLED_Support)
#define SDA 04 // I2C OLED board
#define SCL 15 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#define OLED_RESET 16 // RESET here so no rest lower down
#endif
int16_t wifi_rssi;
uint8_t startWiFiPin = 15; // D15
uint8_t WiFiPinState = 0;
#endif
#elif defined ESP8266 // ESP8266 Platform
#if (ESP8266_Variant == 1) // NodeMCU 12F board
#define MavStatusLed D4 // D4 Board LED - Mav Status LED inverted logic - use 99 while debug
#define InvertMavLed true
#define BufStatusLed 99 // None
// D4 // TXD1 - Serial1 debug log out SHARED WITH BOARD LED
#define FC_Mav_rxPin D9 // RXD0 default
#define FC_Mav_txPin D10 // TXD0 default
#define Fr_rxPin D5 // GP10 SPort - Not used in single wire mode
#define Fr_txPin D6 // GPIO SPort - Use me in single wire mode
#if (defined SD_Support) || (defined OLED_Support)
#define SCL D1 // I2C OLED board
#define SDA D2 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#endif
int16_t wifi_rssi;
uint8_t startWiFiPin = D3;
uint8_t WiFiPinState = 0;
#endif
#if (ESP8266_Variant == 2) // ESP-F RFD900X TX-MOD - use generic esp8266
// GPIO as per node mcu
static const uint8_t D0 = 16; // SCL - optional
static const uint8_t D1 = 5; // SDA - optional
static const uint8_t D2 = 4; // SPort half-duplex
static const uint8_t D3 = 0; // Flash
static const uint8_t D4 = 2; // BoardLED & TXD1 optional debug out
static const uint8_t D5 = 14; // SPort rx (unused in half-duplex)
static const uint8_t D6 = 12; // P2-3 exposed dual row of pins
static const uint8_t D7 = 13; // CTS
static const uint8_t D8 = 15; // RTS
static const uint8_t D9 = 3; // RXD0
static const uint8_t D10 = 1; // TXD0
#define MavStatusLed D4 // D4 Board LED - Mav Status LED inverted logic - use 99 while debug
#define InvertMavLed true
#define BufStatusLed 99 // None
// D4 // TXD1 - Serial1 default debug log out SHARED WITH BOARD LED
#define FC_Mav_rxPin D9 // RXD0 default
#define FC_Mav_txPin D10 // TXD0 default
#define Fr_rxPin D5 // SPort - Not used in single wire mode
#define Fr_txPin D2 // SPort half-duplex inverted - Use me in single wire mode
#if (defined SD_Support) || (defined OLED_Support)
#define SCL D0 // I2C OLED board
#define SDA D1 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#endif
int16_t wifi_rssi;
uint8_t startWiFiPin = D8;
uint8_t WiFiPinState = 0;
#endif
#endif
//=================================================================================================
// E E P R O M S U P P O R T - ESP Only - for now
//=================================================================================================
#if (defined ESP32) || (defined ESP8266)
#include <EEPROM.h> // To store AP_Failover_Flag and webSupport Settings
#define EEPROM_SIZE 160 // 1 + 159 bytes, addr range 0 thru 160
#endif
//=================================================================================================
// S D C A R D S U P P O R T - ESP Only - for now
//=================================================================================================
#if (defined ESP32) || (defined ESP8266)
#include <FS.h>
#include <SD.h>
#include <SPI.h>
#define SD_Libs_Loaded
/*
// Optional SPI interface pins for SD card adapter or SSD1306 OLED display
#define CS 5
#define MOSI 23
#define MISO 19
#define SCK 18
*/
// Pins generally CS=5 MOSI=23 MISO=19 SCK=18 3.3V GND Dev Board, LilyGO/TTGO
// Rememeber to change SPI frequency from 4E6 to 25E6, i.e 4MHz to 25MHz in SD.h otherwise MavRingBuff fills up
// C:\Users\YourUserName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\libraries\SD\src
// bool begin(uint8_t ssPin=SS, SPIClass &spi=SPI, uint32_t frequency=25000000, const char * mountpoint="/sd", uint8_t max_files=5);
char cPath[40];
std::string fnPath[30];
uint8_t fnCnt;
uint16_t sdReadDelay = 10; // mS Otherwise the reads run through unnaturally quickly
File file; // Create global object from File class for general use
static const uint8_t mthdays[]={31,28,31,30,31,30,31,31,30,31,30,31};
typedef struct {
uint16_t yr; // relative to 1970;
uint8_t mth;
uint8_t day;
uint8_t dow; // sunday is day 1
uint8_t hh;
uint8_t mm;
uint8_t ss;
} DateTime_t;
static DateTime_t dt_tm;
#endif
//=================================================================================================
// O L E D S U P P O R T E S P O N L Y - for now
//=================================================================================================
#if (defined ESP32 || defined ESP8266)
#if not defined SD_Libs_Loaded // by SD block
#include <SPI.h> // for SD card and/or OLED
#include <Wire.h>
#endif
#include <Adafruit_SSD1306.h>
#define max_col 22
#define max_row 8
// 8 rows of 21 characters
struct OLED_line {
char OLx[max_col];
};
OLED_line OL[max_row];
uint8_t row = 0;
uint8_t col = 0;
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// 8 rows of 21 characters
// Declaration for an SSD1306 I2C display
#ifndef OLED_RESET
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#endif
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#endif
//=================================================================================================
// B L U E T O O T H S U P P O R T - ESP32 Only
//=================================================================================================
#if (defined ESP32)
#include "BluetoothSerial.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig in ESP32 IDF`
#endif
BluetoothSerial SerialBT;
#endif
//=================================================================================================
// W I F I S U P P O R T - ESP32 and ES8266 Only
//=================================================================================================
uint16_t TCP_localPort = 5760;
uint16_t UDP_localPort = 14555;
uint16_t UDP_remotePort = 14550;
bool FtRemIP = true;
#if (defined ESP32 || defined ESP8266)
// Define link variables
struct linkStatus {
uint32_t packets_received;
uint32_t packets_lost;
uint32_t packets_sent;
};
bool hb_heard_from = false;
uint8_t hb_system_id = 0;
uint8_t hb_comp_id = 0;
uint8_t hb_seq_expected = 0;
uint32_t hb_last_heartbeat = 0;
linkStatus link_status;
#if defined ESP32
#include <WiFi.h>
#include <WiFiClient.h>
#if defined webSupport
#include <WebServer.h>
#include <Update.h>
WebServer server(80);
#endif
#include <WiFiAP.h>
#endif
#if defined ESP8266
#include <ESP8266WiFi.h> // Includes AP class
#include <WiFiClient.h>
#if defined webSupport
#include <ESP8266WebServer.h>
ESP8266WebServer server(80);
#endif
#endif
#include <WiFiUdp.h>
WiFiClient WiFiSTA;
WiFiServer TCPserver(set.tcp_localPort);
IPAddress udp_remoteIP(192, 168, 1, 255); // Declare UDP broadcast on your likely LAN subnet
WiFiUDP UDP; // Create UDP object
IPAddress localIP; // tcp and udp
#endif // end of ESP32 and ESP8266
//=================================================================================================
// S E R I A L
//=================================================================================================
#if (defined ESP32)
#define Debug Serial // USB
#define mvSerialFC Serial2 // RXD0 and TXD0
#if defined ESP32_SoftwareSerial
#include <SoftwareSerial.h>
SoftwareSerial frSerial;
#else // default HW Serial
#define frSerial Serial1
#endif
#elif (defined ESP8266)
#define Debug Serial1 // D4 TXD1 debug out - no RXD1 !
#define mvSerialFC Serial // RXD0 and TXD0
#include <SoftwareSerial.h>
SoftwareSerial frSerial;
#endif
#if (defined TEENSY3X) // Teensy 3.1
#define Debug Serial // USB
#define mvSerialFC Serial2
#if (SPort_Serial == 1)
#define frSerial Serial1 // S.Port
#elif (SPort_Serial == 3)
#define frSerial Serial3 // S.Port
#else
#error SPort_Serial can only be 1 or 3. Please correct.
#endif
#endif
#if (defined TEENSY3X) || (defined MAPLE_MINI) // only these have 4 uarts at present
//#define Enable_GCS_Serial // OPTION SET HERE OPTION SET HERE OPTION SET HERE
#endif
#if defined Enable_GCS_Serial // only Teensy and maple mini have 4 uarts at present
#if (SPort_Serial == 3)
#error Mavlink_GCS and SPort both configured for Serial3. Please correct.
#endif
#if (defined TEENSY3X)
#define mvSerialGCS Serial3
#define mvBaudGCS 57600 // Use 57600
#else
#error Mavlink_GCS Serial not available for ESP32 or ESP8266 - no Serial3. Please correct.
#endif
#endif
//=================================================================================================
// D E B U G G I N G O P T I O N S
//=================================================================================================
//#define inhibit_SPort // Use me to send debug messages only, out of GPIO1/TX0 on ESP32_Variant 3, DL V3 internal ESP32
//#define Mav_Debug_All
//#define Frs_Debug_All
//#define Frs_Debug_Payload
//#define Mav_Debug_RingBuff
//#define Frs_Debug_Period
//#define Debug_Air_Mode
//#define Debug_Relay_Mode
//#define Mav_List_Params // Use this to test uplink to Flight Controller
//#define Mav_Debug_Params
//#define Frs_Debug_Params
//#define Debug_BT
//#define Debug_FC_Down // traffic down from FC to Ring Buffer
//#define Debug_FC_Up // traffic up to FC from GCS
//#define Debug_GCS_Down // traffic from RB to GCS
//#define Debug_GCS_Up // traffic up from GCS to FC
//#define Mav_Debug_Servo
//#define Frs_Debug_Servo
//#define Debug_Rssi
//#define Mav_Debug_RC
//#define Frs_Debug_RC
//#define Mav_Debug_FC_Heartbeat
//#define Mav_Debug_GCS_Heartbeat
//#define Mav_Debug_MavToPass_Heartbeat
//#define Frs_Debug_APStatus
//#define Mav_Debug_SysStatus
//#define Debug_Batteries
//#define Frs_Debug_Home
//#define Mav_Debug_GPS_Raw // #24
//#define Mav_Debug_GPS_Int // #33
//#define Frs_Debug_LatLon
//#define Frs_Debug_YelYaw
//#define Frs_Debug_GPS_status
//#define Mav_Debug_Scaled_IMU
//#define Mav_Debug_Raw_IMU
//#define Mav_Debug_Hud
//#define Frs_Debug_Hud
//#define Mav_Debug_Scaled_Pressure
//#define Mav_Debug_Attitude
//#define Frs_Debug_Attitude
//#define Mav_Debug_StatusText
//#define Frs_Debug_StatusText
//#define Mav_Debug_Mission
//#define Frs_Debug_Mission
//#define Debug_SD
//#define Mav_Debug_System_Time
//#define Frs_Debug_Scheduler // - this debugger affects the performance of the scheduler when activated
//#define Decode_Non_Essential_Mav
//#define Debug_Baud
//#define Debug_Radio_Status
//#define Debug_GCS_Unknown
//#define Debug_Param_Request_Read
//#define Mav_Show_Unknown_Msgs
//#define Mav_Print_All_Msgid
//#define Debug_Eeprom
//#define Debug_Web_Settings
//#define Debug_SPort
//#define Mav_Debug_RPM
//=================================================================================================
// C H A N G E L O G
//=================================================================================================
/*
Change log:
v2.00 2019-06-07 Plus version firmware ported to ESP32 Dev Module V1 successfully - no improvements
v2.01 2019-06-09 Added OLED display support
v2.02 2019-05-18 Belatedly include Alex's Rangefinder PR that I missed.
v2.03 2019-05-21 Reduce voltage and current display moving average smoothing
Empirical correction of mAh consumed as per Markus Greinwald's measurements
Change mav heartbeat timeout from 3 to 6 seconds
v2.04 2019-05-24 Merge Alex's BT classic PR. Thank you!
Remove Aux port as no longer required
Tidy #define options
v2.05 2019-06-09 Support 3 possible I/O channels on FC side, and 3 on GCS side. UART serial, BT and WiFi.
WiFi AP ssid = 'Mav2Passthru', pw = 'password' for now.
v2.06 2019-06-10 Support added for STA mode and AP mode. Tidied up some lose ends.
v2.07 2019-06-16 Initiate WiFi session with push button from GPIO15 momentary to ground.
v2.08 2019-06-16 Add SD/TF card support - wip!! Added UTP protocol option
v2.09 2019-06-30 WiFi activation push button momentary but one-time.
2019-07-03 Implemented optional TLog input and output via SD card.
v2.10 2019-07-09 For PX4 flight stack only, send HB to FC every 2 seconds
2019-07-10 Radical redesign of S.Port scheduling algorithm. Support SD and WiFi/BT I/O simultaneously
v2.11 2109-07-11 Auto determine target board. Publish "Universal" version 2.11. One source, four platforms / boards
v2.12 2019-07-12 Add #define PlusVersion, comment out for FlightDeck
v2.13 2019-08-13 UDP now working in Access Point mode
v2.14 2019-07-17 PX4 flight stack only - fixed longitude typo if (ap_lat24<0) should be if (ap_lon24<0)
v2.15 2019-07-17 Switch to Adafruit_SSD1306 OLED library. 8 lines x 21 chars
v2.16 2019-07-18 Increase time burden for each successive Status Text chunk by 5mS
v2.17 2019-07-19 Auto detect serial telemetry and baud rate
v2.18 2019-07-21 Tune FrSky packet schduler. Add option. Default is 1x. //Send_status_Text_3_Times
v2.19 2019-07-22 Implement 2 tier scheduling. Tier1 gets priority, tier2 (0x5000) only when tier1 empty
v2.20 2019-07-26 Release candidate. Send HB back to FC for APM also, not just PX4. Streamline library #includes.
#undef troublesome F function.
v2.21 2019-07-26 Trap attempt to do GCS I/O on ESP32 or Blue Pill - no Serial3 UART.
2019-07-29 Implement system health status-text messages as per Alex's request.
v2.22 2019-08-10 Make sensor health messages optional for now. Fix end-of-sensor message text detection.
v2.23 2019-08-21 Add support for RFD900x long-range telemetry modems, specifically RSSI
v2.24 2019-08-23 Workaround for Esp32 library "wifi: Set status to INIT" bug
Improve responsiveness to baud detect with no telemetry present.
v2.25 2019-08-28 Version for RFD900x. Bug fixes on rssi. Include #define StartWiFi option to
override startWiFi Pin.
v2.26 2019-08-31 Improved GCS to FC debugging. Make baud rate sensing optional.
v2.27 2019-09-13 Small additions to test LILYGO®_TTGO_MINI32_ESP32-WROVER_B
v2.28 2019-09-17 Localise pin definitions in one place to define ESP32 variants more easily
v2.29 2019-09-24 Use #if (TargetBoard == 3) to define soft pins for mvSerialFC
v2.30 2019-09-26 Don't push #5007 into sensor table from #147. Push from #1 only.
v2.31 2019-09-30 Configurable declarations moved to config.h file
v2.32 2019-10-08 Source line corrupted in v2.17 affecting Relay Mode, fixed. Thank you burtgree!
v2.33 2019-10-09 Don't invert ESP32 SPort in Relay Mode. Use commercial inverter/converter.
Tidy up config.h file.
Send #5007 3 times at startup and then every 50th heartbeat.
v2.34 2019-10-15 Move typedef struct DateTime_t to global scope in line with VS Code/Platform IO.
v2.35 2019-10-18 Add pre-defined ESP32 board variants. TargetBoard >> Target_Board typo Paul Atherton.
v2.36 2019-10-30 Optimise WiFi amd BT read/send as per excellent mavesp8266 bridge by Tridge.
Add support for ESP8266.
v2.41 2019-11-08 Fix STA mode no-connect loop
2019-11-08 Make AutoAP optional
v2.42 2019-11-09 Add support for GCS-side simultaneous WiFi and BT telemetry option
v2.43 2019-11-10 Tidy up WiFi Setup for auto AP failover.
Support for 2 new ESP32 board variants, complements of Noircogi.
2019-11-11 Implement Auto RSSI selection(Order of precedence #109, then #65 then #35)
2019-11-11 Support AutoBaud up to 921600.
v2.44 2019-11-12 Include Target0815 recommended reset after STA fail to connect.
v2.45 2019-11-12 Augment mission debugging for athertop.
2019-11-13 Move #endif outside } in SetupWiFi
v2.46 2019-11-16 A few cosmetic improvements
v2.47 2019-12-23 For ESP32 Dev Module, use pin 27 for S.Port tx,
because boot fails if pin 12 pulled high
v2.48 2019-12-17 Option for SiK #109, if RSSI is already in %, i.e. not relative to 2.54
Added #define Rssi_In_Percent
2019-12-31 Changes for PlatformIO compatibility
2020-01-02 ESP32 Dev Board change again for stability - S.Port pins rx=13, tx=14
v2.49 2020-01-07 Move baud, ssid and BT settings to top of config.h for convenience
v2.50 2020-01-12 AutoAP: Activate udp broadcast on AP dhcp allocated IP subnet.
Eliminate annoying periodic "Stabilized Flight Mode" announcements.
Further localise options in to logical groups.
2020-01-13 Revert max rssi to 254. 255 is invalid/unknown in ardupilot
v2.51 2020-01-18 Make default rssi 69% for SiK radios, like RFD900x. PR by Hasi123
v2.52 2020-01-21 Support web OTA. Rehash STA to AP failover using reboot - now stable.
v2.53 2020-01-25 ESP8266 (Node MFU 12F) debugged, tested. ESP8266 OTA included.
v2.54 2020-01-27 ESP8266 inverted single-wire enabled, like Teensy.
No hardware invert/convert required.
v2.54a 2020-01-28 Setup OTA password in config.h
v2.54b 2020-01-30 Correct irritating warnings
v2.55 2020-02-04 Add RFD900X TXMOD ESP8266 variant
v2.56.1 2020-02-26 Add web interface to allow settings/parameter changes
v2.56.2 2020-02-27 STM32F103C / Blue Pill / Maple Mini deprecated. Tidy up Teensy3.x warnings.
v2.56.3 2020-03-03 Minor ESP8266 variants logic check
v2.56.4 2020-03-04 Remove spurious debugging code affecting S.Port Thanks pascale dragos.
v2.56.5 2020-03-09 Reduce rssi timing cycle to 350mS from 700mS.
v2.57 2020-03-15 Fix RFD900/TXMOD status LED. SoftwareSerial for ESP32.
v2.58 2020-03-17 Option to work around apparent bug in Mavlink V2 Library. Tolerate crc errors.
This fixes failure to parse certain mavlink messages, including #226 RPM
Needs more investigation. Use with caution!
v2.58.1 2020-03-18 Improve user options on hw/sw serial
v2.58.2 2020-03-20 Stable. Lots of nice, small tweaks. Exp. code for inherent 1-wire on ESP
v2.58.3 2020-03-22 Deactivate experimental CRC error tolerance for general use. My bad, sorry!
*/
Trying the build the project (2.58.4) gives this result:
> Executing task: platformio run <
Processing esp12e (platform: espressif8266; board: esp12e; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp12e.html
PLATFORM: Espressif 8266 2.4.0 > Espressif ESP8266 ESP-12E
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
- framework-arduinoespressif8266 3.20603.200130 (2.6.3)
- tool-esptool 1.413.0 (4.13)
- tool-esptoolpy 1.20800.0 (2.8.0)
- toolchain-xtensa 2.40802.191122 (4.8.2)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 38 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <c_library_v2-master>
|-- <ESP8266WebServer> 1.0
| |-- <ESP8266WiFi> 1.0
|-- <Wire> 1.0
|-- <My_Patched_ESP32_SD_Library>
| |-- <SPI> 1.0
|-- <CircularBuffer> 1.2.0
|-- <SPI> 1.0
|-- <ESP8266WiFi> 1.0
|-- <EEPROM> 1.0
|-- <Adafruit SSD1306> 2.2.0
| |-- <Adafruit GFX Library> 1.5.6
| | |-- <SPI> 1.0
| |-- <SPI> 1.0
| |-- <Wire> 1.0
|-- <EspSoftwareSerial> 6.7.1
|-- <Update> 1.0
Building in release mode
Compiling .pio/build/esp12e/src/main.cpp.o
Generating LD script .pio/build/esp12e/ld/local.eagle.app.v6.common.ld
Archiving .pio/build/esp12e/libb9f/libc_library_v2-master.a
Indexing .pio/build/esp12e/libb9f/libc_library_v2-master.a
Compiling .pio/build/esp12e/libb8b/ESP8266WiFi/BearSSLHelpers.cpp.o
Compiling .pio/build/esp12e/libb8b/ESP8266WiFi/CertStoreBearSSL.cpp.o
Compiling .pio/build/esp12e/libb8b/ESP8266WiFi/ESP8266WiFi.cpp.o
In file included from src/main.cpp:142:0:
include/config.h:246:0: warning: "GCS_Mavlink_IO" redefined [enabled by default]
#define GCS_Mavlink_IO 2 // WiFi Only
^
include/config.h:65:0: note: this is the location of the previous definition
#define GCS_Mavlink_IO 3 // WiFi AND Bluetooth simultaneously - ESP32 only
^
In file included from lib/c_library_v2-master/ardupilotmega/../mavlink_helpers.h:13:0,
from lib/c_library_v2-master/ardupilotmega/../protocol.h:75,
from lib/c_library_v2-master/ardupilotmega/ardupilotmega.h:30,
from lib/c_library_v2-master/ardupilotmega/mavlink.h:32,
from src/main.cpp:146:
lib/c_library_v2-master/ardupilotmega/../mavlink_sha256.h:77:0: warning: "F" redefined [enabled by default]
#define F m->counter[5]
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:242:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:39:0: note: this is the location of the previous definition
#define F(string_literal) (FPSTR(PSTR(string_literal)))
^
In file included from src/main.cpp:142:0:
include/config.h:485:26: error: redefinition of 'const uint8_t D0'
static const uint8_t D0 = 16; // SCL - optional
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:286:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu/pins_arduino.h:40:22: error: 'const uint8_t D0' previously defined here
static const uint8_t D0 = 16;
^
In file included from src/main.cpp:142:0:
include/config.h:486:26: error: redefinition of 'const uint8_t D1'
static const uint8_t D1 = 5; // SDA - optional
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:286:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu/pins_arduino.h:41:22: error: 'const uint8_t D1' previously defined here
static const uint8_t D1 = 5;
^
In file included from src/main.cpp:142:0:
include/config.h:487:26: error: redefinition of 'const uint8_t D2'
static const uint8_t D2 = 4; // SPort half-duplex
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:286:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu/pins_arduino.h:42:22: error: 'const uint8_t D2' previously defined here
static const uint8_t D2 = 4;
^
In file included from src/main.cpp:142:0:
include/config.h:488:26: error: redefinition of 'const uint8_t D3'
static const uint8_t D3 = 0; // Flash
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:286:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu/pins_arduino.h:43:22: error: 'const uint8_t D3' previously defined here
static const uint8_t D3 = 0;
^
In file included from src/main.cpp:142:0:
include/config.h:489:26: error: redefinition of 'const uint8_t D4'
static const uint8_t D4 = 2; // BoardLED & TXD1 optional debug out
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:286:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu/pins_arduino.h:44:22: error: 'const uint8_t D4' previously defined here
static const uint8_t D4 = 2;
^
In file included from src/main.cpp:142:0:
include/config.h:490:26: error: redefinition of 'const uint8_t D5'
static const uint8_t D5 = 14; // SPort rx (unused in half-duplex)
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:286:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu/pins_arduino.h:45:22: error: 'const uint8_t D5' previously defined here
static const uint8_t D5 = 14;
^
In file included from src/main.cpp:142:0:
include/config.h:491:26: error: redefinition of 'const uint8_t D6'
static const uint8_t D6 = 12; // P2-3 exposed dual row of pins
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:286:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu/pins_arduino.h:46:22: error: 'const uint8_t D6' previously defined here
static const uint8_t D6 = 12;
^
In file included from src/main.cpp:142:0:
include/config.h:492:26: error: redefinition of 'const uint8_t D7'
static const uint8_t D7 = 13; // CTS
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:286:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu/pins_arduino.h:47:22: error: 'const uint8_t D7' previously defined here
static const uint8_t D7 = 13;
^
In file included from src/main.cpp:142:0:
include/config.h:493:26: error: redefinition of 'const uint8_t D8'
static const uint8_t D8 = 15; // RTS
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:286:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu/pins_arduino.h:48:22: error: 'const uint8_t D8' previously defined here
static const uint8_t D8 = 15;
^
In file included from src/main.cpp:142:0:
include/config.h:494:26: error: redefinition of 'const uint8_t D9'
static const uint8_t D9 = 3; // RXD0
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:286:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu/pins_arduino.h:49:22: error: 'const uint8_t D9' previously defined here
static const uint8_t D9 = 3;
^
In file included from src/main.cpp:142:0:
include/config.h:495:26: error: redefinition of 'const uint8_t D10'
static const uint8_t D10 = 1; // TXD0
^
In file included from /Users/giacomo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:286:0,
from src/main.cpp:1:
/Users/giacomo/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu/pins_arduino.h:50:22: error: 'const uint8_t D10' previously defined here
static const uint8_t D10 = 1;
^
Compiling .pio/build/esp12e/libb8b/ESP8266WiFi/ESP8266WiFiAP.cpp.o
Compiling .pio/build/esp12e/libb8b/ESP8266WiFi/ESP8266WiFiGeneric.cpp.o
Compiling .pio/build/esp12e/libb8b/ESP8266WiFi/ESP8266WiFiMulti.cpp.o
src/main.cpp: In function 'void Write_To_FC(uint32_t)':
src/main.cpp:1240:17: warning: unused variable 'msgSent' [-Wunused-variable]
bool msgSent = Send_TCP(&G2Fmsg); // to FC
^
src/main.cpp:1247:17: warning: unused variable 'msgRead' [-Wunused-variable]
bool msgRead = Send_UDP(&G2Fmsg); // to FC
^
src/main.cpp: In function 'void Send_From_RingBuf_To_GCS()':
src/main.cpp:1313:16: warning: unused variable 'sentOK' [-Wunused-variable]
bool sentOK = Send_TCP(&R2Gmsg); // to GCS
^
src/main.cpp: In function 'void RefreshHTMLButtons()':
src/main.cpp:5575:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.trmode1 = "checked";
^
src/main.cpp:5576:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.trmode2 = "";
^
src/main.cpp:5577:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.trmode3 = "";
^
src/main.cpp:5580:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.trmode1 = "";
^
src/main.cpp:5581:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.trmode2 = "checked";
^
src/main.cpp:5582:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.trmode3 = "";
^
src/main.cpp:5585:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.trmode1 = "";
^
src/main.cpp:5586:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.trmode2 = "";
^
src/main.cpp:5587:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.trmode3 = "checked";
^
src/main.cpp:5591:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io0 = "checked";
^
src/main.cpp:5592:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io1 = "";
^
src/main.cpp:5593:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io2 = "";
^
src/main.cpp:5594:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io3 = "";
^
src/main.cpp:5597:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io0 = "";
^
src/main.cpp:5598:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io1 = "checked";
^
src/main.cpp:5599:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io2 = "";
^
src/main.cpp:5600:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io3 = "";
^
src/main.cpp:5603:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io0 = "";
^
src/main.cpp:5604:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io1 = "";
^
src/main.cpp:5605:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io2 = "checked";
^
src/main.cpp:5606:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io3 = "";
^
src/main.cpp:5609:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io0 = "";
^
src/main.cpp:5610:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io1 = "";
^
src/main.cpp:5611:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io2 = "";
^
src/main.cpp:5612:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.fc_io3 = "checked";
^
src/main.cpp:5625:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io0 = "";
^
src/main.cpp:5626:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io1 = "checked";
^
src/main.cpp:5627:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io2 = "";
^
src/main.cpp:5628:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io3 = "";
^
src/main.cpp:5629:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io9 = "";
^
src/main.cpp:5632:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io0 = "";
^
src/main.cpp:5633:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io1 = "";
^
src/main.cpp:5634:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io2 = "checked";
^
src/main.cpp:5635:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io3 = "";
^
src/main.cpp:5636:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io9 = "";
^
src/main.cpp:5639:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io0 = "";
^
src/main.cpp:5640:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io1 = "";
^
src/main.cpp:5641:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io2 = "";
^
src/main.cpp:5642:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io3 = "checked";
^
src/main.cpp:5643:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io9 = "";
^
src/main.cpp:5646:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io0 = "";
^
src/main.cpp:5647:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io1 = "";
^
src/main.cpp:5648:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io2 = "";
^
src/main.cpp:5649:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io3 = "";
^
src/main.cpp:5650:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_io9 = "checked";
^
src/main.cpp:5654:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_sd0 = "checked";
^
src/main.cpp:5655:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_sd1 = "";
^
src/main.cpp:5658:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_sd0 = "";
^
src/main.cpp:5659:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.gs_sd1 = "checked";
^
src/main.cpp:5663:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfmode1 = "checked";
^
src/main.cpp:5664:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfmode2 = "";
^
src/main.cpp:5665:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfmode3 = "";
^
src/main.cpp:5668:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfmode1 = "";
^
src/main.cpp:5669:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfmode2 = "checked";
^
src/main.cpp:5670:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfmode3 = "";
^
src/main.cpp:5673:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfmode1 = "";
^
src/main.cpp:5674:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfmode2 = "";
^
src/main.cpp:5675:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfmode3 = "checked";
^
src/main.cpp:5679:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfproto1 = "checked";
^
src/main.cpp:5680:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfproto2 = "";
^
src/main.cpp:5683:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfproto1 = "";
^
src/main.cpp:5684:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.wfproto2 = "checked";
^
src/main.cpp:5688:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.btmode1 = "checked";
^
src/main.cpp:5689:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.btmode2 = "";
^
src/main.cpp:5692:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.btmode1 = "";
^
src/main.cpp:5693:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
set.btmode2 = "checked";
^
Compiling .pio/build/esp12e/libb8b/ESP8266WiFi/ESP8266WiFiSTA-WPS.cpp.o
In file included from src/main.cpp:142:0:
include/config.h: At global scope:
include/config.h:571:23: warning: 'dt_tm' defined but not used [-Wunused-variable]
static DateTime_t dt_tm;
^
*** [.pio/build/esp12e/src/main.cpp.o] Error 1
================================================ [FAILED] Took 7.62 seconds
If you need more infos, I'm here.
Thanks for taking a look
Hello Eric,
I have a Horus X10 with a Dragonlink v3 configured to mavlink transmission.
My setup is Pixhack v3 (Ardupilot 3.9.2) ---> Dragonlink microRX ---> Dragonlink TX (with MavLink Decoding) ---> Frsky R-XSR ---> Frsky HORUS X10, between Dragonlink TX and R-XSR script v.1.05 running on a Teensy 3.2 in Relay Mode.
When I run the yaapu lua script all indicators start to display incorrect information. Any, on the wrong.
Here is the log Debug_All.txt
I don't know why. I need your help.
Best regards, Kirill.
Hello,
I got this converter working yesterday and i have to admit it is awesome. Two minor things still to solve:
There is not GPS location displayed on the telemetry screen. GPS fix is ok. Rhe display can show fix info, but no location. Is it safe to assume that it should appear there automatically and if not then this information is missing from telemetry feed?
No flightmode is shown on screen. Same with previous, should it appear there automatically?
I'm using PX4 (v 1.9), And Jumper T16 with FrSky X8R receiver. Yaapu script version 1.8.0
Where and how should I start debugging these issues?
i used esp3212 with v2.20 ,prompt information is ‘serial2’ was not decleared in this scope.
In Air Mode set.trmode==2 . In FrSkySPortPT lines 63-65 #if (defined ESP32) you have set.trmode = ground; and then if (set.trmode == ground ) which is always. So ESP32 S.Port pins will be always inverted and settings for Air or Relay Mode are not taken into account
Hardware is Heltec Wifi Kit 32
Exact steps taken:
Commenting out the webSupport define makes a wifi network appear, but breaks the oled screen, removing all newlines. It is also impossible to connect to this network with the password set in config.h
Hello Eric,
my name is Markus and I am one of the ArduPilot neerds like to fly planes which a lot of telemetry :-)
At current I have a FrSky Horus X12S and a FrSky Taranis x9d+. For the telemetry I use the yaapy lua script from Alex. He was so kind to extend the script that I be able to display also external sensors from the S.Bus.
So far so nice.
Now I like to transfer Mavlink inforamtions to external sensors on the FrSky.
For example the rc in and out values or the air- and groundspeed from the Mission Planer HUD:
I try it with the MavLink_FrSkySPort from Keen (althertop). But there are to many sensors and and it work together with the yaapu. So I ask him how to switch the unneded off. He suggest your new release as a good solution.
I downloaded it in a Teensy 3.2 and select the Air_Mode.
Together with the yaapu script on the x9d+ it runs well a few minutes and then the telemetrie stop.
The receiver is running well, also the S.Bus for the external devices like rpm sensor or batt sensor.
After a restart same issue again.
Also I have a second question.
Is it possible to transfer the rc in, rc out and HUD informations to the external sensors?
Like Alex it did with a few of the sensors in his script.
Cheers, Markus
pt_imu_temp is defined as uint8_t.
The code assigns it a value from ap26_temp without a cast: pt_imu_temp = ap26_temp;
ap26_temp is int16_t.
16-bits vs. 8 bits and a signed value to unsigned value. Please check/revise.
In case only raw IMU values are sent on MAVLink, then ap27_temp could also be considered as source for pt_imu_temp.
Please check the comment - only 2+2 bits are being packed:
https://github.com/zs6buj/MavlinkToPassthru/blob/0f469ce22c8c3f8d7d224751a2ccf244df9069f8/MavToPass_v2.63.11/FrSky_Ports.h#L1794-L1795
as prep_number returns uint16_t.
The sign of the return value is in the 8th bit, thus in MSByte. With 2,1 parameter, prep_number() returns following limits:
0 1111 1110 = +127
1 1111 1110 = -127
0 1111 1111 = +1270
1 1111 1111 = -1270
Hello, could you make a step by step video or tutorial for people without arduino knowledge to make it work? I am not able to get it to work, arduino gives me many bugs that will not be fixed.
I am using this esp32 board: https://es.aliexpress.com/item/32864722159.html?spm=a2g0s.9042311.0.0.649163c0KGZEKh
a greeting
Altitude can be negative (below sea-level), all the variables are correctly int32_t, but the sign is capped at line 1820 and a constant 0 is output wrongly here (bit 31 for 0x5002 FrSky msg).
Try to complie v2.63.4 for dragonlink. Only changed
//#define displaySupport
#define ESP32_Variant 3 // Dragonlink V3 slim with internal ESP32 - contributed by Noircogi
And try to verify. But it hit #error "Unsupported board type!". It seems ESP32 is not defined. But I did select ESP32_Variant 3.
Error message
`Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Delong\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Delong\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Delong\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10813 -build-path C:\Users\Delong\AppData\Local\Temp\arduino_build_374109 -warnings=none -build-cache C:\Users\Delong\AppData\Local\Temp\arduino_cache_790209 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Delong\Downloads\MavlinkToPassthru-master\MavlinkToPassthru-master\MavToPass_v2.63.4\MavToPass_v2.63.4.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Delong\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Delong\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Delong\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10813 -build-path C:\Users\Delong\AppData\Local\Temp\arduino_build_374109 -warnings=none -build-cache C:\Users\Delong\AppData\Local\Temp\arduino_cache_790209 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Delong\Downloads\MavlinkToPassthru-master\MavlinkToPassthru-master\MavToPass_v2.63.4\MavToPass_v2.63.4.ino
Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Delong\AppData\Local\Temp\arduino_build_374109\sketch\MavToPass_v2.63.4.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for CircularBuffer.h: [[email protected]]
ResolveLibrary(CircularBuffer.h)
-> candidates: [[email protected]]
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Users\Delong\Documents\Arduino\libraries\CircularBuffer-master" "C:\Users\Delong\AppData\Local\Temp\arduino_build_374109\sketch\MavToPass_v2.63.4.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for mavlink_types.h: [c_library_v2]
ResolveLibrary(mavlink_types.h)
-> candidates: [c_library_v2]
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Users\Delong\Documents\Arduino\libraries\CircularBuffer-master" "-IC:\Users\Delong\Documents\Arduino\libraries\c_library_v2" "C:\Users\Delong\AppData\Local\Temp\arduino_build_374109\sketch\MavToPass_v2.63.4.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Error while detecting libraries included by C:\Users\Delong\AppData\Local\Temp\arduino_build_374109\sketch\MavToPass_v2.63.4.ino.cpp
Generating function prototypes...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Users\Delong\Documents\Arduino\libraries\CircularBuffer-master" "-IC:\Users\Delong\Documents\Arduino\libraries\c_library_v2" "C:\Users\Delong\AppData\Local\Temp\arduino_build_374109\sketch\MavToPass_v2.63.4.ino.cpp" -o "C:\Users\Delong\AppData\Local\Temp\arduino_build_374109\preproc\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE
In file included from C:\Users\Delong\Downloads\MavlinkToPassthru-master\MavlinkToPassthru-master\MavToPass_v2.63.4\MavToPass_v2.63.4.ino:142:0:
config.h:213:4: error: #error "Unsupported board type!"
#error "Unsupported board type!"
^~~~~
config.h:283:8: error: #error Bluetooth works only on an ESP32 board
#error Bluetooth works only on an ESP32 board
^~~~~
Using library CircularBuffer-master at version 1.2.0 in folder: C:\Users\Delong\Documents\Arduino\libraries\CircularBuffer-master
Using library c_library_v2 in folder: C:\Users\Delong\Documents\Arduino\libraries\c_library_v2 (legacy)
exit status 1
#error "Unsupported board type!"
`
config.h
`//=================================================================================================
//=================================================================================================
//
// C O N F I G U R A T I O N
//
M o s t R e c e n t C h a n g e s
===================================================================================================
Complete change log and debugging options are at the bottom of this tab
v2.63.4 2020-11-17 Support simultaneous wifi uplink and downlink (AP_STA mode)
*/
//===========================================================================================
//
// PLEASE SELECT YOUR DEFAULT OPTIONS BELOW BEFORE COMPILING
//
// Most of the settings below are saved to EEPROM the first time mav2pt runs
// Use the web interface to change them, or Reset_Web_Defaults below
//
//===========================================================================================
// Most of the settings below are saved to EEPROM the first time mav2pt runs
//#define Reset_Web_Defaults // Reset settings in eeprom. Do this if you suspect eeprom settings are corrupt USE SPARINGLY
// Choose either S.Port or F.Port or None
//#define FrSky_Port_Type 0 // No FrSky Port support needed. Now I'm a "Mavlink Switch"
#define FrSky_Port_Type 1 // S.Port
//#define FrSky_Port_Type 2 // F.Port v1/v2 FrSky ISRM/ACCESS capable transmitters and receivers only
//#define Uninverted_FrSky_Receiver_Pad // S.Port is usually INVERTED (idle low). F.Port is always UNINVERTED (idle high)
#define Device_sysid 251 // Our Mavlink Identity - APM FC is 1, Mission Planner is 255, QGC default is 0
#define Device_compid MAV_COMP_ID_PERIPHERAL // 158 Generic autopilot peripheral - APM FC is 1, MP is 190, QGC is https://mavlink.io/en/messages/common.html
#define webSupport // ESP only. Enable wifi web support, including OTA firmware updating. Browse to IP.
#define webPassword "changeme!" // Web password
//#define displaySupport // Enable if you have a display attached - choose display type where board variant is defined
//#define AutoBaud // Auto detect Mavlink serial-in baud rate
// NOTE: Set mvBaud = 57600 for Dragonlink and RFD900X
#define mvBaud 57600 // Mavlink to/from the flight controller - max 921600 - must match FC or long range radio
// Do not enable for FlightDeck
#define PlusVersion // Added support for 0x5009 Mission WPs, 0x50F1 Servo_Channels, 0x50F2 VFR_Hud
//=================================================================================================
// D E F A U L T T R A N S L A T I O N M O D E S E T T I N G S
//=================================================================================================
// Choose only one of these three translation modes
#define Ground_Mode // Translator between Taranis et al and LRS transceiver (like Dragonlink, ULRS, RFD900...)
//#define Air_Mode // Translator between FrSky receiver (like XRS) and Flight Controller (like Pixhawk)
//#define Relay_Mode // Translator between LRS tranceiver (like Dragonlink) and FrSky receiver (like XRS) in relay box on the ground
//=================================================================================================
// D E F A U L T U P L I N K ( F C ) S E T T I N G S
//=================================================================================================
// Choose only one of these default Flight-Controller-side I/O channels
// How does Mavlink telemetry enter this translator?
#define FC_Mavlink_IO 0 // Serial Port (default)
//#define FC_Mavlink_IO 1 // BlueTooth Classic - ESP32 only
//#define FC_Mavlink_IO 2 // WiFi - ESP32 or ESP8266 only
//#define FC_Mavlink_IO 3 // SD Card / TF - ESP32 only
//=================================================================================================
// D E F A U L T D O W N L I N K ( G C S ) S E T T I N G S
//=================================================================================================
// Choose only one of these default GCS-side I/O channels
// How does Mavlink telemetry leave this translator?
// These are optional, and in addition to the F.Port telemetry output
//#define GCS_Mavlink_IO 0 // Serial Port - simultaneous uplink and downlink serial not supported. Not enough uarts.
//#define GCS_Mavlink_IO 1 // BlueTooth Classic - ESP32 only
//#define GCS_Mavlink_IO 2 // WiFi - ESP32 or ESP8266 only - auto selects on ESP8266
#define GCS_Mavlink_IO 3 // WiFi AND Bluetooth simultaneously. DON'T DO THIS UNLESS YOU NEED IT. SRAM is scarce! - ESP32 only
#ifndef GCS_Mavlink_IO
#define GCS_Mavlink_IO 9 // NONE (default)
#endif
// NOTE: The Bluetooth class library uses a lot of application memory. During Compile/Flash
// you may need to select Tools/Partition Scheme: "Minimal SPIFFS (1.9MB APP ...) or similar
//#define GCS_Mavlink_SD // SD Card - ESP32 only - mutually inclusive with GCS I/O
//#define FPort_To_SD // SD Card - ESP32 only - mutually inclusive with F.Port
//=================================================================================================
//=================================================================================================
// S E L E C T E S P B O A R D V A R I A N T
//=================================================================================================
//=================================================================================================
//#define ESP32_Variant 1 // ESP32 Dev Module - Use Partition Scheme: "Minimal SPIFFS(1.9MB APP...)"
//#define ESP32_Variant 2 // Wemos® LOLIN ESP32-WROOM-32_OLED_Dual_26p
#define ESP32_Variant 3 // Dragonlink V3 slim with internal ESP32 - contributed by Noircogi
//#define ESP32_Variant 4 // Heltec Wifi Kit 32 - Use Partition Scheme: "Minimal SPIFFS(Large APPS with OTA)" - contributed by Noircogi
//#define ESP32_Variant 5 // LILYGO® TTGO T-Display ESP32 1.14" ST7789 Colour LCD
//#define ESP32_Variant 6 // LILYGO® TTGO T2 SD SSD1331 TFT Colour 26pin - 16Ch x 8 lines (H 96 x W 64 in portrait)
//#define ESP8266_Variant 1 // NodeMCU ESP 12F - choose "NodeMCU 1.0(ESP-12E)" board in the IDE
#define ESP8266_Variant 2 // ESP-12E, ESP-F barebones boards. RFD900X TX-MOD, QLRS et al - use Generic ESP8266 on IDE
//#define ESP8266_Variant 3 // ESP-12F - Wemos® LOLIN D1 Mini
//=================================================================================================
//=================================================================================================
// D E F A U L T B L U E T O O T H S E T T I N G S
//=================================================================================================
//#define BT_Mode 1 // Master Mode - active, initiate connection with slave (name)
#define BT_Mode 2 // Slave Mode - passive, advertise our hostname & wait for master to connect to us
#define BT_ConnectToSlave "Crossfire 0277" // Example
//=================================================================================================
// D E F A U L T W I F I S E T T I N G S
//=================================================================================================
#define Start_WiFi // Start WiFi at startup, override startWiFi pin
#define HostName "MavToPass" // This translator's host name
#define APssid "MavToPassthru" // The AP SSID that we advertise ====>
#define APpw "password" // Change me! Must be >= 8 chars
#define APchannel 9 // The wifi channel to use for our AP
#define STAssid "OmegaOffice" // Target AP to connect to (in STA mode) <====
#define STApw "Navara@98" // Target AP password (in STA mode). Must be >= 8 chars
// Choose one default mode for ESP only - AP means advertise as an access point (hotspot). STA means connect to a known host
//#define WiFi_Mode 1 //AP
//#define WiFi_Mode 2 // STA
#define WiFi_Mode 3 // (STA>AP) STA failover to AP
// Choose one default protocol - for ESP32 only
//#define WiFi_Protocol 1 // TCP/IP
#define WiFi_Protocol 2 // UDP
//#define UDP_Broadcast // Comment out (default) if you want to track and target remote udp client ips
// NOTE; UDP is not a connection based protocol. To communicate with > 1 client at a time, we must broadcast on the subnet
//=================================================================================================
// R S S I O P T I O N S
//=================================================================================================
#define Rssi_Pacemaker 200 // mS. RSSI 0xF101 frame sent with this period regardless of rate of RSSI arrival
#define RSSI_Override 70 // Only if (RSSI == 0) force it to value, but only sent when Mavlink good.)
//#define Rssi_In_Percent // Un-comment if RSSI is already in %, not relative to (254->100%)
//#define QLRS // QLRS Longe Range System uses remote rssi field - PR from giocomo892 april 2020)
// RSSI_Source is automatic. Order of precedence:
// First: #109 SiK style RADIO_STATUS
// Second: #65 RC_CHANNELS
// Third: #35 RC_CHANNELS_RAW
//=================================================================================================
// O T H E R U S E R O P T I O N S
//=================================================================================================
//defined PitLab // Uncomment me to force PitLab OSD stack
//#define Battery_mAh_Source 1 // Get battery mAh from the FC - note both rx and tx lines must be connected
//#define Battery_mAh_Source 2 // Define bat1_capacity and bat2_capacity below and use those
const uint16_t bat1_capacity = 5200;
const uint16_t bat2_capacity = 0;
#define Battery_mAh_Source 3 // Define battery mAh in the LUA script on the Taranis/Horus - Recommended
// Status_Text messages place a huge burden on the meagre 4 byte FrSky telemetry payload bandwidth
// The practice has been to send them 3 times to ensure that they arrive unscathed at the receiver
// but that makes the bandwidth limitation worse and may crowd out other message types. Try without
// sending 3 times, but if status_text gets distorted, un-comment the next line
//#define Send_status_Text_3_Times
//#define Send_Sensor_Health_Messages
//#define Request_Missions_From_FC // Un-comment if you need mission waypoint from FC - NOT NECESSARY RIGHT NOW
//#define Data_Streams_Enabled // Requests data streams from FC. Requires both rx and tx lines to FC. Rather set SRn in Mission Planner
//================================== Set your time zone here ======================================
// Only for SD / TF Card adapter option
// Date and time determines the TLog file name only
//const float Time_Zone = 10.5; // Adelaide, Australia
const float Time_Zone = 2.0; // Jo'burg
bool daylightSaving = false;
//=================================================================================================
// E X P E R I M E N T A L O P T I O N S
// Don't change anything here unless you are confident you know the outcome
//#define ESP32_SoftwareSerial // otherwise HardwareSerial is used
//#define ESP_Air_Relay_Blind_Inject_OK // Blind inject instead of interleaving
//#define Support_MavLite
//=================================================================================================
// Auto Determine Target Platform
//=================================================================================================
//
// Don't change anything here
//
#if defined (MK20DX128) || defined(MK20DX256)
#define TEENSY3X
#elif defined ESP32
#define Target_Board 3 // Espressif ESP32 Dev Module
#elif defined ESP8266
#define Target_Board 4 // Espressif ESP8266
#else
#error "Unsupported board type!"
#endif
//=================================================================================================
// CHECK #MACRO OPTIONS LOGIC
//=================================================================================================
#if defined PlusVersion
#define Request_Mission_Count_From_FC // Needed for yaapu's mission/waypoint script
#endif
#if (not defined ESP32) && (not defined ESP8266)
#if defined webSupport
#undef webSupport
// #error webSupport only available on ESP32 or ESP8266
#endif
#endif
#if defined ESP32
#include
#include
#include <driver/uart.h> // In Arduino ESP32 install repo
//C:\Users<YourName>\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\tools\sdk\include\driver
#endif
#if (defined ESP32) || (defined ESP8266) // ESP32 or ESP8266 (UART0, UART1, and UART2)
#if (frPort_Serial == 3)
#error Board does not have Serial3. This configuration is not possible.
#endif
#endif
#if (defined TEENSY3X)
#if (FC_Mavlink_IO == 3) || (defined GCS_Mavlink_SD)
#error SD card not currently implemented for Teensy
#endif
#endif
#ifndef Battery_mAh_Source
#error Please choose at least one Battery_mAh_Source
#endif
#if (defined TEENSY3X)
#if defined webSupport
#undef webSupport
#endif
#if defined FC_Mavlink
#undef FC_Mavlink
#endif
#if defined FC_Mavlink_IO
#undef FC_Mavlink_IO
#define FC_Mavlink_IO 0
#endif
#if defined GCS_Mavlink_IO
#undef GCS_Mavlink_IO
#endif
#define GCS_Mavlink_IO 9
#if (FC_Mavlink_IO == 2) || (GCS_Mavlink_IO == 2) || (GCS_Mavlink_IO == 3) || (defined webSupport) // if wifi selected
#error WiFi and webSupport only work on an ESP32 or ESP8266 board
#endif
#endif
#if (defined ESP8266) && ((GCS_Mavlink_IO == 1) || (GCS_Mavlink_IO == 3)) // Can't do BT on 8266
#undef GCS_Mavlink_IO
#define GCS_Mavlink_IO 2 // WiFi Only
#endif
#if (FC_Mavlink_IO == 1) || (GCS_Mavlink_IO == 1) || (GCS_Mavlink_IO == 3)
#if (not defined ESP32)
#error Bluetooth works only on an ESP32 board
#else
#if (not defined BT_Mode)
#error Please define BT_Mode
#endif
#endif
#endif
#ifndef FC_Mavlink_IO
#error Please choose at least one Mavlink FC IO channel
#endif
#if (defined ESP32)
#ifndef WiFi_Mode
#error Please define WiFi_Mode
#endif
#endif
#if (defined ESP32)
#ifndef WiFi_Protocol
#error Please define WiFi_Protocol
#endif
#endif
#if (defined ESP32)
#ifndef ESP32_Variant
#error Please define an ESP32 board variant
#endif
#endif
#if (defined ESP8266)
#ifndef ESP8266_Variant
#error Please define an ESP8266 board variant
#endif
#endif
#if ((FrSky_Port_Type == 0) && (defined TEENSY3X) )
#error Are you sure you want no FrSky port support on this Teensy 3.x?
#endif
#if (FrSky_Port_Type == 1 || FrSky_Port_Type == 2)
#define frBuiltin // for S.Port or F.Port we need FrSky_Port support compiled in
#endif
#if (defined ESP32 || defined ESP8266) && (FC_Mavlink_IO == 2 || FC_Mavlink_IO == 3 || GCS_Mavlink_IO == 2 || GCS_Mavlink_IO == 3 || defined webSupport)
#define wifiBuiltin // for these features we need wifi support compiled in
#endif
#if (defined ESP32) && (FC_Mavlink_IO == 1 || FC_Mavlink_IO == 3 || GCS_Mavlink_IO == 1 || GCS_Mavlink_IO == 3)
#define btBuiltin // for these features we need bluetooth support compiled in
#endif
#if (defined ESP32 || defined ESP8266) && ((FC_Mavlink_IO == 3) || (defined GCS_Mavlink_SD) || (defined FPort_To_SD) ) // SD Card / TF - ESP32 only
#define sdBuiltin
#endif
#if defined ESP_Onewire
#if not defined ESP32_SoftwareSerial
#error ESP_Onewire is predicated on ESP32_SoftwareSerial
#endif
#endif
#if (FC_Mavlink_IO == 0 && GCS_Mavlink_IO == 0)
#error Similtaneous serial uplink and serial downlink not supported. Not enough uarts.
#endif
#if (not defined FrSky_Port_Type)
#error define FrSky_Port_Type, None or SPort_Version or FPort_Version
#endif
//=================================================================================================
// P L A T F O R M D E P E N D E N T S E T U P S
//=================================================================================================
#if defined TEENSY3X // Teensy3x
#define Teensy_One_Wire // default half-duplex
#define MavStatusLed 13
#define InvertMavLed false
#define BufStatusLed 14
#define mav_rxPin 9
#define mav_txPin 10
#define frPort_Serial 1 // Teensy F/SPort port1=pin1, port3=pin8. The default is Serial 1, but 3 is possible
#if (frPort_Serial == 1)
#define fr_rxPin 0 // FPort rx - optional
#define fr_txPin 1 // FPort tx - Use me in single wire mode
#define GC_Mav_rxPin 7
#define GC_Mav_txPin 8
#elif (frPort_Serial == 3)
#define fr_txPin 7 // Optional FPort rx
#define fr_txPin 8 // Optional FPort tx - use me in single wire mode
#endif
#undef displaySupport // no Teensy display support for now
#if (defined sdBuiltin) || (defined displaySupport)
#endif
#elif defined ESP32 // ESP32 Platform
//=========================================================================
// N O T E: G P I O 1 2 is a bootstrap pin on the ESP32 - avoid GPIO12 high on bootup
#if (ESP32_Variant == 1) // ESP32 Dev Module
#define MavStatusLed 02 // Onboard LED
#define InvertMavLed false
#define BufStatusLed 27 // untested pin
#define mav_rxPin 16 // Mavlink serial rx
#define mav_txPin 17 // Mavlink serial tx
#define fr_rxPin 13 // FPort- Not used in 1-wire mode DON'T use 12!
#define fr_txPin 4 // FPorttx - Use me in single wire mode
#define startWiFiPin 5 // 5 Trigger WiFi startup
#if (defined displaySupport) // Display type defined with board variant
#define SSD1306_Display // OLED display type
/* Below please choose either Touch pin-pair or Digital pin-pair for display scrolling
* Pin == 99 means the pin-pair is not used
*/
#define Pinfo 99 // Digital pin to toggle information/log page
#define Pup 99 // 35 Board Button 1 to scroll the display up
#define Pdn 99 // 0 Board Button 2 to scroll the display down
#define Tinfo 15 // 15 Touch pin to toggle information/log page
#define Tup 33 // 33 Touch pin to scroll the display up
#define Tdn 32 // 32 Touch pin to scroll the display down
#define SDA 21 // I2C OLED board
#define SCL 22 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#endif
/*
SPI/CS Pin 05 For optional TF/SD Card Adapter
SPI/MOSI Pin 23 For optional TF/SD Card Adapter
SPI/MISO Pin 19 For optional TF/SD Card Adapter
SPI/SCK Pin 18 For optional TF/SD Card Adapter
*/
#endif
//=========================================================================
#if (ESP32_Variant == 2) // Wemos® LOLIN ESP32-WROOM-32_OLED_Dual_26p
#define MavStatusLed 15 // No Onboard LED
#define InvertMavLed false
#define BufStatusLed 99 // None
#define mav_rxPin 25 // Mavlink serial rx
#define mav_txPin 26 // Mavlink serial tx
#define fr_rxPin 13 // FPort- Not used in single wire mode DON'T use 12!
#define fr_txPin 14 // FPorttx - Use me in single wire mode
#define startWiFiPin 18 // Trigger WiFi startup
#if (defined displaySupport) // Display type defined with # define displaySupport
#define SSD1306_Display // OLED display type
/* Below please choose either Touch pin-pair or Digital pin-pair for display scrolling
* Pin == 99 means the pin-pair is not used
*/
#define Pinfo 99 // Digital pin to trigger information display
#define Pup 99 // 35 Board Button 1 to scroll the display up
#define Pdn 99 // 0 Board Button 2 to scroll the display down
#define Tinfo 99 // 02 Touch pin to toggle information/log page
#define Tup 99 // 33 Touch pin to scroll the display up
#define Tdn 99 // 32 Touch pin to scroll the display down
#define Tinfo 99 // Touch pin to toggle information/log page
#define SDA 05 // I2C OLED board
#define SCL 04 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#endif
#endif
#if (ESP32_Variant == 3) // Dragonlink V3 slim with internal ESP32
#if defined mvBaud
#undef mvBaud
#define mvBaud 115200 // Force baud rate to DragonLink rate
#endif
#define MavStatusLed 18 // Blue LED
#define InvertMavLed false
#define BufStatusLed 19 // Green LED
#define mav_rxPin 16 // Mavlink serial rx
#define mav_txPin 17 // Mavlink serial tx
#define fr_rxPin 13 // FPort- Not used in single wire mode DON'T use 12!
#define fr_txPin 01 // FPorttx - Use me in single wire mode
#define startWiFiPin 18 // Trigger WiFi startup
#if (defined displaySupport) // Display type defined with # define displaySupport
#define SSD1306_Display // OLED display type
/* Below please choose either Touch pin-pair or Digital pin-pair for display scrolling
* Pin == 99 means the pin-pair is not used
*/
#define Pinfo 99 // Digital pin to toggle information/log page
#define Pup 99 // 35 Board Button 1 to scroll the display up
#define Pdn 99 // 0 Board Button 2 to scroll the display down
#define Tinfo 99 // Touch pin to toggle information/log page
#define Tup 99 // 33 Touch pin to scroll the display up
#define Tdn 99 // 32 Touch pin to scroll the display down
#define SDA 05 // I2C OLED board
#define SCL 04 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#endif
#endif
//=========================================================================
#if (ESP32_Variant == 4) // Heltec Wifi Kit 32 (NOTE! 8MB)
#define MavStatusLed 25 // Onboard LED
#define InvertMavLed false
#define BufStatusLed 99 // none
#define mav_rxPin 27 // Mavlink serial rx
#define mav_txPin 17 // Mavlink serial tx
#define fr_rxPin 13 // FPort rx - (NOTE: DON'T use pin 12! boot fails if pulled high)
#define fr_txPin 14 // FPort tx - Use me in single wire mode
#define startWiFiPin 18 // Trigger WiFi startup
#if !defined displaySupport // I2C OLED board is built into Heltec WiFi Kit 32
#define displaySupport
#endif
#define SSD1306_Display // OLED display type
/* Below please choose either Touch pin-pair or Digital pin-pair for display scrolling
* Pin == 99 means the pin-pair is not used
*/
#define Pup 99 // Board Button to scroll the display up
#define Pdn 99 // Board Button to scroll the display down
#define Pinfo 99 // 02 Digital pin to toggle information/log page
#define Tup 33 // 33 Touch pin to scroll the display up
#define Tdn 32 // 32 Touch pin to scroll the display down
#define Tinfo 02 // 02 Touch pin to toggle information/log page
#define SDA 04 // I2C OLED board
#define SCL 15 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#define OLED_RESET 16 // RESET here so no reset lower down
/*
SPI/CS 05 For optional TF/SD Card Adapter
SPI/MOSI 23 For optional TF/SD Card Adapter
SPI/MISO 19 For optional TF/SD Card Adapter
SPI/SCK 18 For optional TF/SD Card Adapter
*/
#endif
//=========================================================================
#if (ESP32_Variant == 5) // LILYGO® TTGO T-Display ESP32 1.14" ST7789 Colour LCD, IDE board = "ESP32 Dev Module"
// Remember to select the T_Display board in User_Setup_Select.h in TFT_eSPI library
#define MavStatusLed 25 // Add your own LED with around 1K series resistor
#define InvertMavLed false
#define BufStatusLed 99 // none
#define mav_rxPin 27 // Mavlink serial rx
#define mav_txPin 17 // Mavlink serial tx
#define fr_rxPin 13 // FPortrx - (NOTE: DON'T use pin 12! boot fails if pulled high)
#define fr_txPin 15 // FPorttx - Use me in single wire mode
#define startWiFiPin 99 // 99=none. No input pin available (non touch!) Could use touch with a bit of messy work.
#if !defined displaySupport // I2C TFT board is built into TTGO T-Display
#define displaySupport
#endif
#define ST7789_Display // TFT display type - if you have a display you must define which type
/* Below please choose either Touch pin-pair or Digital pin-pair for display scrolling
* Pin == 99 means the pin-pair is not used
*/
#define Pinfo 2 // Digital pin to toggle information/log page
#define Pup 0 // 0 Board Button 1 to scroll the display up
#define Pdn 35 // 35 Board Button 2 to scroll the display down
#define Tinfo 99 // Touch pin to toggle information/log page
#define Tup 99 // 33 Touch pin to scroll the display up
#define Tdn 99 // 32 Touch pin to scroll the display down
//#define screenOrientation 0 // Portrait - Select one orientation only
#define screenOrientation 1 // Landscape
#define SDA 21 // I2C TFT board
#define SCL 22 // I2C TFT board
#define i2cAddr 0x3C // I2C TFT board
#endif
//=========================================================================
#if (ESP32_Variant == 6) // LILYGO® TTGO T2 SD SSD1331 TFT Colour 26pin IDE board = "ESP32 Dev Module"
#define MavStatusLed 5 // BoardLED
#define InvertMavLed true
#define BufStatusLed 99 // none
#define mav_rxPin 17 // Mavlink serial rx
#define mav_txPin 18 // Mavlink serial tx
#define fr_rxPin 19 // FPort rx - possible 22 / 23
#define fr_txPin 21 // FPort tx - Use me in single wire mode
#define startWiFiPin 99 // 99=none. No input pin available (non touch!) Could use touch with a bit of messy work.
#if !defined sdBuiltin // SD reader is built into TTGO T2
#define sdBuiltin
#endif
#if !defined displaySupport // I2C OLED board is built into TTGO T2
#define displaySupport
#endif
#define SSD1331_Display // colour TFT display type see here https://github.com/emard/ulx3s/issues/8
// software graphic display clear very slow
#define SCLK 14 // SPI pins for SSD1331
#define MOSI 13
#define MISO 12 // apparently not used by Adafruit ?
#define CS 15
#define DC 16
#define RST 4
/* Below please choose either Touch pin-pair or Digital pin-pair for display scrolling
* Pin == 99 means the pin-pair is not used
*/
#define Pinfo 25 // Digital pin to toggle information/log page
#define Pup 99 // Board Button 1 to scroll the display up
#define Pdn 99 // Board Button 2 to scroll the display down
#define Tinfo 99 // Touch pin to toggle information/log page
#define Tup 32 // Touch pin to scroll the display up
#define Tdn 2 // Touch pin to scroll the display down
#endif
#elif defined ESP8266 // ESP8266 Platform
//=========================================================================
#if (ESP8266_Variant == 1) // NodeMCU 12F board - Dev board with usb etc
#define MavStatusLed D4 // D4/GPIO2 Board LED - Mav Status LED inverted logic - use 99 while debug
#define InvertMavLed true
#define BufStatusLed 99 // None
// D4 // TXD1 - Serial1 debug log out SHARED WITH BOARD LED
#define mav_rxPin D9 // RXD0 default
#define mav_txPin D10 // TXD0 default
#define fr_rxPin D5 // FPort- Not used in single wire mode
#define fr_txPin D6 // FPorttx - Use me in single wire mode
#define startWiFiPin 99 // 99=none or D3/D7 - Trigger WiFi startup
// NOTE: There are not enough pins for wifi pin and display scrolling
#if (defined displaySupport) // Display type defined with # define displaySupport
/* Below please choose Digital pin-pair for display scrolling
* Pin == 99 means the pin-pair is not used
*/
#define Pinfo 99 // Digital pin to toggle information/log page
#define Pup D3 // D3 Board Button 1 to scroll the display up
#define Pdn D7 // D7 Board Button 2 to scroll the display down
#define SCL D1 // I2C OLED board
#define SDA D2 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#endif
#endif
//=========================================================================
#if (ESP8266_Variant == 2) // ESP-12E, ESP-F barebones boards. RFD900X TX-MOD, QLRS et al - use Generic ESP8266 on IDE
// GPIO as per node mcu
static const uint8_t D0 = 16; // SCL - optional
static const uint8_t D1 = 5; // SDA - optional
static const uint8_t D2 = 4; // FPorttx - Use me in single wire mode
static const uint8_t D3 = 0; // Flash
static const uint8_t D4 = 2; // BoardLED & TXD1 optional debug out
static const uint8_t D5 = 14; // FPortrx (unused in half-duplex)
static const uint8_t D6 = 12; // P2-3 exposed dual row of pins
static const uint8_t D7 = 13; // CTS
static const uint8_t D8 = 15; // RTS
static const uint8_t D9 = 3; // RXD0 mavlink and flashing
static const uint8_t D10 = 1; // TXD0 mavlink and flashing
#define MavStatusLed D4 // D4 Board LED - Mav Status LED inverted logic - use 99 while debug
#define InvertMavLed true
#define BufStatusLed 99 // None
// D4 // TXD1 - Serial1 default debug log out SHARED WITH BOARD LED
#define mav_rxPin D9 // RXD0 default
#define mav_txPin D10 // TXD0 default
#define fr_rxPin D5 // FPort- Not used in single wire mode
#define fr_txPin D2 // FPort(half-duplex) inverted - Use me in single wire mode
#define startWiFiPin D6 // Trigger WiFi startup
// NOTE: There may not be enough pins for wifi pin AND display scrolling
#if (defined displaySupport) // Display type defined with # define displaySupport
#define SSD1306_Display
/* Below please choose Digital pin-pair for display scrolling
* Pin == 99 means the pin-pair is not used
*/
#define Pinfo 99 // Digital pin to toggle information/log page
#define Pup 99 // D3 Board Button 1 to scroll the display up
#define Pdn 99 // D7 Board Button 2 to scroll the display down
#define SCL D0 // I2C OLED board
#define SDA D1 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#endif
#endif // end of this ESP8266 variant
//=========================================================================
#if (ESP8266_Variant == 3) // ESP-12F, Wemos® LOLIN D1 Mini - use Generic ESP8266 on Arduino IDE
// Pin Map as per C:\Users<user>\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1\variants\d1_mini\pins_arduino.h
#define LED_BUILTIN 2
static const uint8_t D0 = 16; // WiFi trigger
static const uint8_t D1 = 5; // SCL - optional
static const uint8_t D2 = 4; // SDA - optional
static const uint8_t D3 = 0; // Flash - reserved
static const uint8_t D4 = 2; // LED_BUILTIN & TXD1 optional debug out
static const uint8_t D5 = 14; // FPortrx (unused in half-duplex)
static const uint8_t D6 = 12; // FPorttx - Use me in single wire mode
static const uint8_t D7 = 13; // CTS
static const uint8_t D8 = 15; // RTS
static const uint8_t D9 = 3; // RXD0
static const uint8_t D10 = 1; // TCD0
#define MavStatusLed D4 // D4 Board LED - Mav Status LED inverted logic - use 99 while debug
#define InvertMavLed true
#define BufStatusLed 99 // None
// D4 // TXD1 - Serial1 default debug log out SHARED WITH LED_BUILTIN BOARD LED
#define mav_rxPin D9 // RXD0 - Serial(0)
#define mav_txPin D10 // TXD0 - Serial(0)
#define fr_rxPin D5 // FPort- Not used in single wire mode
#define fr_txPin D6 // FPort- inverted - Use me in single wire mode
#define startWiFiPin D16 // Trigger WiFi startup
#if (defined displaySupport) // Display type defined with # define displaySupport
/* Below please choose Digital pin-pair for display scrolling
* Pin == 99 means the pin-pair is not used
*/
#define Pinfo 99 // Digital pin to toggle information/log page
#define Pup 99 // D3 Board Button 1 to scroll the display up
#define Pdn 99 // D7 Board Button 2 to scroll the display down
#define SCL D1 // I2C OLED board
#define SDA D2 // I2C OLED board
#define i2cAddr 0x3C // I2C OLED board
#endif
#endif // end of this ESP8266 variant
#endif // end of all ESP8266 variants
//=================================================================================================
// E E P R O M S U P P O R T - ESP Only - for now
//=================================================================================================
#if (defined ESP32) || (defined ESP8266)
#include <EEPROM.h> // To store AP_Failover_Flag and webSupport Settings
#define EEPROM_SIZE 165 // 1 + 160 bytes, addr range 0 thru 161
#endif
//=================================================================================================
// S D C A R D S U P P O R T - ESP Only - for now
//=================================================================================================
#if ((defined ESP32) || (defined ESP8266)) && (defined sdBuiltin)
#include <FS.h>
#include <SD.h>
#include <SPI.h>
#define SD_Libs_Loaded
/*
// Optional SPI interface pins for SD card adapter or SSD1306 OLED display
#define CS 5
#define MOSI 23
#define MISO 19
#define SCK 18
*/
// Pins generally CS=5 MOSI=23 MISO=19 SCK=18 3.3V GND Dev Board, LilyGO/TTGO
// Rememeber to change SPI frequency from 4E6 to 25E6, i.e 4MHz to 25MHz in SD.h otherwise MavRingBuff fills up
// C:\Users\YourUserName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\libraries\SD\src
// bool begin(uint8_t ssPin=SS, SPIClass &spi=SPI, uint32_t frequency=25000000, const char * mountpoint="/sd", uint8_t max_files=5);
char cPath[40];
std::string fnPath[30];
uint8_t fnCnt;
uint16_t sdReadDelay = 10; // mS Otherwise the reads run through unnaturally quickly
const uint16_t sd_buf_sz = 128;
byte sd_buf [sd_buf_sz];
uint16_t sd_idx = 0;
File file; // Create global object from File class for general use
static const uint8_t mthdays[]={31,28,31,30,31,30,31,31,30,31,30,31};
typedef struct {
uint16_t yr; // relative to 1970;
uint8_t mth;
uint8_t day;
uint8_t dow; // sunday is day 1
uint8_t hh;
uint8_t mm;
uint8_t ss;
} DateTime_t;
static DateTime_t dt_tm;
#endif
//=================================================================================================
// D I S P L A Y S U P P O R T E S P O N L Y - for now
//=================================================================================================
#if defined displaySupport
#if (!( (defined SSD1306_Display) || (defined SSD1331_Display) || (defined ST7789_Display) ))
#error please define a display type in your board variant configuration, or disable displaySupport
#endif
#endif
#if ((defined ESP32 || defined ESP8266)) && (defined displaySupport)
#if not defined SD_Libs_Loaded // by SD block
#include <SPI.h> // for SD card and/or Display
#endif
// Colour definitions for any colour display
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
//==========================================================
#if (defined ST7789_Display) // TFT display type
#include <TFT_eSPI.h> // Remember to select the T_Display board in User_Setup_Select.h in TFT_eSPI library
// (H 240 x W 135 in portrait) (H 135 x W 240 in landscape)
TFT_eSPI display = TFT_eSPI();
#if (screenOrientation == 0) // portrait
#define screen_height 20 // characters not pixels
#define screen_width 30 // ?
#define char_height 12 // pixels
#elif (screenOrientation == 1) // landscape
#define screen_height 8 // characters not pixels
#define screen_width 20
#define char_height 16 // pixels x 8 = 128 rem 7
#endif
//==========================================================
#elif (defined SSD1306_Display) // SSD1306 OLED display (H 128 x W 64 in portrait)
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define screen_height 8 // characters not pixels
#define screen_width 21
#define char_height 8 // 8 x 8 = 64
#ifndef OLED_RESET
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#endif
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
//==========================================================
#elif (defined SSD1331_Display) // SSD1331 colour TFT display (H 96 x W 64 in portrait)
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1331.h>
#define screen_height 8 // characters not pixels
#define screen_width 16
#define char_height 12 // 8 x 12 = 64
Adafruit_SSD1331 display = Adafruit_SSD1331(CS, DC, MOSI, SCLK, RST);
#endif
//==========================================================
#define max_col screen_width+1 // +1 for terminating 0x00
#define max_row 32
static const uint16_t threshold = 40;
volatile bool upButton = false;
volatile bool dnButton = false;
volatile bool infoButton = false;
#if (not defined Tup)
#define Tup 99
#endif
#if (not defined Tdn)
#define Tdn 99
#endif
#if (not defined Pup)
#define Tup 99
#endif
#if (not defined Pdn)
#define Tdn 99
#endif
typedef enum scroll_set { non = 0, up = 1, down = 2 } scroll_t;
scroll_t up_down = non;
typedef enum last_row_set { omit_last_row = 0, show_last_row = 1} last_row_t;
last_row_t last_row_action;
struct row_t {
char x[max_col];
};
row_t ScreenRow[max_row];
uint8_t row = 0;
uint8_t col = 0;
uint8_t scroll_row = 0;
uint32_t scroll_millis =0 ;
#endif
//=================================================================================================
// B L U E T O O T H S U P P O R T - E S P 3 2 O n l y
//=================================================================================================
#if ((defined ESP32) && (defined btBuiltin))
#include "BluetoothSerial.h"
#include "esp_bt.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `idf.py menuconfig` in IDF workspace
#endif
BluetoothSerial SerialBT;
#endif
//=================================================================================================
// W I F I S U P P O R T - ESP32 and ES8266 Only
//=================================================================================================
uint16_t TCP_localPort = 5760;
uint16_t TCP_remotePort = 5760;
uint16_t UDP_localPort = 14555;
uint16_t UDP_remotePort = 14550;
bool FtRemIP = true;
bool wifiDisconnected = false;
int16_t wifi_rssi;
uint16_t wifi_status = 0xfe; // 0xfe = unused yet
uint8_t AP_sta_count = 0;
uint8_t AP_prev_sta_count = 0;
#if ( (defined ESP32) || (defined ESP8266) )
#if (defined ESP32)
// timer for wifi retry interrupt
hw_timer_t * timer = NULL;
volatile SemaphoreHandle_t wifiTimerSemaphore;
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;
#endif
#if (defined ESP8266)
uint32_t esp8266_wifi_retry_millis = 0;
#endif
volatile bool wifiButton = false;
// Define link variables
struct linkStatus {
uint32_t packets_received;
uint32_t packets_lost;
uint32_t packets_sent;
};
bool hb_heard_from = false;
uint8_t hb_system_id = 0;
uint8_t hb_comp_id = 0;
uint8_t hb_seq_expected = 0;
uint32_t hb_last_heartbeat = 0;
linkStatus link_status;
#if defined ESP32
#include <WiFi.h> // includes UDP class
#if defined webSupport
#include <WebServer.h>
#include <Update.h>
WebServer server(80);
#endif
#include <WiFiAP.h>
#endif
#if defined ESP8266
#include <ESP8266WiFi.h> // Includes AP class
#if defined webSupport
#include <ESP8266WebServer.h>
ESP8266WebServer server(80);
#include <WiFiUdp.h>
#endif
#endif
//==================== W i F i O b j e c t s
#define max_clients 5
uint8_t active_client_idx = 0;
WiFiClient TCPclient;
WiFiClient *clients[max_clients] = {NULL}; // pointers to TCP client objects
WiFiServer TCPserver(TCP_localPort); // dummy TCP local port(changes on TCPserver.begin() ).
IPAddress UDP_remoteIP(192, 168, 1, 255); // default to broadcast unless (not defined UDP_Broadcast)
uint8_t UDP_remoteIP_B3[max_clients]; // table of last byte of remote UDP client IPs
WiFiUDP UDP; // create UDP object
IPAddress localIP; // tcp and udp
IPAddress TCP_remoteIP(192,168,4,1); // when we connect to a server in tcp client mode, put the server IP here
#endif // end of ESP32 and ESP8266
//=================================================================================================
// S E R I A L
//=================================================================================================
#if (defined ESP32)
#define Log Serial // USB
#define mvSerial Serial2 // RXD2 and TXD2
#if defined ESP32_SoftwareSerial
#include <SoftwareSerial.h>
SoftwareSerial frSerial;
#else // default HW Serial
#define frSerial Serial1
#endif
#elif (defined ESP8266)
#define Log Serial1 // D4 TXD1 debug out - no RXD1 !
#define mvSerial Serial // RXD0 and TXD0
#include <SoftwareSerial.h>
SoftwareSerial frSerial;
#endif
#if (defined TEENSY3X) // Teensy 3.1
#define Log Serial // USB
#define mvSerial Serial2
#if (frPort_Serial == 1)
#define frSerial Serial1 // F.Port
#elif (frPort_Serial == 3)
#define frSerial Serial3 // F.Port
#else
#error frPort_Serial can only be 1 or 3. Please correct.
#endif
#endif
//=================================================================================================
// D E B U G G I N G O P T I O N S
//=================================================================================================
//#define inhibit_SPort // Use me to send debug messages only, out of GPIO1/TX0 on ESP32_Variant 3, DL V3 internal ESP32
//#define Mav_Debug_All
//#define Frs_Debug_All
//#define Mav_Debug_RingBuff
//#define Debug_Air_Mode
//#define Debug_Relay_Mode
//#define Mav_List_Params // Use this to test uplink to Flight Controller
//#define Mav_Debug_Params
//#define Debug_BT
//#define Debug_FC_Down // traffic down from FC to Ring Buffer
//#define Debug_FC_Up // traffic up to FC from GCS
//#define Debug_GCS_Down // traffic from RB to GCS
//#define Debug_GCS_Up // traffic up from GCS to FC
//#define Mav_Debug_Servo
//#define Frs_Debug_Servo
//#define Mav_Debug_Rssi // #109 > #65 > #35
//#define Frs_Debug_Rssi // 0xF101
//#define Mav_Debug_RC
//#define Frs_Debug_RC
//#define Frs_Debug_Params //0x5007
//#define Frs_Debug_APStatus // 0x5001
//#define Mav_Debug_SysStatus // #1 && battery
//#define Debug_Batteries // 0x5003
//#define Frs_Debug_Home // 0x5004
//#define Mav_Debug_GPS_Raw // #24
//#define Mav_Debug_GPS_Int // #33
//#define Frs_Debug_LatLon // 0x800
//#define Frs_Debug_VelYaw // 0x5005
//#define Frs_Debug_GPS_status // 0x5002
//#define Mav_Debug_Scaled_IMU
//#define Mav_Debug_Raw_IMU
//#define Mav_Debug_Hud // #74
//#define Frs_Debug_Hud // 0x50F2
//#define Mav_Debug_Scaled_Pressure
//#define Mav_Debug_Attitude // #30
//#define Frs_Debug_AttiRange // 0x5006
//#define Mav_Debug_StatusText // #253
//#define Frs_Debug_StatusText // 0x5000
//#define Mav_Debug_Mission
//#define Frs_Debug_Mission
//#define Mav_Debug_System_Time
//#define Decode_Non_Essential_Mav
//#define Debug_Baud
//#define Debug_Radio_Status
//#define Debug_GCS_Unknown
//#define Debug_Param_Request_Read
//#define Mav_Show_Unknown_Msgs
//#define Mav_Print_All_Msgid
//#define Debug_Eeprom
//#define Mav_Debug_RPM
//#define Debug_SD
//#define MavLite_Debug_Scheduler
//#define Debug_WiFi
//#define Debug_Loop_Period
//#define Debug_Mavlite
//#define Mav_Debug_Command_Ack
//#define Debug_SRAM
//#define Debug_Web_Settings
//#define Mav_Debug_FC_Heartbeat
//#define Mav_Debug_GCS_Heartbeat
//#define Debug_Our_FC_Heartbeat
//#define Debug_Param_Request_Read // #20
//#define Debug_Param_Request_List // #21
//#define Mav_Debug_Params
//#define Debug_Mavlite_SPort
//#define Debug_SPort // both in and out
//#define Debug_SPort_In
//#define Debug_SPort_Out
//#define Frs_Debug_Scheduler // - this debugger affects the performance of the scheduler when activated
//#define Frs_Debug_Payload
#define Report_Packetloss 2 // F.Port packet loss every n minutes
//#define CRC_Test_Case
//#define Debug_CRC
//#define Debug_FrPort_Serial_Loop
//#define Debug_FrPort_Stream
//#define Debug_FrPort_Switching
//#define Debug_FPort_Buffer
//#define Frs_Debug_Period
//#define Derive_PWM
//#define Debug_PWM_Channels
//#define Support_SBUS_Out
//#define Debug_Read_TCP
//#define Debug_Read_UDP
//#define Debug_Send_TCP
//#define Debug_Send_UDP
//#define Debug_Inject_Delay
//=================================================================================================
// C H A N G E L O G
//=================================================================================================
/*
Change log:
v2.00 2019-06-07 Plus version firmware ported to ESP32 Dev Module V1 successfully - no improvements
v2.01 2019-06-09 Added OLED display support
v2.02 2019-05-18 Belatedly include Alex's Rangefinder PR that I missed.
v2.03 2019-05-21 Reduce voltage and current display moving average smoothing
Empirical correction of mAh consumed as per Markus Greinwald's measurements
Change mav heartbeat timeout from 3 to 6 seconds
v2.04 2019-05-24 Merge Alex's BT classic PR. Thank you!
Remove Aux port as no longer required
Tidy #define options
v2.05 2019-06-09 Support 3 possible I/O channels on FC side, and 3 on GCS side. UART serial, BT and WiFi.
WiFi AP ssid = 'Mav2Passthru', pw = 'password' for now.
v2.06 2019-06-10 Support added for STA mode and AP mode. Tidied up some lose ends.
v2.07 2019-06-16 Initiate WiFi session with push button from GPIO15 momentary to ground.
v2.08 2019-06-16 Add SD/TF card support - wip!! Added UTP protocol option
v2.09 2019-06-30 WiFi activation push button momentary but one-time.
2019-07-03 Implemented optional TLog input and output via SD card.
v2.10 2019-07-09 For PX4 flight stack only, send HB to FC every 2 seconds
2019-07-10 Radical redesign of F.Port scheduling algorithm. Support SD and WiFi/BT I/O simultaneously
v2.11 2109-07-11 Auto determine target board. Publish "Universal" version 2.11. One source, four platforms / boards
v2.12 2019-07-12 Add #define PlusVersion, comment out for FlightDeck
v2.13 2019-08-13 UDP now working in Access Point mode
v2.14 2019-07-17 PX4 flight stack only - fixed longitude typo if (ap24_lat<0) should be if (ap24_lon<0)
v2.15 2019-07-17 Switch to Adafruit_SSD1306 OLED library. 8 lines x 21 chars
v2.16 2019-07-18 Increase time burden for each successive Status Text chunk by 5mS
v2.17 2019-07-19 Auto detect serial telemetry and baud rate
v2.18 2019-07-21 Tune FrSky packet schduler. Add option. Default is 1x. //Send_status_Text_3_Times
v2.19 2019-07-22 Implement 2 tier scheduling. Tier1 gets priority, tier2 (0x5000) only when tier1 empty
v2.20 2019-07-26 Release candidate. Send HB back to FC for APM also, not just PX4. Streamline library #includes.
#undef troublesome F function.
v2.21 2019-07-26 Trap attempt to do GCS I/O on ESP32 or Blue Pill - no Serial3 UART.
2019-07-29 Implement system health status-text messages as per Alex's request.
v2.22 2019-08-10 Make sensor health messages optional for now. Fix end-of-sensor message text detection.
v2.23 2019-08-21 Add support for RFD900x long-range telemetry modems, specifically RSSI
v2.24 2019-08-23 Workaround for Esp32 library "wifi: Set status to INIT" bug
Improve responsiveness to baud detect with no telemetry present.
v2.25 2019-08-28 Version for RFD900x. Bug fixes on rssi. Include #define StartWiFi option to
override startWiFi Pin.
v2.26 2019-08-31 Improved GCS to FC debugging. Make baud rate sensing optional.
v2.27 2019-09-13 Small additions to test LILYGO®_TTGO_MINI32_ESP32-WROVER_B
v2.28 2019-09-17 Localise pin definitions in one place to define ESP32 variants more easily
v2.29 2019-09-24 Use #if (TargetBoard == 3) to define soft pins for mvSerial
v2.30 2019-09-26 Don't push #5007 into F.Port table from #147. Push from #1 only.
v2.31 2019-09-30 Configurable declarations moved to config.h file
v2.32 2019-10-08 Source line corrupted in v2.17 affecting Relay Mode, fixed. Thank you burtgree!
v2.33 2019-10-09 Don't invert ESP32 FPortin Relay Mode. Use commercial inverter/converter.
Tidy up config.h file.
Send #5007 3 times at startup and then every 50th heartbeat.
v2.34 2019-10-15 Move typedef struct DateTime_t to global scope in line with VS Code/Platform IO.
v2.35 2019-10-18 Add pre-defined ESP32 board variants. TargetBoard >> Target_Board typo Paul Atherton.
v2.36 2019-10-30 Optimise WiFi amd BT read/send as per excellent mavesp8266 bridge by Tridge.
Add support for ESP8266.
v2.41 2019-11-08 Fix STA mode no-connect loop
2019-11-08 Make AutoAP optional
v2.42 2019-11-09 Add support for GCS-side simultaneous WiFi and BT telemetry option
v2.43 2019-11-10 Tidy up WiFi Setup for auto AP failover.
Support for 2 new ESP32 board variants, complements of Noircogi.
2019-11-11 Implement Auto RSSI selection(Order of precedence #109, then #65 then #35)
2019-11-11 Support AutoBaud up to 921600.
v2.44 2019-11-12 Include Target0815 recommended reset after STA fail to connect.
v2.45 2019-11-12 Augment mission debugging for athertop.
2019-11-13 Move #endif outside } in SetupWiFi
v2.46 2019-11-16 A few cosmetic improvements
v2.47 2019-12-23 For ESP32 Dev Module, use pin 27 for F.Port tx,
because boot fails if pin 12 pulled high
v2.48 2019-12-17 Option for SiK #109, if RSSI is already in %, i.e. not relative to 2.54
Added #define Rssi_In_Percent
2019-12-31 Changes for PlatformIO compatibility
2020-01-02 ESP32 Dev Board change again for stability - F.Port pins rx=13, tx=14
v2.49 2020-01-07 Move baud, ssid and BT settings to top of config.h for convenience
v2.50 2020-01-12 AutoAP: Activate udp broadcast on AP dhcp allocated IP subnet.
Eliminate annoying periodic "Stabilized Flight Mode" announcements.
Further localise options in to logical groups.
2020-01-13 Revert max rssi to 254. 255 is invalid/unknown in ardupilot
v2.51 2020-01-18 Make default rssi 69% for SiK radios, like RFD900x. PR by Hasi123
v2.52 2020-01-21 Support web OTA. Rehash STA to AP failover using reboot - now stable.
v2.53 2020-01-25 ESP8266 (Node MFU 12F) debugged, tested. ESP8266 OTA included.
v2.54 2020-01-27 ESP8266 inverted single-wire enabled, like Teensy.
No hardware invert/convert required.
v2.54a 2020-01-28 Setup OTA password in config.h
v2.54b 2020-01-30 Correct irritating warnings
v2.55 2020-02-04 Add RFD900X TXMOD ESP8266 variant
v2.56.1 2020-02-26 Add web interface to allow settings/parameter changes
v2.56.2 2020-02-27 STM32F103C / Blue Pill / Maple Mini deprecated. Tidy up Teensy3.x warnings.
v2.56.3 2020-03-03 Minor ESP8266 variants logic check
v2.56.4 2020-03-04 Remove spurious debugging code affecting F.Port Thanks pascale dragos.
v2.56.5 2020-03-09 Reduce rssi timing cycle to 350mS from 700mS.
v2.57 2020-03-15 Fix RFD900/TXMOD status LED. SoftwareSerial for ESP32.
v2.58 2020-03-17 Option to work around apparent bug in Mavlink V2 Library. Tolerate crcout errors.
This fixes failure to parse certain mavlink messages, including #226 RPM
Needs more investigation. Use with caution!
v2.58.1 2020-03-18 Improve user options on hw/sw serial
v2.58.2 2020-03-20 Stable. Lots of nice, small tweaks. Exp. code for inherent 1-wire on ESP
v2.58.3 2020-03-22 Deactivate experimental crcout error tolerance for general use. My bad.
v2.58.4 2020-03-25 RPM fixed (library path).
v2.58.5 2020-03-28 Add //#define sdBuiltin to optionally remove all SD support at compile time.
This is especially useful for PlatformIO on ESP8266.
v2.59.1 2020-04-02 Support for QLRS (rssi) by giacomo892. Style and function improvements to web
interface.
v2.59.2 2020-04-21 Some structural tidying up.
v2.59.3 Main loop minor fix.
wifiBuiltin and btBuiltim macros added.
2020-04-28 GetBaud(mav_rxPin) fix. Thanks has1123.
v2.59.4 2020-05-08 Broadcast on the subnet we attached to. Can't assume 192.168.1/24 :)
Patch by Stefan Arbes.
v2.59.5 2020-05-11 Fixed TCP_LocalPort initialisation
v2.59.6 2020-05-20 Improve WiFi start button debounce . Add Debug_SRAM.
v2.60.0 2020-05-23 Deactivate BT to reclaim critical SRAM during web support. Patch by Scott P.
Reboot on Cancel web settings page
v2.60.1 2020-05-24 Schedule fr 0x5007 params individually, fixes periodic flight-mode announcement.
Schedule fr 0xf101 rssi when mavlink #109, #65 or #35 arrives. Avg < 200 mS. Fixes
periodic "telemetry lost".
v2.60.2 2020-05-25 Added RSSI_Pacemaker option to help prevent "telemetry lost". Default period 200 mS.
v2.60.3 2020-05-25 Added new variant for ESP8266 - ESP-12F WEMOS D1 Mini
2020-05-30 Added some support for PitLab flight stack
v2.60.4 2020-06-01 Half-duplex MavLite on F.Port - phase 1
v2.61.0 2020-06-29 Important patch of WiFi TCP client for graceful close/reopen on loss of signal
Half-duplex MavLite on F.Port - phase 2 - work in progress!
Filter out heartbeats from Onboard_Controllers(18)
#define PitLab to force frame_type = 1
Monitor GCS heartbeat
v2.61.1 Change references to pin 12 for all ESP32 variants
Mavlink phase 2 working
2020-07-15 FPortClass established
v2.61.2 2020-07-24 Web settings - value for st/ap failover not picked up. Should be STA/AP not STA_AP.
Display WiFi Mode at startup.
Emphasise EEPROM settings reset for clarity.
v2.61.3 2020-07-28 Add variant for LILYGO® TTGO T-Display ESP32 1.14 Inch Colour LCD
v2.61.4 2020-07-30 Added display up/down scrolling on touch pins for ESP32
v2.61.5 2020-07-30 Added display up/down scrolling pins for ESP8266
v2.61.6 hasi123 patch for SiK radio rssi restored. It endures!
Fix LogScreenPrint() of number.
2020-08-05 Add #define UDP_Broadcast as default to support > 1 UDP concurrent sessions
v2.61.7 2020-08-10 Support board buttons on TTGO T-Display ESP32 for display up/down scrolling
More bi-directional mavlite.
v2.61.8 2020-08-10 F.Port telemetry to SD card option.
v2.61.9 2020-09-04 Tidy up serial downlink capability. Add outgoing TCP client capability.
Improve web setup data vetting.
Show last line properly & reverse scroll buttons on ST7789.
Ignore heartbeats from or Gremsy Gimbal(26).
v2.62.0 2020-09-08 Add support for multiple incoming tcp clients (GCSs, trackers..)
Always broadcast UDP on the /24 subnet.
v2.62.1 2020-09-10 Restore #defined UDP_broadcast option :)
v2.62.2 2020-09-15 Add support for multi targeted UDP clients.
Flush UDP buffer after send.
Always broadcast heartbeat for UDP.
v2.62.3 2020-09-17 AP channel change fixed.
Display remote IP fixed.
v2.62.4 2020-09-16 Fix BT slave name truncated by 1 chr
Improve when BT disabled to free up SRAM for web support, also #undef btBuiltin
v2.62.8 2020-10-07 Improve display scrolling
2020-10-12 Tested WiFi TCP output to AntTracker v2.15
v2.62.9 2020-10-14 Add support for LILYGO® TTGO T2 SD TFT Colour
v2.63.0 2020-10-26 Add support for FrSky ISRM/ACCESS F.Port receivers (like Archer)
v2.63.1 2020-10-29 Add option "no FrSky port support". Fw becomes "Mavlink Switch".
Restore Bluetooth support in web interface.
v2.63.2 2020-11-02 Add switchable flight info page on display
2020-10-31 For mark home include GPS 3D Fix
v2.63.3 2020-11-04 Enumerate info page pins for more variants
2020-11-11 Info page working for all supported display types
*/`
and
do not handle the special case of 255, where MAVLink GPS_RAW_INT #24 uses a value of 255 for unknown satellite count.
Best, additionally to check if mavlink_msg_gps_raw_int_get_satellites_visible() == 255 and set the ap24_sat_visible to 0 if so in order not to output wrongly 15 over FrSky.
I have not been successful at getting the MavlinkToPassthru firmware to run on my setup. It starts up ok on the Yaapu telemetry, making it past the flight mode announcement and "GPS 3D fix Lock", but then I hear "Telemetry Lost" from my Taranis X9D and the Teensy 3.1 LED stays on instead of slow flashing. I have tried .hex files from MavlinkToPassthru firmware v0.11, v1.0.4 and v1.0.5. They all crash the same way.
I am using a Taranis X9D with OpenTX 2.2.1 and Yaapu v1.5.0. Any ideas are appreciated...
Here is my code setup for v1.0.4:
#include <CircularBuffer.h>
#include <GCS_MAVLink.h>
//************************************* Please select your options here before compiling **************************
//#define PX4_Flight_stack // If your flight stack is PX4 and not APM, un-comment this line
// Choose one (only) of these target boards
#define Target_Board 0 // Teensy 3.x Un-comment this line if you are using a Teensy 3.x
//#define Target_Board 1 // Blue Pill STM32F103C OR un-comment this line if you are using a Blue Pill STM32F103C
//#define Target_Board 2 // Maple_Mini STM32F103C OR un-comment this line if you are using a Maple_Mini STM32F103C
// Choose one (only) of these three modes
#define Ground_Mode // Converter between Taranis and LRS tranceiver (like Orange)
//#define Air_Mode // Converter between FrSky receiver (like XRS) and Flight Controller (like Pixhawk)
//#define Relay_Mode // Converter between LRS tranceiver (like Orange) and FrSky receiver (like XRS) in relay box on the ground
//#define Use_Local_Battery_mAh // Un-comment this if you want to define battery mAhs here, no FC tx line needed. Alternatively
// enter battery capacities into yaapu's LUA script menu
const uint16_t bat1_capacity = 5200; // These are ignored if the above #define is commented out
const uint16_t bat2_capacity = 0;
#define SPort_Serial 1 // The default is Serial 1, but 3 is possible if we don't want aux port
//#define Aux_Port_Enabled // For BlueTooth or other auxilliary serial passthrough
The Variant 1 option compiler on this board returns with an error
of Undeclared Variable
in line 425 ...
Hi is there an option to setup MavlinkToPassthru to connect to Crossfire Micro TX V2 wifi module as MavLink input?
I was encouraged to do some tests because I found DOWNLINK can be set to WiFi on a setup page of the MavlinkToPassthru (please see attached screenshoot).
However I failed to set it up. Crossfire WiFi default settings is UDP:8888. I have both connected to my home WiFi network, both assigned IPs from the same subnet.
My setup is an ESP8266 D1 mini board with an OLED 128x64 display.
My goal is to have a MavLink link between an Ardupilot FC and a GCS and be able to use the Yaapu's script on my Jumper T16 via S.Port. I am planning to use Crossfire Tx module in PPM mode and feed S.Port input from MavlinkToPassthru (PPM mode would be neccessary because in CRSF mode S.Port is repurposed to CRSF protocol).
P.S. I also tried to listen to the serial transmission between Crossfire Tx PCB and builtin wifi module, but haven't found right baudrate or the data is encapsulated somehow (will need to look at the signal on the oscilloscope to time the baudrate). I know I have to look for 0xFD packet start "magic" marker in a stream
Hello, Great solution... and I know the solution works as I had tried it a few days ago with the help of Yaapu and then today, I finally got around to doing two test flights and no data was coming thru... other than VFAS, Fuel @ 99% and RSSI and RxBt.
Here is the Radio Log...
Thoughts?
just remove the .xlsx from the file below to load.
DART450-2018-07-18.csv.xlsx
Question... when you compile in Arduino.. what settings did you choose?
I have read that Fast is the default....
Also, does your program use Mavlink1 or Mavlink2 or Agnostic?
I was able to flash the device with ESP8266 variant 2 in air mode with OneWire disabled and I could connect via UDP but I wasn't receiving anything on my Jumper T16 with the Yaapu scripts. I was receiving the normal telemetry such as RSSI but nothing more. In the debug console I was getting
S.PORT NOT INVERTED! Hw inverter to 1-wire required. S.Port on ESP is
and that's all.
I enabled OneWire after looking at the code and this is the debug log.
Starting main .....
EEPROM initialised successfully
Target Board is ESP8266 / Variant is ESP-F - RFD900X TX-MOD
Air Mode
Battery_mAh_Source = 3 - Define battery capacities in the LUA script
RSSI Automatic Select
Mavlink Serial In
Mavlink WiFi Out - Protocol is UDP
No Bluetooth options selected, BT support not compiled in
Mavlink s
Though sometimes it will reset itself and send this instead
Starting main .....
EEPROM initialised successfully
Target Board is ESP8266 / Variant is ESP-F - RFD900X TX-MOD
Air Mode
Battery_mAh_Source = 3 - Define battery capacities in the LUA script
RSSI Automatic Select
Mavlink Serial In
Mavlink WiFi Out - Protocol is UDP
No Bluetooth options selected, BT support not compiled in
Mavlink 3
With OneWire enabled I also can't seem to connect by UDP anymore. I also tried touching the S.port output from the D1 mini to the uninverted S.port pad on the R-XSR both with and without OneWire enabled to no effect. If you have any idea why OneWire might not be working so that I don't have to get a conversion board, that would be great.
Does this support Teensy-LC? If not, is it possible to make it supported?
Hi Eric,
I am just a little uncertain on the right configuration. Currently I am using the PixRacer/PX4-stack and FrSky Sender/Receivers. I´d like to use one of the lovely LUA-Scripts on my Sender. However I am not sure on:
"In air mode, it is located on the aircraft between the FC and a Frsky receiver. It converts
Mavlink out of a Pixhawk and feeds passthru telemetry to the frsky receiver, which sends it
to Taranis on the ground. In this situation it responds to the FrSky receiver's sensor polling.
The APM firmware can deliver passthru telemetry, but the PX4 Pro firmware cannot.
What´s the right configuration for my situation?
Regards
--Seeelefant
Trying to set up version 2.45 on Wemos Lolin32 Board I get:
"Warning, sensor table exceeded. Push ignored.", no telemetry data
ESP32.txt
I've suceeded in getting 2.17 to work wih my set up (Matek wing 405, ulrs,ulrs, ground mode MavlinkToPassthru, horus X10, wifi to PC)..but since I'm using an esp32 with built in oled which has different/conflicting pin allocations it would be good to put some set ups in the code for the i2c and the serial ports so they could be moved to other pins rather than relying on default settings.
I note that in 2.17 you have the fc_rx_pin explicitly declared (iguess for the fc baud detection) but rely on the defaults for the TX pin...and although the oled reset pin is explicitly declared the sda and scl are not.
This would make my life a lot simpler so I would be very greatful for this quite simple change.
I also note in 2.18 you've moved the Status declaration outside of the conditional compiler directives. (line 1383) in order to make the code work for example with wifi pc access to the ground tx.
Regards JH
Ps May be coming to SA for the Bloodhound SSC
Declaration of struct Battery {
float mAh;
float tot_mAh;
float avg_dA;
float avg_mV;
uint32_t prv_millis;
uint32_t tot_volts; // sum of all samples
uint32_t tot_mW;
uint32_t samples;
bool ft;
}; has 9 members.
Instantiation of bat1 and bat2
struct Battery bat1 = {
0, 0, 0, 0, 0, 0, 0, true}; has only 8 values
Declaration of Battery should be done in config.h and instantiation of bat1 and bat2 in MavToPass_v2.56.4.ino otherwise you will get an undeclared bat1 in this scope.
Staring at line 1721 in MavToPass_v2.56.4.ino
if (set.wfproto == tcp) { // TCP
bool sentOK = Send_TCP(&R2Gmsg); // to GCS
#ifdef Debug_GCS_Down
Debug.print("Passed down from Ring buffer to GCS by WiFi TCP: sentOk="); Debug.println(sentOk);
You have bool sentOK (uppercase k) and then in Debug.println you have sentOk (lowercase k)
Hi.
I've just been reading some code of your great work with this software.
When i was reading config.h file something seemed strange to me as a former, many years ago, code writer.
In /MavToPass_v2.58.5/config.h (line 366) and in /MavToPass_v2.59.1/config.h (line 365) seems to be a '#' missing before 'define Fr_txPin'.
Sorry if i'm wrong and this is not an error but i've thought that you should be aware about it.
Thanks in advance.
Thank you for your work on this project, As flight control systems get more and more complicated the limited number of serial ports available on flight controllers become a real problem. I have run out of serial ports and I would like to incorporate this library into my project Restraining Bolt. It also uses MAVLink protocol. It attempts to prevent runaways of large rovers that can occur if onboard systems fail. If I can incorporate MavlinkToPassthru, then it would eliminate the need for an additional serial port from the flight controller. What pieces would be required from this library at a minimum?
replace
#ifndef Emulation_Enabled / Note if NOT enabled
by
#ifndef Emulation_Enabled // Note if NOT enabled
thanks !
Currently I'm having problem getting the telemetry works on my Jumper T16.
Basically I'm using Navio2 (running arduplane) --> USB to Serial Converter -->Teensy 3.2 (v2.26)(airmode) --->Frsky X6R (Sport) ---> airlink -->Jumper T16 (4in1 module) running Yaapu (horus) script 1.8.0
The only data that I have now are the X6R rssi and battery status.
On the teensy the led is constantly on which mean that it receives the mavlink data from the usb-to-serial converter.
The reason I'm using usb for mavlink is I already used the uart port for OSD and GCS telemetry.
When I run arduino serial monitor i got these messages:
hb_count=1
hb_count=2
hb_count=3
mavgood=true
Warning, sensor table exceeded. Push ignored.
Warning, sensor table exceeded. Push ignored.
Warning, sensor table exceeded. Push ignored.
Warning, sensor table exceeded. Push ignored.
Warning, sensor table exceeded. Push ignored.
Please advice. Thanks.
Can you please tel me wich setup for confi.h work for compile for teensy 3.2
Been doing some testing, using a teensy 3.2 board.
found that I can make it work with version 2.14 correctly.
I didn't try every version but 2.14 works, but 2.17 up to 2.32 don't seem to work anymore.
below are the settings I used with 2.14
// ******************************* Please select your options below before compiling *******************************
// Do not enable for FlightDeck
#define PlusVersion // Added support for 0x5009 Mission WPs, 0x50F1 Servo_Channels, 0x50F2 VFR_Hud
// Choose one only of these three modes
//#define Ground_Mode // Converter between Taranis and LRS tranceiver (like Orange)
//#define Air_Mode // Converter between FrSky receiver (like XRS) and Flight Controller (like Pixhawk)
#define Relay_Mode // Converter between LRS tranceiver (like Orange) and FrSky receiver (like XRS) in relay box on the ground
// Choose one only of these Flight-Controller-side I/O channels
// How does Mavlink telemetry enter the converter?
#define FC_Mavlink_IO 0 // Serial Port (default)
//#define FC_Mavlink_IO 1 // BlueTooth Classic - ESP32 only
//#define FC_Mavlink_IO 2 // WiFi - ESP32 only
//#define FC_Mavlink_IO 3 // SD Card / TF - ESP32 only
// Choose one only of these GCS-side I/O channels
// How does Mavlink telemetry leave the converter?
// These are optional, and in addition to the S.Port telemetry output
//#define GCS_Mavlink_IO 9 // NONE (default)
//#define GCS_Mavlink_IO 0 // Serial Port
//#define GCS_Mavlink_IO 1 // BlueTooth Classic - ESP32 only
//#define GCS_Mavlink_IO 2 // WiFi - ESP32 only
//#define GCS_Mavlink_SD // SD Card - for ESP32 only
// Choose one - for ESP32 only
//#define WiFi_Protocol 1 // TCP/IP
//#define WiFi_Protocol 2 // UDP useful for Ez-WiFiBroadcast in STA mode
// Choose one - AP means advertise as an access point (hotspot). STA means connect to a known host
//#define WiFi_Mode 1 //AP
//#define WiFi_Mode 2 // STA
//#define Battery_mAh_Source 1 // Get battery mAh from the FC - note both rx and tx lines must be connected
//#define Battery_mAh_Source 2 // Define bat1_capacity and bat2_capacity below and use those
const uint16_t bat1_capacity = 5200;
const uint16_t bat2_capacity = 0;
#define Battery_mAh_Source 3 // Define battery mAh in the LUA script on the Taranis/Horus - Recommended
#define SPort_Serial 1 // The default is Serial 1, but 3 is possible
#define LRS_RSSI // Un-comment this line only if you are using a ULRS, QLRS or similar telemetry system
// ****************************** Set your time zone here ******************************************
// Date and time determines the TLog file name
//const float Time_Zone = 10.5; // Adelaide
const float Time_Zone = 2.0; // Jo'burg
bool daylightSaving = false;
I tried to use the same settings while testing 2.17, 2.20, 2.25, & 2.31
Hi,
I have a Horus X10 with a TBS Crossfire TX and want to run the amazing yaapu script. So I tried to connect the teensy as in your description of your orange modul and configured the crossfire to mavlink transmission. Inside of the crossfire I found a TX and a RX pin, but with no luck at all - no sensors found. Has anybody tried to connect a TBS crossfire to a Taranis or Horus and have a tip for me, please?
I have no idea, how I can find the problem.
I have Pixhawk 1 (clone) running PX4 pro and I have a Teensy 3.2 loaded with MavlinkToPassthru firmware which is connected to TELEM2 port on the pixhawk. I set parameter SYS_COMPANION to Normal Telemetry (57600 8N1) and the light/LED on the Teensy 3.2 goes to solid Orange (so I'm guessing it's working). It then connects via S.port cable to an X8R receiver.
When I go to my X7 and look for sensors, nothing comes up except for the standard RSSI and RxBt values. Tried quite a few different things and nothing seems to work. I would really like to keep using PX4
For reference, I have another vehicle with nearly the same setup except I'm using ArduPlane and the FrSky converter from Craft & Theory together with the X7 and the Lua scripts from Yaapu which works great. I switched to ArduPlane somewhat begrudgingly just so I could get the Yaapu scripts to work.
Anything I may have missed? I've checked wiring many times. I would prefer to keep using PX4 but I could use ArduPilot if I need to.
First there is a discrepancy between pt_bat1_volts and pt_bat1_amps and pt_bat2_volts and pt_bat2_amps, where for battery 1 the variables are in uint16_t, but for battery 2 they are in float. The code for 0x5003 (battery 1) and 0x5008 (battery 2) is otherwise the same, thus battery 1 and 2 should be handled the same way.
Also the current can be negative (e.g. solar plane):
mavlink_msg_sys_status_get_voltage_battery() outputs uint16_t
mavlink_msg_sys_status_get_current_battery() -> int16_t
mavlink_msg_battery2_get_voltage() -> uint16_t
mavlink_msg_battery2_get_current_battery() -> int16_t
Thus correct would be pt_bat[1|2]_volts as uint16_t and pt_bat[1|2]_amps as int16_t.
mavlink_msg_scaled_imu_get_temperature() outputs int16_t in 0.01°C units. Here the value is read into int16_t ap26_temp:
https://github.com/zs6buj/MavlinkToPassthru/blob/0f469ce22c8c3f8d7d224751a2ccf244df9069f8/MavToPass_v2.63.11/MavToPass_v2.63.11.ino#L2018
and here it is directly passed to pt_imu_temp, which is a uint8_t (problem: data length and a sign):
https://github.com/zs6buj/MavlinkToPassthru/blob/0f469ce22c8c3f8d7d224751a2ccf244df9069f8/MavToPass_v2.63.11/FrSky_Ports.h#L1748
and here sent out to FrSky msg 0x5001 using 6 bit value:
https://github.com/zs6buj/MavlinkToPassthru/blob/0f469ce22c8c3f8d7d224751a2ccf244df9069f8/MavToPass_v2.63.11/FrSky_Ports.h#L1757
@yaapu is handling it in telemetry script as a °C value with -19°C offset:
https://github.com/yaapu/FrskyTelemetryScript/blob/82b2245639e209b875b994cc9dd0ae2e9f4e3f0e/HORUS/SOURCES/SRC/WIDGETS/Yaapu/main.lua#L850-L851
Either Mav2PT or Yaapu script needs a fix for them to work correctly together.
For Mav2PT, the fix could look like:
if (((ap26_temp / 100) - 19) < 0)
pt_imu_temp = 0; // shows +19°C in yaapu, the lowest value possible
else
{
if (((ap26_temp / 100) - 19) > 63)
pt_imu_temp = 63; // shows +82°C in yaapu, the highest value possible
else
pt_imu_temp = (ap26_temp / 100) - 19; // shows the true value in 1°C resolution
}
Could you help me out debugging Air Mode? I'm using old Atmel based APM so using pass-thru protocol is not an option for me.
My equipment:
FRSKY Horus TX
FRSK X8R RX
APM 2.5 with 3.2.1 firmware
Teensy 3.2
Mavlink passthrough v1.0.9
I have previously used https://github.com/athertop/MavLink_FrSkySPort to transfer telemetry and this has worked fine so hardware should not be a problem.
If I compile and upload the code in air mode, I get no sensors visible (except the rx own rx voltage and RSSI) in Horus but all seems fine in debug output. If I compile the code in ground mode, I get the second RSSI.
Here's the mavlink debug
Starting ....
Target Board is Teensy 3.x
Air Mode
Battery_mAh_Source = 3 - Define battery capacities in the LUA script
Using Serial_1 for S.Port
Mavlink in #0 Heartbeat: ap_type=13 ap_autopilot=3 ap_base_mode=81 ap_custom_mode=2 ap_system_status=5 ap_mavlink_version=3
hb_count=1
Mavlink in #0 Heartbeat: ap_type=13 ap_autopilot=3 ap_base_mode=81 ap_custom_mode=2 ap_system_status=5 ap_mavlink_version=3
hb_count=2
Mavlink in #0 Heartbeat: ap_type=13 ap_autopilot=3 ap_base_mode=81 ap_custom_mode=2 ap_system_status=5 ap_mavlink_version=3
hb_count=3
mavgood=true
Mavlink in #27 Raw_IMU: accX=0.02 accY=-0.02 accZ=-1.03
Mavlink in #29 Scaled_Pressure: press_abs=1002.1hPa press_diff=0.000hPa temperature=31.8C
Mavlink in #1 Sys_Status: Bat volts=0.040 Bat amps=0.0 mAh=0.000000 Total mAh=0.000 Bat1 cell count= 0
Mavlink in #24 GPS_RAW_INT: ap_fixtype=0 No GPS sats visible=0 latitude=0.0000000 longitude=0.0000000 gps alt amsl=0.0 eph (hdop)=0 epv (vdop)=0 vel=0.000 cog=0.0
Mavlink in #30 Attitude: ap_roll degs=0.3 ap_pitch degs=0.6 ap_yaw degs=57.3
Mavlink in #74 VFR_HUD: Airspeed= 0.00 Groundspeed= 0.00 Heading= 57 Throttle %= 0 Baro alt= -0 Climb rate= -0.01
Mavlink in #30 Attitude: ap_roll degs=0.3 ap_pitch degs=0.6 ap_yaw degs=57.3
Mavlink in #74 VFR_HUD: Airspeed= 0.00 Groundspeed= 0.00 Heading= 57 Throttle %= 0 Baro alt= -0 Climb rate= -0.01
Mavlink in #30 Attitude: ap_roll degs=0.3 ap_pitch degs=0.6 ap_yaw degs=57.3
Mavlink in #74 VFR_HUD: Airspeed= 0.00 Groundspeed= 0.00 Heading= 57 Throttle %= 0 Baro alt= -0 Climb rate= -0.01
Mavlink in #30 Attitude: ap_roll degs=0.3 ap_pitch degs=0.6 ap_yaw degs=57.3
Mavlink in #74 VFR_HUD: Airspeed= 0.00 Groundspeed= 0.00 Heading= 57 Throttle %= 0 Baro alt= -0 Climb rate= -0.01
Mavlink in #30 Attitude: ap_roll degs=0.3 ap_pitch degs=0.6 ap_yaw degs=57.3
Mavlink in #74 VFR_HUD: Airspeed= 0.00 Groundspeed= 0.00 Heading= 57 Throttle %= 0 Baro alt= -0 Climb rate= -0.01
Mavlink in #27 Raw_IMU: accX=0.02 accY=-0.01 accZ=-1.03
Mavlink in #29 Scaled_Pressure: press_abs=1002.1hPa press_diff=0.000hPa temperature=31.7C
Mavlink in #1 Sys_Status: Bat volts=0.040 Bat amps=0.0 mAh=0.000000 Total mAh=0.000 Bat1 cell count= 0
Mavlink in #24 GPS_RAW_INT: ap_fixtype=0 No GPS sats visible=0 latitude=0.0000000 longitude=0.0000000 gps alt amsl=0.0 eph (hdop)=0 epv (vdop)=0 vel=0.000 cog=0.0
Mavlink in #30 Attitude: ap_roll degs=0.3 ap_pitch degs=0.6 ap_yaw degs=57.3
Mavlink in #74 VFR_HUD: Airspeed= 0.00 Groundspeed= 0.00 Heading= 57 Throttle %= 0 Baro alt= -0 Climb rate= 0.00
Mavlink in #30 Attitude: ap_roll degs=0.3 ap_pitch degs=0.6 ap_yaw degs=57.3
Mavlink in #74 VFR_HUD: Airspeed= 0.00 Groundspeed= 0.00 Heading= 57 Throttle %= 0 Baro alt= -0 Climb rate= 0.00
Mavlink in #30 Attitude: ap_roll degs=0.3 ap_pitch degs=0.6 ap_yaw degs=57.3
and here's FRS debug:
Starting ....
Target Board is Teensy 3.x
Air Mode
Battery_mAh_Source = 3 - Define battery capacities in the LUA script
Using Serial_1 for S.Port
hb_count=1
hb_count=2
hb_count=3
mavgood=true
7E 1B Period ms=5455 time_slot=1
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=0 time_slot=2
7E 00 7E A1 7E 7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=330 time_slot=4
Frsky out AP_Status 0x5001: fr_flight_mode=3 fr_simple=0 fr_land_complete=0 fr_armed=0 fr_bat_fs=0 fr_ekf_fs=0 px4_flight_stack=0
TX
RX
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=6
Frsky out GPS Status 0x5002: fr_numsats=0 fr_gps_status=0 fr_gps_adv_status=0 fr_amsl=0 fr_hdop=0 After prep: fr_amsl=0 fr_hdop=0
TX
RX
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=7
Frsky out Bat1 0x5003: fr_bat1_volts=0 fr_bat1_amps=0 fr_bat1_mAh=0
TX
RX
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=8
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=9
Frsky out VelYaw 0x5005: fr_vy=0.00 fr_vx=0.00 fr_yaw=570.00 After prep: fr_vy=0 fr_vx=0 fr_yaw=285
TX
RX
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=10
Frsky out Attitude 0x5006: fr_roll=901 fr_pitch=452 fr_range=0 Frs_Attitude Payload=926597
TX
RX
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=11
TX
Frsky out Params 0x5007: fr_param_id=1 fr_frame_type=13
RX
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=12
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=1
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=2
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=3
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=4
Frsky out AP_Status 0x5001: fr_flight_mode=3 fr_simple=0 fr_land_complete=0 fr_armed=0 fr_bat_fs=0 fr_ekf_fs=0 px4_flight_stack=0
TX
RX
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=6
Frsky out GPS Status 0x5002: fr_numsats=0 fr_gps_status=0 fr_gps_adv_status=0 fr_amsl=0 fr_hdop=0 After prep: fr_amsl=0 fr_hdop=0
TX
RX
7E 00 7E A1 7E 22 7E 83 7E E4 7E 45 7E C6 7E 67 7E 48 7E E9 7E 6A 7E CB 7E AC 7E 0D 7E 8E 7E 2F 7E D0 7E 71 7E F2 7E 53 7E 34 7E 95 7E 16 7E B7 7E 98 7E 39 7E BA 7E 1B Period ms=336 time_slot=7
Frsky out Bat1 0x5003: fr_bat1_volts=0 fr_bat1_amps=0 fr_bat1_mAh=0
TX
RX
If Battery_mAh_Source==3
which equals to battery capacity being defined in the LUA script on the radio (=recommended setting), then in the following the pt_bat1_capacity is uninitialized:
https://github.com/zs6buj/MavlinkToPassthru/blob/0f469ce22c8c3f8d7d224751a2ccf244df9069f8/MavToPass_v2.63.11/FrSky_Ports.h#L2006-L2013
A solution would be to initialize it here to 0:
https://github.com/zs6buj/MavlinkToPassthru/blob/0f469ce22c8c3f8d7d224751a2ccf244df9069f8/MavToPass_v2.63.11/global_variables.h#L598
Update: the same applies to pt_bat2_capacity as well.
As the title says.
A simple fix could be to initialize in global_variables.h pt_bat_fs and pt_ekf_fs with 0.
Also pt_bat_fs might better be a bool variable instead of uint8_t.
Eric, nice piece of work. Could You help with Your code. I have transceiver box with esp d1 mini and now it's working like uart to wifi passthrough. I want to use Your code to get Yaapu work but when I upload it with proper configuration it won't change AP ssid or any AP settings.
I've copy all project to Platformio and sets config
ESP8266_Variant 1
WiFi_Mode 1
it's compile and it seems to uploading but AP setting are not update , also debug mode #define Debug_Web_Settings won't work
on com is:
load 0x4010f000, len 3456, room 16
tail 0
chksum 0x84
csum 0x84
va5432625
~ld
When attaching a Gremsy gimbal to the pixhawk via Mavlink, I noticed that the flight mode constantly changes on my Yaapu Script. When this gimbal is connected to the aircraft, it appears as a second vehicle, with it's own data stream. (In mission planner, you can select the aircraft or the gimbal in the vehicle drop-down next to the connect button). I originally posted this to Yaapu, but it seems that the error has to do with the underlying MavToPassthrough script. This is with using the RFDesign TX MOD, and I'm not sure if they are using a fork of your script or not, but I figure I'd post here just in case.
I have attached a video and tlog to hopefully help explain.
https://drive.google.com/drive/folders/1ZPfU7rXaT2E5CgQCuOD5_RAK1FszSysk?usp=sharing
The architecture:
Cube Orange FC:
Air Radio: RFD900ux
Ground Radio: RFD900 TX MOD - Wifi (udp) to Mission Planner.
Hardware is Heltec Wifi Kit 32
Exact steps taken:
OLED displays "Ground Mode"
Hi,
According to this diagram, power for Teensy 3.2 is taken from Pixhawk switch port, in order to get 3.3V power for Teensy.
But according to Teensy 3.2 specs, Vin pin can handle voltage from 3.6V to 6.0V.
Is there any good reason why Vin pin is not a good idea to power Teensy from Pixhawk motor output port, or better yet from Receiver module?
--
Kpihus
In main INO file, function DecodeOneMavFrame(), in case MAVLINK_MSG_ID_RAW_IMU, the correct call would be to mavlink_msg_raw_imu_get_temperature() instead of mavlink_msg_scaled_imu_get_temperature().
Hi Erick,
MavToPassthru is briliant solution in FPV.
Kindlly please read myissue in pdf attachment.
Thanks for help. Very appreciated in advance.
BR Uros
PITLAB OSD - Mavlink intergation with MavPassthru to Yaapu lua scripts (Ardupilot).pdf
links related to pdf:
yaapu/FrskyTelemetryScript#57
//
yaapu commented 3 days ago
Hi this looks like an issue on the MavToPT code not on my widget, you should open an issue there.
I found this commit d28a6ff look relevant
//
OSD.zip ....unzip...inside is video
https://github.com/zs6buj/MavlinkToPassthru/blob/0f469ce22c8c3f8d7d224751a2ccf244df9069f8/MavToPass_v2.63.11/FrSky_Ports.h#L1788-L1789
and
https://github.com/zs6buj/MavlinkToPassthru/blob/0f469ce22c8c3f8d7d224751a2ccf244df9069f8/MavToPass_v2.63.11/FrSky_Ports.h#L1794-L1795
do not correctly split the 2+2 bits, as this leaves the lower bits to 11 for ALL values higher than 3 and does not allow all 8 MAVLink GPS_FIX_TYPE enum possibilities to be passed (which is no problem with 4 bits, as we can send up to 16 enum values with it, just not with the present funky implementation):
0; GPS_FIX_TYPE_NO_GPS; pt_gps_status=0; pt_gps_adv_status =0
1; GPS_FIX_TYPE_NO_FIX; pt_gps_status=1; pt_gps_adv_status =0
2; GPS_FIX_TYPE_2D_FIX; pt_gps_status=2; pt_gps_adv_status =0
3; GPS_FIX_TYPE_3D_FIX; pt_gps_status=3; pt_gps_adv_status =0
4; GPS_FIX_TYPE_DGP; pt_gps_status=3; pt_gps_adv_status =1
5; GPS_FIX_TYPE_RTK_FLOAT; pt_gps_status=3; pt_gps_adv_status =2
6; GPS_FIX_TYPE_RTK_FIXED; pt_gps_status=3; pt_gps_adv_status =3
7; GPS_FIX_TYPE_STATIC; pt_gps_status=3; pt_gps_adv_status =4
8; GPS_FIX_TYPE_PPP; pt_gps_status=3; pt_gps_adv_status =5
Also, as pt_gps_adv_status has only 2 bits, it should not go above value 3!
Better would be to handle the split like this:
pt_gps_status = ap24_fixtype & 0x03;
pt_gps_adv_status = (ap24_fixtype >> 2) & 0x03;
This gives:
0; GPS_FIX_TYPE_NO_GPS; pt_gps_status=0; pt_gps_adv_status =0
1; GPS_FIX_TYPE_NO_FIX; pt_gps_status=1; pt_gps_adv_status =0
2; GPS_FIX_TYPE_2D_FIX; pt_gps_status=2; pt_gps_adv_status =0
3; GPS_FIX_TYPE_3D_FIX; pt_gps_status=3; pt_gps_adv_status =0
4; GPS_FIX_TYPE_DGP; pt_gps_status=0; pt_gps_adv_status =1
5; GPS_FIX_TYPE_RTK_FLOAT; pt_gps_status=1; pt_gps_adv_status =1
6; GPS_FIX_TYPE_RTK_FIXED; pt_gps_status=2; pt_gps_adv_status =1
7; GPS_FIX_TYPE_STATIC; pt_gps_status=3; pt_gps_adv_status =1
8; GPS_FIX_TYPE_PPP; pt_gps_status=0; pt_gps_adv_status =2
@yaapu might need to fix the telemetry script to match this as well:
https://github.com/yaapu/FrskyTelemetryScript/blob/82b2245639e209b875b994cc9dd0ae2e9f4e3f0e/HORUS/SOURCES/SRC/WIDGETS/Yaapu/main.lua#L854-L856
When trying to compile 2.59.2 with AutoBaud enabled, I get this error:
MavToPass_v2.59.2.ino: In function 'void setup()':
MavToPass_v2.59.2:562:30: error: 'struct settings_struct_t' has no member named 'fc_Mav_rxPin'
set.baud = GetBaud(set.fc_Mav_rxPin);
Need MiniMOSD (Mavlink) and Flightdeck telemetry (Passthrough) with only one telem port on the mini. Mavlink output to Minimosd works well. Same output to teensy 3.2 wired to S-port of FRsky R9 not working yet, solid light, but no output to FlightDeck on Taranis 9+. Flightdeck not initializing, keeps waiting for flight controller. What .hex version should I be using with the teesny to interface Pixhawk Mini - Teensy 3.2 - R9 - Taranis - Flight deck? Thanks in advance,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.