Porównaj commity

...

11 Commity

Autor SHA1 Wiadomość Data
Paweł Jałocha 7a3ea1a2e0
Merge pull request #49 from lupus78/unit_parameters
Adding parameters for the displayed units on page.
2022-08-09 13:06:17 +01:00
Paweł Jałocha 4a0802bf3d
Merge pull request #30 from Fab501/master
Add Selection of the Page to Display after boot
2022-08-09 13:05:36 +01:00
Farkas Szilárd 021f54d032 System info table for wifi ap page 2022-07-08 22:20:20 +02:00
Farkas Szilárd 22ed8c76f9 Restore Default Configuration button for wifi ap page 2022-07-07 11:23:59 +02:00
Farkas Szilárd 7d4b309534 fix bit size for Page struct 2022-07-06 12:11:46 +02:00
Farkas Szilárd 35bba5f59b Adding parameters for the displayed units on page. Unit for Altitude (m or ft), Speed (km/h or knot) and Vario (m/s or fpm) 2022-07-06 09:45:03 +02:00
Fab501 f09ef68db8 config.h modifié 2021-02-02 22:30:08 +01:00
Fab501 37ca198fa8
Merge pull request #1 from pjalocha/master
update to last change
2021-02-01 21:07:56 +01:00
Fab501 5b2e39f957
Add Possibility to Change Default IP Adresse
Usual IP Address of 192.168.4.1 change to 192.168.1.1 for futur compatibility with Skydemon

You can put your IP address in begin of config.h
2021-01-31 15:31:33 +01:00
Fab501 57cb211177
Add files via upload
Config for Oled SH1106 with Stratux with BME280
2021-01-10 22:32:46 +01:00
Fab501 c3751634a5
Add files via upload
Add the Selection of the First DispPage after Boot
2021-01-10 22:31:41 +01:00
7 zmienionych plików z 488 dodań i 82 usunięć

Wyświetl plik

@ -0,0 +1,87 @@
#define DEFAULT_AcftType 8 // [0..15] default aircraft-type: Powered Aircraft
#define DEFAULT_GeoidSepar 40 // [m]
#define DEFAULT_CONbaud 115200
#define DEFAULT_PPSdelay 100
#define DEFAULT_FreqPlan 0
#define DEFAULT_DispPage 3 // Fab501 Page to Display After Boot or Reset
// #define WITH_HELTEC // HELTEC module: PCB LED on GPI025
// #define WITH_HELTEC_V2 // HELTEC module v2
// #define WITH_TTGO // TTGO module: PCB LED on GPIO2, GPIO25 free to use as DAC2 output
// #define WITH_TBEAM // T-Beam module
#define WITH_TBEAM_V10 // T-Beam module
// #define WITH_M5_JACEK // JACEK M5 ESP32 OGN-Tracker
// #define WITH_FollowMe // by Avionix
// #define WITH_ILI9341 // 320x240 M5stack
// #define WITH_ST7789 // IPS 240x240 ST7789
// #define WITH_TFT_LCD // TFT LCD
// #define WITH_OLED // OLED display on the I2C: some TTGO modules are without OLED display
// #define WITH_OLED2 // 2nd OLED display, I2C address next higher
#define WITH_U8G2_OLED // I2C OLED through the U8g2 library
#define WITH_U8G2_SH1106 // correct controller for the bigger OLED
// #define WITH_U8G2_FLIP // flip the OLED screen (rotate by 180deg)
#define WITH_RFM95 // RF chip selection: both HELTEC and TTGO use sx1276 which is same as RFM95
// #define WITH_SLEEP // with software sleep mode controlled by the long-press on the button
#define WITH_AXP // with AXP192 power controller (T-BEAM V1.0)
// #define WITH_BQ // with BQ24295 power controller (FollowMe)
// #define WITH_LED_RX
// #define WITH_LED_TX
// #define WITH_GPS_ENABLE // use GPS_ENABLE control line to turn the GPS ON/OFF
#define WITH_GPS_PPS // use the PPS signal from GPS for precise time-sync.
#define WITH_GPS_CONFIG // attempt to configure higher GPS baud rate and airborne mode
#define WITH_GPS_UBX // GPS understands UBX
// #define WITH_GPS_MTK // GPS understands MTK
// #define WITH_GPS_SRF
// #define WITH_MAVLINK
#define WITH_GPS_UBX_PASS // to pass directly UBX packets to/from GPS
#define WITH_GPS_NMEA_PASS // to pass directly NMEA to/from GPS
// #define WITH_BMP180 // BMP180 pressure sensor
// #define WITH_BMP280 // BMP280 pressure sensor
#define WITH_BME280 // BMP280 with humidity (but still works with BMP280)
// #define WITH_MS5607 // MS5607 pressure sensor
// #define WITH_MS5611 // MS5611 pressure sensor
// #define WITH_BMX055 // BMX055 magnetic and IMU sensor
// #define WITH_LORAWAN // LoRaWAN connectivity
// #define WITH_FANET // FANET transmission and reception
#define WITH_PAW // Add PAW transmission
#define WITH_PFLAA // PFLAU and PFLAA for compatibility with XCsoar and LK8000
// #define WITH_POGNT
// #define WITH_GDL90
// #define WITH_PGAV5
#define WITH_LOOKOUT
#define WITH_CONFIG // interpret the console input: $POGNS to change parameters
#define WITH_BEEPER // with digital buzzer
// #define WITH_SOUND // with analog sound produced by DAC on pin 25
// #define WITH_KNOB
// #define WITH_VARIO
// #define WITH_SD // use the SD card in SPI mode and FAT file system
#define WITH_SPIFFS // use SPIFFS file system in Flash
// #define WITH_SPIFFS_FAT
#define WITH_LOG // log own positions and other received to SPIFFS
// #define WITH_SDLOG // log own position and other data to uSD card
#define WITH_STRATUX
#define WITH_BT_SPP // Bluetooth serial port for smartphone/tablet link
#define WITH_WIFI // attempt to connect to the wifi router for uploading the log files
// #define WITH_AP // Open Access Point MOde
#define WITH_HTTP // Open Web Interface
// #define WITH_ENCRYPT // Encrypt (optionally) the position

Wyświetl plik

@ -1,17 +1,29 @@
#define DEFAULT_AcftType 1 // [0..15] default aircraft-type: glider
#define DEFAULT_AcftType 8 // [0..15] default aircraft-type: Powered Aircraft
#define DEFAULT_GeoidSepar 40 // [m]
#define DEFAULT_CONbaud 115200
#define DEFAULT_PPSdelay 100
#define DEFAULT_FreqPlan 0
#define DEFAULT_DispPage 3 // Fab501 Page to Display After Boot or Reset
#define WIFI_ADDRESS_IP1 192 // 192.168.1.1 for IP Address
#define WIFI_ADDRESS_IP2 168
#define WIFI_ADDRESS_IP3 1
#define WIFI_ADDRESS_IP4 1
#define WIFI_ADDRESS_GW1 0 // 0.0.0.0 for Gateway
#define WIFI_ADDRESS_GW2 0
#define WIFI_ADDRESS_GW3 0
#define WIFI_ADDRESS_GW4 0
#define WIFI_ADDRESS_MK1 255 // 255.255.255.0 for Mask
#define WIFI_ADDRESS_MK2 255
#define WIFI_ADDRESS_MK3 255
#define WIFI_ADDRESS_MK4 0
// #define WITH_HELTEC // HELTEC module: PCB LED on GPI025
// #define WITH_HELTEC_V2 // HELTEC module v2
// #define WITH_TTGO // TTGO module: PCB LED on GPIO2, GPIO25 free to use as DAC2 output
// #define WITH_TBEAM // T-Beam module
// #define WITH_TBEAM_V10 // T-Beam module
#define WITH_TBEAM_V10 // T-Beam module
// #define WITH_M5_JACEK // JACEK M5 ESP32 OGN-Tracker
#define WITH_FollowMe // by Avionix
// #define WITH_FollowMe // by Avionix
// #define WITH_ILI9341 // 320x240 M5stack
// #define WITH_ST7789 // IPS 240x240 ST7789
@ -20,29 +32,30 @@
// #define WITH_OLED2 // 2nd OLED display, I2C address next higher
#define WITH_U8G2_OLED // I2C OLED through the U8g2 library
#define WITH_U8G2_SH1106 // correct controller for the bigger OLED
#define WITH_U8G2_FLIP // flip the OLED screen (rotate by 180deg)
// #define WITH_U8G2_FLIP // flip the OLED screen (rotate by 180deg)
#define WITH_RFM95 // RF chip selection: both HELTEC and TTGO use sx1276 which is same as RFM95
//#define WITH_SX1262 // SX1262 Support
// #define WITH_SLEEP // with software sleep mode controlled by the long-press on the button
// #define WITH_AXP // with AXP192 power controller (T-BEAM V1.0)
#define WITH_AXP // with AXP192 power controller (T-BEAM V1.0)
// #define WITH_BQ // with BQ24295 power controller (FollowMe)
// #define WITH_LED_RX
// #define WITH_LED_TX
#define WITH_GPS_ENABLE // use GPS_ENABLE control line to turn the GPS ON/OFF
// #define WITH_GPS_ENABLE // use GPS_ENABLE control line to turn the GPS ON/OFF
#define WITH_GPS_PPS // use the PPS signal from GPS for precise time-sync.
#define WITH_GPS_CONFIG // attempt to configure higher GPS baud rate and airborne mode
// #define WITH_GPS_UBX // GPS understands UBX
#define WITH_GPS_MTK // GPS understands MTK
#define WITH_GPS_UBX // GPS understands UBX
// #define WITH_GPS_MTK // GPS understands MTK
// #define WITH_GPS_SRF
// #define WITH_MAVLINK
// #define WITH_GPS_UBX_PASS // to pass directly UBX packets to/from GPS
// #define WITH_GPS_NMEA_PASS // to pass directly NMEA to/from GPS
#define WITH_GPS_UBX_PASS // to pass directly UBX packets to/from GPS
#define WITH_GPS_NMEA_PASS // to pass directly NMEA to/from GPS
// #define WITH_BMP180 // BMP180 pressure sensor
// #define WITH_BMP280 // BMP280 pressure sensor
@ -54,6 +67,7 @@
#define WITH_LORAWAN // LoRaWAN connectivity
#define WITH_FANET // FANET transmission and reception
#define WITH_PAW // Add PAW transmission
#define WITH_PFLAA // PFLAU and PFLAA for compatibility with XCsoar and LK8000
// #define WITH_POGNT
@ -61,23 +75,27 @@
// #define WITH_PGAV5
#define WITH_LOOKOUT
#define WITH_SKYDEMON //Adapt NMEA Output for SKYDEMON
#define WITH_CONFIG // interpret the console input: $POGNS to change parameters
// #define WITH_BEEPER // with digital buzzer
#define WITH_BEEPER // with digital buzzer
// #define WITH_SOUND // with analog sound produced by DAC on pin 25
// #define WITH_KNOB
// #define WITH_VARIO
#define WITH_SD // use the SD card in SPI mode and FAT file system
// #define WITH_SD // use the SD card in SPI mode and FAT file system
#define WITH_SPIFFS // use SPIFFS file system in Flash
#define WITH_SPIFFS_FAT
// #define WITH_SPIFFS_FAT
#define WITH_LOG // log own positions and other received to SPIFFS
#define WITH_SDLOG // log own position and other data to uSD card
// #define WITH_SDLOG // log own position and other data to uSD card
// #define WITH_STRATUX
//#define WITH_STRATUX
#define WITH_BT_SPP // Bluetooth serial port for smartphone/tablet link
// #define WITH_WIFI // attempt to connect to the wifi router for uploading the log files
#define WITH_WIFI // attempt to connect to the wifi router for uploading the log files
#define WITH_AP // Open Access Point MOde
#define WITH_HTTP // Open Web Interface
// #define WITH_ENCRYPT // Encrypt (optionally) the position

Wyświetl plik

@ -26,11 +26,11 @@
#ifdef WITH_U8G2_OLED
const uint8_t DISP_Pages = 12;
static uint8_t DISP_Page = 0;
static uint8_t DISP_Page = DEFAULT_DispPage ; //Fab501 before 0
#endif
#if defined(WITH_ST7789) || defined(WITH_ILI9341)
const uint8_t DISP_Pages = 9;
static uint8_t DISP_Page = 0;
static uint8_t DISP_Page = DEFAULT_DispPage ; //Fab501 before 0
#endif

Wyświetl plik

@ -227,7 +227,9 @@ void OLED_DrawPosition(u8g2_t *OLED, GPS_Position *GPS=0, uint8_t LineIdx=2)
}
void OLED_DrawGPS(u8g2_t *OLED, GPS_Position *GPS) // GPS time, position, altitude
{ // u8g2_SetFont(OLED, u8g2_font_ncenB14_tr);
{ bool isAltitudeUnitMeter = Parameters.AltitudeUnit == 0; // display altitude in meters
bool isAltitudeUnitFeet = Parameters.AltitudeUnit == 1; // display altitude in feet
// u8g2_SetFont(OLED, u8g2_font_ncenB14_tr);
u8g2_SetFont(OLED, u8g2_font_7x13_tf); // 5 lines, 12 pixels/line
uint8_t Len=0;
/*
@ -276,14 +278,14 @@ void OLED_DrawGPS(u8g2_t *OLED, GPS_Position *GPS) // GPS time, position, altit
if(GPS && GPS->isValid())
{ int32_t Alt = GPS->Altitude;
if(Alt>=0) Line[Len++]=' ';
if(GPS->Sec&4) // display altitude in meters
{ Len+=Format_SignDec(Line+Len, Alt, 1, 1, 1); // [0.1m/s]
if(isAltitudeUnitMeter) // display altitude in meters
{ Len+=Format_SignDec(Line+Len, Alt, 1, 1, 1); // [0.1m]
Line[Len++]='m'; }
else // and alternate in feet
{ Alt = (Alt*336+512)>>10; // [0.1m/s] => [feet]
else if(isAltitudeUnitFeet) // display altitude in feet
{ Alt = (Alt*336+512)>>10; // [0.1m] => [feet]
Len+=Format_SignDec(Line+Len, Alt, 1, 0, 1); // [feet]
Line[Len++]='f'; Line[Len++]='t'; }
// for( ; Len<14; ) Line[Len++]=' '; // tail of spaces to cover older printouts
// for( ; Len<14; ) Line[Len++]=' '; // tail of spaces to cover older printouts
}
else Len+=Format_String(Line+Len, "-----.- ");
Line[Len]=0;
@ -433,7 +435,13 @@ void OLED_DrawTrafWarn(u8g2_t *OLED, GPS_Position *GPS)
#endif // WITH_LOOKOUT
void OLED_DrawBaro(u8g2_t *OLED, GPS_Position *GPS)
{ u8g2_SetFont(OLED, u8g2_font_7x13_tf); // 5 lines, 12 pixels/line
{ bool isAltitudeUnitMeter = Parameters.AltitudeUnit == 0; // display altitude in meters
bool isAltitudeUnitFeet = Parameters.AltitudeUnit == 1; // display altitude in feet
bool isVarioUnitMPS = Parameters.VarioUnit == 0; // display Vario in m/s
bool isVarioUnitFPM = Parameters.VarioUnit == 1; // display Vario in fpm
u8g2_SetFont(OLED, u8g2_font_7x13_tf); // 5 lines, 12 pixels/line
uint8_t Len=0;
#ifdef WITH_BMP180
Len+=Format_String(Line+Len, "BMP180 ");
@ -458,11 +466,22 @@ void OLED_DrawBaro(u8g2_t *OLED, GPS_Position *GPS)
u8g2_DrawStr(OLED, 0, 24, Line);
Len=0;
if(GPS && GPS->hasBaro)
{ Len+=Format_SignDec(Line+Len, GPS->StdAltitude, 5, 1);
Len+=Format_String(Line+Len, "m ");
Len+=Format_SignDec(Line+Len, GPS->ClimbRate, 2, 1);
Len+=Format_String(Line+Len, "m/s "); }
else Len+=Format_String(Line+Len, "-----.-m --.-m/s ");
{ if(isAltitudeUnitMeter)
{ Len+=Format_SignDec(Line+Len, GPS->StdAltitude, 5, 1);
Len+=Format_String(Line+Len, "m "); }
else if(isAltitudeUnitFeet)
{ Len+=Format_SignDec(Line+Len, (GPS->StdAltitude*336+512)>>10, 5, 0);
Len+=Format_String(Line+Len, "ft "); }
if(isVarioUnitMPS)
{ Len+=Format_SignDec(Line+Len, GPS->ClimbRate, 2, 1);
Len+=Format_String(Line+Len, "m/s "); }
else if(isVarioUnitFPM)
{ Len+=Format_SignDec(Line+Len, (GPS->ClimbRate*5039+128)>>8, 2, 0);
Len+=Format_String(Line+Len, "fpm "); } }
else
{ if(isAltitudeUnitMeter) Len+=Format_String(Line+Len, "-----.-m");
else if(isAltitudeUnitFeet) Len+=Format_String(Line+Len, "-----ft ");
Len+=Format_String(Line+Len, " --.-m/s "); }
Line[Len]=0;
u8g2_DrawStr(OLED, 0, 36, Line);
Len=0;
@ -773,13 +792,21 @@ void OLED_DrawID(u8g2_t *OLED, GPS_Position *GPS)
void OLED_DrawAltitudeAndSpeed(u8g2_t *OLED, GPS_Position *GPS)
{ uint8_t Len;
bool inFeet = GPS->Sec&4; // decide if display altitude in meters or in feet
bool isAltitudeUnitMeter = Parameters.AltitudeUnit == 0; // display altitude in meters
bool isAltitudeUnitFeet = Parameters.AltitudeUnit == 1; // display altitude in feet
bool isSpeedUnitKMH = Parameters.SpeedUnit == 0; // display Speed in km/h
bool isSpeedUnitKnot = Parameters.SpeedUnit == 1; // display Speed in knot
bool isVarioUnitMPS = Parameters.VarioUnit == 0; // display Vario in m/s
bool isVarioUnitFPM = Parameters.VarioUnit == 1; // display Vario in fpm
// Standard Pressure Altitude
if(GPS && (GPS->hasBaro || GPS->isValid())) // if GPS has lock or just the pressure data
{ int32_t Alt = GPS->Altitude; // [0.1m/s] take GPS (geometrical) altitude
if(GPS->hasBaro) Alt = GPS->StdAltitude; // but if pressure sensor is there then replace with pressure altitude
if(inFeet) Alt = (Alt*336+512)>>10; // [0.1m] => [feet] // convert to feet
else Alt = (Alt+5)/10; // [0.1m] => [m] // or to meters
if(isAltitudeUnitMeter) Alt = (Alt+5)/10; // [0.1m] => [m] // or to meters
else if(isAltitudeUnitFeet) Alt = (Alt*336+512)>>10; // [0.1m] => [feet] // convert to feet
Len=Format_SignDec(Line, Alt, 1, 0, 1); } // print altitude into the string
else
Len=Format_String(Line, "----"); // if altitude not available then print place holders
@ -789,8 +816,8 @@ void OLED_DrawAltitudeAndSpeed(u8g2_t *OLED, GPS_Position *GPS)
u8g2_DrawStr(OLED, 60-Altitude_width, 40, Line); // print the string
u8g2_SetFont(OLED, u8g2_font_9x15_tr); // smaller font
if(inFeet) u8g2_DrawStr(OLED, 62, 40, "ft"); // print units
else u8g2_DrawStr(OLED, 64, 40, "m");
if(isAltitudeUnitMeter) u8g2_DrawStr(OLED, 64, 40, "m");
else if(isAltitudeUnitFeet) u8g2_DrawStr(OLED, 62, 40, "ft"); // print units
u8g2_SetFont(OLED, u8g2_font_fub17_tr);
if(GPS && GPS->isValid())
@ -807,6 +834,7 @@ void OLED_DrawAltitudeAndSpeed(u8g2_t *OLED, GPS_Position *GPS)
if(GPS && (GPS->hasBaro || GPS->isValid())) // if GPS has lock or just the pressure data
{ int16_t vario_value = GPS->ClimbRate; // [0.1m/s] climb rate
if(isVarioUnitFPM) vario_value = (vario_value*5039+128)>>8; // [0.1m/s] => [feet per meter]
if(vario_value<0)
{ vario_value=(-vario_value);
const int minus_width=10;
@ -826,7 +854,8 @@ void OLED_DrawAltitudeAndSpeed(u8g2_t *OLED, GPS_Position *GPS)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
u8g2_DrawXBM(OLED, 0, 47, plus_width, plus_height, plus_bits);
}
Len=Format_UnsDec(Line, vario_value, 2, 1);
if(isVarioUnitMPS) Len=Format_UnsDec(Line, vario_value, 2, 1);
if(isVarioUnitFPM) Len=Format_UnsDec(Line, vario_value, 2, 0);
}
else
Len=Format_String(Line, "-.-");
@ -835,16 +864,24 @@ void OLED_DrawAltitudeAndSpeed(u8g2_t *OLED, GPS_Position *GPS)
uint8_t Vario_width = u8g2_GetStrWidth(OLED, Line);
u8g2_DrawStr(OLED, 54-Vario_width, 64, Line);
const int ms_width=7;
const int ms_height=17;
static unsigned char ms_bits[] =
{ 0x00, 0x00, 0x16, 0x2a, 0x2a, 0x2a, 0x2a, 0x00, 0x7f, 0x00, 0x1c, 0x22,
0x02, 0x1c, 0x20, 0x22, 0x1c };
u8g2_DrawXBM(OLED, 58, 47, ms_width, ms_height, ms_bits);
if(isVarioUnitMPS)
{ const int ms_width=7;
const int ms_height=17;
static unsigned char ms_bits[] =
{ 0x00, 0x00, 0x16, 0x2a, 0x2a, 0x2a, 0x2a, 0x00, 0x7f, 0x00, 0x1c, 0x22,
0x02, 0x1c, 0x20, 0x22, 0x1c };
u8g2_DrawXBM(OLED, 58, 47, ms_width, ms_height, ms_bits); }
else if(isVarioUnitFPM)
{ const int ms_width=7;
const int ms_height=17;
static unsigned char ms_bits[] =
{ 0x84, 0xa2, 0xf7, 0xa2, 0xa2, 0xa2, 0xc2, 0x80, 0xff, 0x80, 0x00, 0x16, 0x2a, 0x2a, 0x2a, 0x2a, 0x00 };
u8g2_DrawXBM(OLED, 58, 47, ms_width, ms_height, ms_bits); }
// Speed
if(GPS && GPS->isValid())
{ uint16_t speed = (GPS->Speed*9+12)/25;
if(isSpeedUnitKnot) speed = (GPS->Speed*199+512)>>10;
Len=Format_UnsDec(Line, speed, 1, 0); }
else
Len=Format_String(Line, "--");
@ -853,13 +890,22 @@ void OLED_DrawAltitudeAndSpeed(u8g2_t *OLED, GPS_Position *GPS)
uint8_t Speed_width = u8g2_GetStrWidth(OLED, Line);
u8g2_DrawStr(OLED, 114-Speed_width, 64, Line);
const int kmh_width=10;
const int kmh_height=17;
static unsigned char kmh_bits[] =
{ 0x01, 0x00, 0x01, 0x00, 0x69, 0x01, 0xa5, 0x02, 0xa3, 0x02, 0xa5, 0x02,
0xa9, 0x02, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00,
0x08, 0x00, 0x38, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00 };
u8g2_DrawXBM(OLED, 118, 47, kmh_width, kmh_height, kmh_bits);
if(isSpeedUnitKMH)
{ const int kmh_width=10;
const int kmh_height=17;
static unsigned char kmh_bits[] =
{ 0x01, 0x00, 0x01, 0x00, 0x69, 0x01, 0xa5, 0x02, 0xa3, 0x02, 0xa5, 0x02,
0xa9, 0x02, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00,
0x08, 0x00, 0x38, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00 };
u8g2_DrawXBM(OLED, 118, 47, kmh_width, kmh_height, kmh_bits); }
else if(isSpeedUnitKnot)
{ const int kmh_width=10;
const int kmh_height=17;
static unsigned char kmh_bits[] =
{ 0x00, 0xfc, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0xfc, 0x01, 0xfc, 0x01, 0xfc,
0xe9, 0xfc, 0x25, 0xfd, 0x23, 0xfd, 0x25, 0xfd, 0x29, 0xfd, 0x00, 0xfc,
0x00, 0xfc, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0xfc};
u8g2_DrawXBM(OLED, 118, 47, kmh_width, kmh_height, kmh_bits); }
}
void OLED_DrawFlight(u8g2_t *OLED, GPS_Position *GPS) // draw flight status page

Wyświetl plik

@ -212,41 +212,25 @@ static void ParmForm_GPS(httpd_req_t *Req) // produce HTML form for GPS paramet
httpd_resp_sendstr_chunk(Req, "<div class=\"submit-row\"><input type=\"submit\" value=\"Save\"></div>\n");
httpd_resp_sendstr_chunk(Req, "</form>\n"); }
static void ParmForm_Other(httpd_req_t *Req) // produce HTML form for parameters not included in other forms
static void ParmForm_Page(httpd_req_t *Req) // produce HTML form for parameters not included in other forms
{ char Line[16]; int Len;
httpd_resp_sendstr_chunk(Req, "<h2>Other</h2>");
httpd_resp_sendstr_chunk(Req, "<form action=\"/parm.html\" method=\"POST\" id=\"Other\">\n");
httpd_resp_sendstr_chunk(Req, "<h2>Pages</h2>");
httpd_resp_sendstr_chunk(Req, "<form action=\"/parm.html\" method=\"POST\" id=\"Pages\">\n");
Begin_Control_Row(Req, "Freq. plan");
const char *FreqPlanTable[6] = { "Auto", "Europe/Africa", "USA/Canada", "Australia/Chile", "New Zeeland", "Izrael" };
SelectList(Req, "FreqPlan", FreqPlanTable, 6, Parameters.FreqPlan);
Begin_Control_Row(Req, "Altitude Unit");
const char *AltitudeUnitTable[2] = { "meter", "feet" } ;
SelectList(Req, "AltitudeUnit", AltitudeUnitTable, 2, Parameters.AltitudeUnit);
End_Control_Row(Req);
Begin_Control_Row(Req, "Tx power [dBm]");
httpd_resp_sendstr_chunk(Req, "<input type=\"text\" name=\"TxPower\" size=\"10\" value=\"");
Len=Format_SignDec(Line, (int16_t)Parameters.TxPower, 1, 0, 1);
httpd_resp_send_chunk(Req, Line, Len);
httpd_resp_sendstr_chunk(Req, "\">");
Begin_Control_Row(Req, "Speed Unit");
const char *SpeedUnitTable[2] = { "km/h", "knot" } ;
SelectList(Req, "SpeedUnit", SpeedUnitTable, 2, Parameters.SpeedUnit);
End_Control_Row(Req);
Begin_Control_Row(Req, "Freq.corr. [ppm]");
httpd_resp_sendstr_chunk(Req, "<input type=\"text\" name=\"RFchipFreqCorr\" size=\"10\" value=\"");
Len=Format_SignDec(Line, Parameters.RFchipFreqCorr, 2, 1, 1);
httpd_resp_send_chunk(Req, Line, Len);
httpd_resp_sendstr_chunk(Req, "\">");
End_Control_Row(Req);
Begin_Control_Row(Req, "Console baud");
httpd_resp_sendstr_chunk(Req, "<input type=\"text\" name=\"CONbaud\" size=\"10\" value=\"");
Len=Format_UnsDec(Line, Parameters.CONbaud);
httpd_resp_send_chunk(Req, Line, Len);
httpd_resp_sendstr_chunk(Req, "\">");
End_Control_Row(Req);
Begin_Control_Row(Req, "Verbose");
const char *VerboseTable[2] = { "0 (off)", "1 (on)" };
SelectList(Req, "Verbose", VerboseTable, 2, Parameters.Verbose);
Begin_Control_Row(Req, "Vario Unit");
const char *VarioUnitTable[2] = { "m/s", "fpm" } ;
SelectList(Req, "VarioUnit", VarioUnitTable, 2, Parameters.VarioUnit);
End_Control_Row(Req);
Begin_Control_Row(Req, "Pages");
@ -299,6 +283,45 @@ function pageCheckbox(checkbox) {\n\
}\n\
</script>\n");
httpd_resp_sendstr_chunk(Req, "<div class=\"submit-row\"><input type=\"submit\" value=\"Save\"></div>\n");
httpd_resp_sendstr_chunk(Req, "</form>\n"); }
static void ParmForm_Other(httpd_req_t *Req) // produce HTML form for parameters not included in other forms
{ char Line[16]; int Len;
httpd_resp_sendstr_chunk(Req, "<h2>Other</h2>");
httpd_resp_sendstr_chunk(Req, "<form action=\"/parm.html\" method=\"POST\" id=\"Other\">\n");
Begin_Control_Row(Req, "Freq. plan");
const char *FreqPlanTable[6] = { "Auto", "Europe/Africa", "USA/Canada", "Australia/Chile", "New Zeeland", "Izrael" };
SelectList(Req, "FreqPlan", FreqPlanTable, 6, Parameters.FreqPlan);
End_Control_Row(Req);
Begin_Control_Row(Req, "Tx power [dBm]");
httpd_resp_sendstr_chunk(Req, "<input type=\"text\" name=\"TxPower\" size=\"10\" value=\"");
Len=Format_SignDec(Line, (int16_t)Parameters.TxPower, 1, 0, 1);
httpd_resp_send_chunk(Req, Line, Len);
httpd_resp_sendstr_chunk(Req, "\">");
End_Control_Row(Req);
Begin_Control_Row(Req, "Freq.corr. [ppm]");
httpd_resp_sendstr_chunk(Req, "<input type=\"text\" name=\"RFchipFreqCorr\" size=\"10\" value=\"");
Len=Format_SignDec(Line, Parameters.RFchipFreqCorr, 2, 1, 1);
httpd_resp_send_chunk(Req, Line, Len);
httpd_resp_sendstr_chunk(Req, "\">");
End_Control_Row(Req);
Begin_Control_Row(Req, "Console baud");
httpd_resp_sendstr_chunk(Req, "<input type=\"text\" name=\"CONbaud\" size=\"10\" value=\"");
Len=Format_UnsDec(Line, Parameters.CONbaud);
httpd_resp_send_chunk(Req, Line, Len);
httpd_resp_sendstr_chunk(Req, "\">");
End_Control_Row(Req);
Begin_Control_Row(Req, "Verbose");
const char *VerboseTable[2] = { "0 (off)", "1 (on)" };
SelectList(Req, "Verbose", VerboseTable, 2, Parameters.Verbose);
End_Control_Row(Req);
httpd_resp_sendstr_chunk(Req, "<div class=\"submit-row\"><input type=\"submit\" value=\"Save\"></div>\n");
httpd_resp_sendstr_chunk(Req, "</form>\n"); }
@ -397,7 +420,14 @@ static void ParmForm_AP(httpd_req_t *Req) // Wi-Fi access point parameters { cha
httpd_resp_sendstr_chunk(Req, "</form>\n"); }
#endif
static void ParmForm_Defaults(httpd_req_t *Req)
{
httpd_resp_sendstr_chunk(Req, "\
<form action=\"/parm.html\" method=\"POST\" onsubmit=\"return confirm('Are you sure to restore default configuration?')\">\n\
<input type=\"submit\" value=\"Restore Default Configuration\">\n\
<input type=\"hidden\" name=\"Defaults\" value=\"1\">\n\
</form>\n");
}
static void ParmForm_Restart(httpd_req_t *Req)
{
@ -410,6 +440,184 @@ static void ParmForm_Restart(httpd_req_t *Req)
// ============================================================================================================
static void Table_System(httpd_req_t *Req)
{ char Line[128]; int Len;
uint32_t Time=TimeSync_Time();
uint32_t Sec = (Time-1)%60;
GPS_Position *GPS = GPS_getPosition(Sec); if(GPS==0) return;
httpd_resp_sendstr_chunk(Req, "<h2>System</h2>");
httpd_resp_sendstr_chunk(Req, "<table class=\"table table-striped table-bordered\">\n");
Len =Format_String(Line, "<tr><td>Board</td><td align=\"right\">");
#ifdef WITH_FollowMe
Len+=Format_String(Line+Len, "FollowMe");
#endif
#ifdef WITH_TTGO
Len+=Format_String(Line+Len, "TTGO");
#endif
#if defined(WITH_HELTEC) || defined(WITH_HELTEC_V2)
Len+=Format_String(Line+Len, "HELTEC");
#endif
#if defined(WITH_TBEAM) || defined(WITH_TBEAM_V10)
Len+=Format_String(Line+Len, "T-BEAM");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>Display</td><td align=\"right\">");
#ifdef WITH_ILI9341 // 320x240 M5stack
Len+=Format_String(Line+Len, "ILI9341");
#endif
#ifdef WITH_ST7789 // IPS 240x240 ST7789
Len+=Format_String(Line+Len, "ST7789");
#endif
#ifdef WITH_TFT_LCD // TFT LCD
Len+=Format_String(Line+Len, "TFT_LCD");
#endif
#ifdef WITH_OLED // OLED display on the I2C: some TTGO modules are without OLED display
Len+=Format_String(Line+Len, "OLED");
#endif
#ifdef WITH_OLED2 // 2nd OLED display, I2C address next higher
Len+=Format_String(Line+Len, "<br>OLED2");
#endif
#ifdef WITH_U8G2_OLED // I2C OLED through the U8g2 library
Len+=Format_String(Line+Len, "U8G2_OLED");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>GPS</td><td align=\"right\">");
#ifdef WITH_GPS_MTK
Len+=Format_String(Line+Len, "MTK GPS");
#endif
#ifdef WITH_GPS_UBX
Len+=Format_String(Line+Len, "UBX GPS");
#endif
#ifdef WITH_GPS_SRF
Len+=Format_String(Line+Len, "SRF GPS");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>Radio</td><td align=\"right\">");
#ifdef WITH_RFM95
Len+=Format_String(Line+Len, "RFM95");
#endif
#ifdef WITH_RFM69
Len+=Format_String(Line+Len, "RFM69");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>Baro</td><td align=\"right\">");
#ifdef WITH_BMP180
Len+=Format_String(Line+Len, "BMP180");
#endif
#ifdef WITH_BMP280
Len+=Format_String(Line+Len, "BMP280");
#endif
#ifdef WITH_BME280
Len+=Format_String(Line+Len, "BME280");
#endif
#ifdef WITH_MS5607
Len+=Format_String(Line+Len, "MS5607");
#endif
#ifdef WITH_MS5611
Len+=Format_String(Line+Len, "MS5611");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>Bluetooth serial port</td><td align=\"right\">");
#ifdef WITH_BT_SPP
Len+=Format_String(Line+Len, "Yes");
#else
Len+=Format_String(Line+Len, "No");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>LoRaWAN</td><td align=\"right\">");
#ifdef WITH_LORAWAN
Len+=Format_String(Line+Len, "Yes");
#else
Len+=Format_String(Line+Len, "No");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>Digital Buzzer</td><td align=\"right\">");
#ifdef WITH_BEEPER
Len+=Format_String(Line+Len, "Yes");
#else
Len+=Format_String(Line+Len, "No");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>Analog Sound</td><td align=\"right\">");
#ifdef WITH_SOUND
Len+=Format_String(Line+Len, "Yes");
#else
Len+=Format_String(Line+Len, "No");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>SD Card</td><td align=\"right\">");
#ifdef WITH_SD
Len+=Format_String(Line+Len, "Yes");
#else
Len+=Format_String(Line+Len, "No");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>SPIFFS</td><td align=\"right\">");
#ifdef WITH_SPIFFS
Len+=Format_String(Line+Len, "Yes");
#else
Len+=Format_String(Line+Len, "No");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>WiFi</td><td align=\"right\">");
#ifdef WITH_WIFI
Len+=Format_String(Line+Len, "Yes");
#else
Len+=Format_String(Line+Len, "No");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>Access Point (wifi)</td><td align=\"right\">");
#ifdef WITH_AP
Len+=Format_String(Line+Len, "Yes");
#else
Len+=Format_String(Line+Len, "No");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>Encrypt</td><td align=\"right\">");
#ifdef WITH_ENCRYPT
Len+=Format_String(Line+Len, "Yes");
#else
Len+=Format_String(Line+Len, "No");
#endif
Len+=Format_String(Line+Len, "</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
httpd_resp_sendstr_chunk(Req, "</table>\n"); }
static void Table_GPS(httpd_req_t *Req)
{ char Line[128]; int Len;
uint32_t Time=TimeSync_Time();
@ -771,6 +979,7 @@ static void Html_End(httpd_req_t *Req)
static esp_err_t parm_post_handler(httpd_req_t *Req)
{
bool Restart=0;
bool Defaults=0;
/* Destination buffer for content of HTTP POST request.
* httpd_req_recv() accepts char* only, but content could
* as well be any binary data (needs type casting).
@ -806,6 +1015,7 @@ static esp_err_t parm_post_handler(httpd_req_t *Req)
#endif
char *Line=URL;
Restart = strstr(Line,"Restart=1");
Defaults = strstr(Line,"Defaults=1");
for( ; ; )
{ Parameters.ReadLine(Line);
Line = strchr(Line, '&'); if(Line==0) break;
@ -813,6 +1023,9 @@ static esp_err_t parm_post_handler(httpd_req_t *Req)
free(URL);
Parameters.WriteToNVS();
if(Defaults)
{ Parameters.setDefault(); }
if(Restart)
{
#ifdef WITH_SPIFFS
@ -842,8 +1055,12 @@ static esp_err_t parm_get_handler(httpd_req_t *Req)
#ifdef WITH_STRATUX
ParmForm_Stratux(Req);
#endif
ParmForm_Page(Req);
ParmForm_Other(Req);
ParmForm_Defaults(Req);
ParmForm_Restart(Req);
Html_End(Req);
@ -860,6 +1077,7 @@ static esp_err_t top_get_handler(httpd_req_t *Req)
httpd_resp_send_chunk(Req, Line, Len);
httpd_resp_sendstr_chunk(Req, "</b><br />\n");
Table_System(Req);
Table_GPS(Req);
Table_RF(Req);
Table_Batt(Req);

Wyświetl plik

@ -128,8 +128,11 @@ class FlashParameters
union
{ uint32_t Page;
struct
{ uint32_t PageMask:27; // enable/disable individual pages on the LCD or OLED screen
{ uint32_t PageMask:21; // enable/disable individual pages on the LCD or OLED screen
uint8_t InitialPage:5; // the first page to show after boot
uint8_t AltitudeUnit:2; // 0=meter, 1=feet
uint8_t SpeedUnit:2; // 0=km/h, 1=knot
uint8_t VarioUnit:2; // 0=m/s, 1=feet/minute
} ;
} ;
@ -269,6 +272,9 @@ uint16_t StratuxPort;
PPSdelay = DEFAULT_PPSdelay; // [ms]
PageMask = 0xFF;
InitialPage = 0;
AltitudeUnit = 0; // meter
SpeedUnit = 0; // km/h
VarioUnit = 0; // m/s
for(uint8_t Idx=0; Idx<InfoParmNum; Idx++)
InfoParmValue(Idx)[0] = 0;
#ifdef WITH_LORAWAN
@ -686,6 +692,15 @@ uint16_t StratuxPort;
if(strcmp(Name, "InitialPage")==0)
{ int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0;
InitialPage=Mode; return 1; }
if(strcmp(Name, "AltitudeUnit")==0)
{ int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0;
AltitudeUnit=Mode; return 1; }
if(strcmp(Name, "SpeedUnit")==0)
{ int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0;
SpeedUnit=Mode; return 1; }
if(strcmp(Name, "VarioUnit")==0)
{ int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0;
VarioUnit=Mode; return 1; }
if(strcmp(Name, "Verbose")==0)
{ int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0;
Verbose=Mode; return 1; }
@ -871,6 +886,9 @@ uint16_t StratuxPort;
Write_Hex (Line, "GNSS" , (uint32_t)GNSS, 2); strcat(Line, " # [ mask]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_Hex (Line, "PageMask" , (uint32_t)PageMask, 4); strcat(Line, " # [ mask]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_UnsDec (Line, "InitialPage" , (uint32_t)InitialPage ); strcat(Line, " # [ ]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_UnsDec (Line, "AltitudeUnit", (uint32_t)AltitudeUnit); strcat(Line, " # [ ]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_UnsDec (Line, "SpeedUnit", (uint32_t)SpeedUnit); strcat(Line, " # [ ]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_UnsDec (Line, "VarioUnit", (uint32_t)VarioUnit); strcat(Line, " # [ ]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_UnsDec (Line, "PPSdelay" , (uint32_t)PPSdelay ); strcat(Line, " # [ ms]\n"); if(fputs(Line, File)==EOF) return EOF;
#ifdef WITH_BT_PWR
Write_UnsDec (Line, "Bluetooth" , BT_ON ); strcat(Line, " # [ 1|0]\n"); if(fputs(Line, File)==EOF) return EOF;
@ -939,6 +957,9 @@ uint16_t StratuxPort;
Write_Hex (Line, "GNSS" , (uint32_t)GNSS , 2); strcat(Line, " # [ mask]\n"); Format_String(Output, Line);
Write_Hex (Line, "PageMask" , (uint32_t)PageMask, 4); strcat(Line, " # [ mask]\n"); Format_String(Output, Line);
Write_UnsDec (Line, "InitialPage" , (uint32_t)InitialPage ); strcat(Line, " # [ ]\n"); Format_String(Output, Line);
Write_UnsDec (Line, "AltitudeUnit" , (uint32_t)AltitudeUnit); strcat(Line, " # [ ]\n"); Format_String(Output, Line);
Write_UnsDec (Line, "SpeedUnit" , (uint32_t)SpeedUnit); strcat(Line, " # [ ]\n"); Format_String(Output, Line);
Write_UnsDec (Line, "VarioUnit" , (uint32_t)VarioUnit); strcat(Line, " # [ ]\n"); Format_String(Output, Line);
Write_UnsDec (Line, "PPSdelay" , (uint32_t)PPSdelay ); strcat(Line, " # [ ms]\n"); Format_String(Output, Line);
#ifdef WITH_BT_PWR
Write_UnsDec (Line, "Bluetooth" , BT_ON ); strcat(Line, " # [ 1|0]\n"); Format_String(Output, Line);

Wyświetl plik

@ -1,5 +1,5 @@
#include <string.h>
#include "config.h" //Added By Fab501
#include "wifi.h"
#include "format.h"
@ -49,7 +49,23 @@ static esp_err_t WIFI_event_handler(void *ctx, system_event_t *event)
return ESP_OK; }
esp_err_t WIFI_Init(void)
{ esp_err_t Err;
{
//Fab501 test to change IP to 192.168.1.1 for comptability with SkyDemon
esp_netif_init();
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_t* wifiAP = esp_netif_create_default_wifi_ap();
esp_netif_ip_info_t ipInfo;
IP4_ADDR(&ipInfo.ip, WIFI_ADDRESS_IP1,WIFI_ADDRESS_IP2,WIFI_ADDRESS_IP3,WIFI_ADDRESS_IP4); // Change IP in config.h
IP4_ADDR(&ipInfo.gw, WIFI_ADDRESS_GW1,WIFI_ADDRESS_GW2,WIFI_ADDRESS_GW3,WIFI_ADDRESS_GW4); // Change GATEWAY in config.h
IP4_ADDR(&ipInfo.netmask, WIFI_ADDRESS_MK1,WIFI_ADDRESS_MK2,WIFI_ADDRESS_MK3,WIFI_ADDRESS_MK4); // change MASK in config.h
esp_netif_dhcps_stop(wifiAP);
esp_netif_set_ip_info(wifiAP, &ipInfo);
esp_netif_dhcps_start(wifiAP);
// end of Fab501 changes
esp_err_t Err;
tcpip_adapter_init();
Err = esp_event_loop_init(WIFI_event_handler, NULL); if(Err!=ESP_OK) return Err;
wifi_init_config_t Config = WIFI_INIT_CONFIG_DEFAULT();