Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upd #1

Merged
merged 76 commits into from
Apr 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
4be0fbf
Give access over USB MSC to (Q)SPI flash memory on Badge Edition
lyusupov Feb 6, 2021
8e2a3c6
new options to change settings of a Badge over USB: 1) Mass Storage, …
lyusupov Feb 8, 2021
ca78b70
fix of a build regression for Raspberry Pi
lyusupov Feb 8, 2021
f0fd2c2
Badge: BLE MIDI is doing good [skip ci]
lyusupov Feb 8, 2021
6e86b64
illustration of 'Mass Storage' method to change settings of a Badge […
lyusupov Feb 9, 2021
787ccaa
Simplified MIDI and Battery BLE services for ESP32 port [skip ci]
lyusupov Feb 9, 2021
3486ba3
one more option of audio transport for the Badge [skip ci]
lyusupov Feb 10, 2021
eabc497
SkyView EZ: fix against regression of 'Voice Alert' message [skip ci]
lyusupov Feb 10, 2021
ddd851b
SkyView Pi: fix against regression of 'Please wait' splash screen [sk…
lyusupov Feb 10, 2021
398ec04
Barometric sensor data EPD infopage for Badge
lyusupov Feb 11, 2021
8911852
nRF52 build fix
lyusupov Feb 11, 2021
c1ea6a4
SkyView: improved voice alerts logic [skip ci]
lyusupov Feb 11, 2021
47c1c39
Firmware binary 0.11 for SkyView EZ is out [skip ci]
lyusupov Feb 12, 2021
277a587
cosmetic README update [skip ci]
lyusupov Feb 12, 2021
dfca93a
fix against no access to settings when GNSS NMEA is off
lyusupov Feb 13, 2021
edaf81b
value of temperature has been added into LK8EX1 sentence
lyusupov Feb 13, 2021
9abf34d
show NA on OLED when battery voltage value is not available
lyusupov Feb 13, 2021
33c3370
cross-platform settings extension added
lyusupov Feb 13, 2021
66c5778
Badge: BLE Nordic Uart Service has been made optional
lyusupov Feb 14, 2021
88c3227
HIGH level of GPIO7 deactivates battery voltage monitor of Mini [skip…
lyusupov Feb 14, 2021
e519845
make use of Badge blue LED to indicate BLE connection status [skip ci]
lyusupov Feb 15, 2021
4238a09
one more (optional) 0.96" I2C OLED infopage [skip ci]
lyusupov Feb 15, 2021
f57714c
Badge: default h/w board setting is REV_2 [skip ci]
lyusupov Feb 19, 2021
42d8e1e
Badge: E-paper screens cosmetic
lyusupov Feb 20, 2021
d6f2b8d
fix agains regression of build for Raspberry Edition
lyusupov Feb 20, 2021
4e2e937
further improvements of the Badge UI [skip ci]
lyusupov Feb 21, 2021
db758f1
update of the Badge firmware binaries [skip ci]
lyusupov Feb 22, 2021
56e2950
update of AXP192/202 PMU library [skip ci]
lyusupov Feb 27, 2021
9a484f7
SkyView: initial bringup of LilyGO T5 4.7 inch e-Paper display board …
lyusupov Feb 27, 2021
f3a8910
ESP32: transition onto Arduino Core 1.0.5
lyusupov Mar 7, 2021
8187786
update of Travis CI script
lyusupov Mar 7, 2021
611c70d
fix against regression of SkyWatch build
lyusupov Mar 7, 2021
32d2c72
Mini: anticipating appearance of htcc-ab02s-v2 with Air530Z [skip ci]
lyusupov Mar 8, 2021
2fc2b88
SoftRF: enabling of two functions from ESP32 'on hold' list [skip ci]
lyusupov Mar 8, 2021
b7c5067
SoftRF: update of post-init procedure
lyusupov Mar 8, 2021
ff6a085
SkyView EZ: maintenance release 0.12 [skip ci]
lyusupov Mar 8, 2021
0ffddcc
SoftRF: low level sound layer
lyusupov Mar 9, 2021
c6468bd
logic of sound alert
lyusupov Mar 11, 2021
70344f2
new features freeze before release
lyusupov Mar 11, 2021
e9b1abb
ESP32: buzzer volume fix [skip ci]
lyusupov Mar 12, 2021
c4ef24d
More credits to developers of libraries [skip ci]
lyusupov Mar 12, 2021
2e3ac3a
ESP8266: fix against regression of UAV mode ( #99 ) [skip ci]
lyusupov Mar 12, 2021
a22a5e1
clean-up of Battery API
lyusupov Mar 15, 2021
50a4770
SkyView: misc. update of 0.12 firmware binary [skip ci]
lyusupov Mar 15, 2021
c5b3fbb
Current state is good enough to qualify it as 1.0-RC9
lyusupov Mar 15, 2021
7c66f82
RC9 firmware binaries for ESP8266, ESP32, ASR6502 and nRF52840 [skip ci]
lyusupov Mar 15, 2021
40b22e1
RC9 firmware binaries for Dongle (S76G) and Uni (CC1352) Editions [sk…
lyusupov Mar 16, 2021
b14a1c4
Uni and Mini: PFLAU NMEA sentence extension is back on [skip ci]
lyusupov Mar 20, 2021
4e5da59
give some space for other nRF52 firmware binaries [skip ci]
lyusupov Mar 31, 2021
dd5f9c3
few files for nRF52 port of iLogger (Flight Recorder) [skip ci]
lyusupov Mar 31, 2021
d914d6e
rest of files for iLogger port onto nRF52 plarform [skip ci]
lyusupov Mar 31, 2021
3a4d784
UF2 binary of CircuitPython6 interpreter for LilyGO T-Echo - 'QSPI fl…
lyusupov Mar 31, 2021
123b99e
misc. update of one Mini illustration [skip ci]
lyusupov Apr 4, 2021
2cba567
update of status gen. URL [skip ci]
lyusupov Apr 5, 2021
1c962ed
update of reference on multiple units usage guidance [skip ci]
lyusupov Apr 5, 2021
8437f20
iLogger: GNSS and air pressure sensors has been sorted out [skip ci]
lyusupov Apr 7, 2021
692344f
update of the Badge enclosure: 1) base frame [skip ci]
lyusupov Apr 7, 2021
3ae5a08
update of the Badge enclosure: 2) front [skip ci]
lyusupov Apr 7, 2021
25070bd
update of Badge illustrations [skip ci]
lyusupov Apr 8, 2021
9eab924
two more illustrations of the Badge [skip ci]
lyusupov Apr 8, 2021
e2db565
update of the Badge enclosure page [skip ci]
lyusupov Apr 8, 2021
f7e0cab
RF loopback detector
lyusupov Apr 9, 2021
55432da
SoftRF: update of RC9 firmware binaries for ESP32 and ASR6502 [skip ci]
lyusupov Apr 10, 2021
6ec2653
nRF52: SoftSPI library is no longer in use [skip ci]
lyusupov Apr 10, 2021
54bf4e1
XCSoar7 preview binaries are no longer in use [skip ci]
lyusupov Apr 10, 2021
0f47b9e
few more illustrations for Badge wiki [skip ci]
lyusupov Apr 10, 2021
80812ac
misc. update of RC9 binaries for S76G [skip ci]
lyusupov Apr 12, 2021
54e0afb
one more power saving option added
lyusupov Apr 12, 2021
065660a
space allocation for 0.49" OLED driver
lyusupov Apr 12, 2021
0a18e4d
T-Echo REV2 bringup quirks [skip ci]
lyusupov Apr 13, 2021
5cf3eab
low power sleep for T-Echo REV_2 [skip ci]
lyusupov Apr 13, 2021
504e92a
T-Echo sleep current is reduced down to 150uA. Thank you for the tip,…
lyusupov Apr 13, 2021
79c2735
Badge: default traffic ID info is the aircraft type [skip ci]
lyusupov Apr 15, 2021
14b40b3
Badge: minor update of the UTC clock logic [skip ci]
lyusupov Apr 15, 2021
cd190ef
Badge: fix for UTC clock 'cosmetic' issue [skip ci]
lyusupov Apr 15, 2021
0a092db
update of RC9 firmware binaries for nRF52 platform [skip ci]
lyusupov Apr 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Barometric sensor data EPD infopage for Badge
  • Loading branch information
lyusupov committed Feb 11, 2021
commit 398ec04b12b94434eb6d04f74c913463402b4deb
1 change: 1 addition & 0 deletions software/firmware/source/SoftRF/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ UI_CPPS := $(UI_PATH)/Web.cpp \
$(UI_PATH)/Radar_EPD.cpp \
$(UI_PATH)/Status_EPD.cpp \
$(UI_PATH)/Text_EPD.cpp \
$(UI_PATH)/Baro_EPD.cpp \
$(UI_PATH)/Time_EPD.cpp

SYSTEM_CPPS := $(SYSTEM_PATH)/SoC.cpp \
Expand Down
120 changes: 89 additions & 31 deletions software/firmware/source/SoftRF/src/driver/Baro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
#include "Baro.h"

#if defined(EXCLUDE_BMP180) && defined(EXCLUDE_BMP280) && defined(EXCLUDE_MPL3115A2)
byte Baro_setup() {return BARO_MODULE_NONE;}
void Baro_loop() {}
byte Baro_setup() {return BARO_MODULE_NONE;}
void Baro_loop() {}
float Baro_altitude() {return 0;}
float Baro_pressure() {return 0;}
float Baro_temperature() {return 0;}
#else

#if !defined(EXCLUDE_BMP180)
Expand All @@ -49,16 +52,17 @@ Adafruit_BMP280 bmp280;
Adafruit_MPL3115A2 mpl3115a2 = Adafruit_MPL3115A2();
#endif /* EXCLUDE_MPL3115A2 */

static unsigned long BaroTimeMarker = 0;
static float prev_pressure_altitude = 0;
static float Baro_altitude_cache = 0;
static float Baro_pressure_cache = 0;
static float Baro_temperature_cache = 0;

static unsigned long BaroAltitudeTimeMarker = 0;
static unsigned long BaroPresTempTimeMarker = 0;
static float prev_pressure_altitude = 0;

#define VS_AVERAGING_FACTOR 4
static float Baro_VS[VS_AVERAGING_FACTOR];
static int avg_ndx = 0;

/* 4 baro sensor readings per second */
#define isTimeToBaro() ((millis() - BaroTimeMarker) > (1000 / VS_AVERAGING_FACTOR))

#if !defined(EXCLUDE_BMP180)
static bool bmp180_probe()
{
Expand All @@ -80,18 +84,6 @@ static void bmp180_setup()
Serial.print(F("Altitude = "));
Serial.print(bmp180.readAltitude());
Serial.println(F(" meters"));

Serial.print(F("Pressure at sealevel (calculated) = "));
Serial.print(bmp180.readSealevelPressure());
Serial.println(F(" Pa"));

// you can get a more precise measurement of altitude
// if you know the current sea level pressure which will
// vary with weather and such. If it is 1015 millibars
// that is equal to 101500 Pascals.
Serial.print(F("Real altitude = "));
Serial.print(bmp180.readAltitude(101500));
Serial.println(F(" meters"));

Serial.println();
delay(500);
Expand All @@ -102,12 +94,24 @@ static float bmp180_altitude(float sealevelPressure)
return bmp180.readAltitude(sealevelPressure * 100);
}

static float bmp180_pressure()
{
return (float) bmp180.readPressure();
}

static float bmp180_temperature()
{
return bmp180.readTemperature();
}

barochip_ops_t bmp180_ops = {
BARO_MODULE_BMP180,
"BMP180",
bmp180_probe,
bmp180_setup,
bmp180_altitude
bmp180_altitude,
bmp180_pressure,
bmp180_temperature
};
#endif /* EXCLUDE_BMP180 */

Expand Down Expand Up @@ -145,12 +149,24 @@ static float bmp280_altitude(float sealevelPressure)
return bmp280.readAltitude(sealevelPressure);
}

static float bmp280_pressure()
{
return bmp280.readPressure();
}

static float bmp280_temperature()
{
return bmp280.readTemperature();
}

barochip_ops_t bmp280_ops = {
BARO_MODULE_BMP280,
"BMP280",
bmp280_probe,
bmp280_setup,
bmp280_altitude
bmp280_altitude,
bmp280_pressure,
bmp280_temperature
};
#endif /* EXCLUDE_BMP280 */

Expand Down Expand Up @@ -182,12 +198,24 @@ static float mpl3115a2_altitude(float sealevelPressure)
return mpl3115a2.getAltitude();
}

static float mpl3115a2_pressure()
{
return mpl3115a2.getPressure();
}

static float mpl3115a2_temperature()
{
return mpl3115a2.getTemperature();
}

barochip_ops_t mpl3115a2_ops = {
BARO_MODULE_MPL3115A2,
"MPL3115A2",
mpl3115a2_probe,
mpl3115a2_setup,
mpl3115a2_altitude
mpl3115a2_altitude,
mpl3115a2_pressure,
mpl3115a2_temperature
};
#endif /* EXCLUDE_MPL3115A2 */

Expand Down Expand Up @@ -223,8 +251,13 @@ byte Baro_setup()

baro_chip->setup();

prev_pressure_altitude = baro_chip->altitude(1013.25);
BaroTimeMarker = millis();
Baro_pressure_cache = baro_chip->pressure();
Baro_temperature_cache = baro_chip->temperature();
BaroPresTempTimeMarker = millis();

Baro_altitude_cache = baro_chip->altitude(1013.25);
ThisAircraft.pressure_altitude = prev_pressure_altitude = Baro_altitude_cache;
BaroAltitudeTimeMarker = millis();

for (int i=0; i<VS_AVERAGING_FACTOR; i++) {
Baro_VS[i] = 0;
Expand All @@ -242,13 +275,17 @@ byte Baro_setup()

void Baro_loop()
{
if (baro_chip && isTimeToBaro()) {
if (baro_chip == NULL) return;

if (isTimeToBaroAltitude()) {

/* Draft of pressure altitude and vertical speed calculation */
ThisAircraft.pressure_altitude = baro_chip->altitude(1013.25);
Baro_altitude_cache = baro_chip->altitude(1013.25);

ThisAircraft.pressure_altitude = Baro_altitude_cache;

Baro_VS[avg_ndx] = (ThisAircraft.pressure_altitude - prev_pressure_altitude) /
(millis() - BaroTimeMarker) * 1000; /* in m/s */
Baro_VS[avg_ndx] = (Baro_altitude_cache - prev_pressure_altitude) /
(millis() - BaroAltitudeTimeMarker) * 1000; /* in m/s */

ThisAircraft.vs = 0;
for (int i=0; i<VS_AVERAGING_FACTOR; i++) {
Expand All @@ -262,15 +299,36 @@ void Baro_loop()

ThisAircraft.vs *= (_GPS_FEET_PER_METER * 60.0) ; /* feet per minute */

prev_pressure_altitude = ThisAircraft.pressure_altitude;
BaroTimeMarker = millis();
prev_pressure_altitude = Baro_altitude_cache;
BaroAltitudeTimeMarker = millis();
avg_ndx = (avg_ndx + 1) % VS_AVERAGING_FACTOR;

#if 0
Serial.print(F("P.Alt. = ")); Serial.print(ThisAircraft.pressure_altitude);
Serial.print(F(" , VS avg. = ")); Serial.println(ThisAircraft.vs);
#endif
}

if (isTimeToBaroPresTemp()) {
Baro_pressure_cache = baro_chip->pressure();
Baro_temperature_cache = baro_chip->temperature();
BaroPresTempTimeMarker = millis();
}
}

float Baro_altitude()
{
return Baro_altitude_cache;
}

float Baro_pressure()
{
return Baro_pressure_cache;
}

float Baro_temperature()
{
return Baro_temperature_cache;
}

#endif /* EXCLUDE_BMP180 && EXCLUDE_BMP280 EXCLUDE_MPL3115A2 */
20 changes: 16 additions & 4 deletions software/firmware/source/SoftRF/src/driver/Baro.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@
#ifndef BAROHELPER_H
#define BAROHELPER_H

#define BMP280_ADDRESS_ALT 0x76 /* GY-91, SA0 is NC */
#define BMP280_ADDRESS_ALT 0x76 /* GY-91, SA0 is NC */

#define VS_AVERAGING_FACTOR 3

/* 3 baro sensor altitude readings per second */
#define isTimeToBaroAltitude() ((millis() - BaroAltitudeTimeMarker) > (1000 / VS_AVERAGING_FACTOR))
/* read pressure and temperature every 3 seconds */
#define isTimeToBaroPresTemp() ((millis() - BaroPresTempTimeMarker) > 3000)

enum
{
Expand All @@ -35,12 +42,17 @@ typedef struct barochip_ops_struct {
bool (*probe)();
void (*setup)();
float (*altitude)(float);
float (*pressure)();
float (*temperature)();
} barochip_ops_t;

extern barochip_ops_t *baro_chip;

bool Baro_probe(void);
byte Baro_setup(void);
void Baro_loop(void);
bool Baro_probe(void);
byte Baro_setup(void);
void Baro_loop(void);
float Baro_altitude(void);
float Baro_pressure(void);
float Baro_temperature(void);

#endif /* BAROHELPER_H */
2 changes: 1 addition & 1 deletion software/firmware/source/SoftRF/src/driver/Battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void Battery_loop()
hw_info.model == SOFTRF_MODEL_BADGE ||
hw_info.model == SOFTRF_MODEL_UNI ) {

if (voltage > 1.8 && voltage < Battery_cutoff()) {
if (voltage > BATTERY_THRESHOLD_INVALID && voltage < Battery_cutoff()) {
if (Battery_cutoff_count > 2) {
shutdown(SOFTRF_SHUTDOWN_LOWBAT);
} else {
Expand Down
2 changes: 2 additions & 0 deletions software/firmware/source/SoftRF/src/driver/Battery.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#define isTimeToBattery() (millis() - Battery_TimeMarker > 5000)

#define BATTERY_THRESHOLD_INVALID 1.8

#define BATTERY_THRESHOLD_NIMHX2 2.3
#define BATTERY_THRESHOLD_LIPO 3.5
#define BATTERY_THRESHOLD_LIFE 3.0
Expand Down
13 changes: 13 additions & 0 deletions software/firmware/source/SoftRF/src/driver/EPD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ bool EPD_setup(bool splash_screen)
EPD_status_setup();
EPD_radar_setup();
EPD_text_setup();
EPD_baro_setup();
EPD_time_setup();

EPDTimeMarker = millis();
Expand Down Expand Up @@ -211,6 +212,9 @@ void EPD_loop()
case VIEW_MODE_TEXT:
EPD_text_loop();
break;
case VIEW_MODE_BARO:
EPD_baro_loop();
break;
case VIEW_MODE_TIME:
EPD_time_loop();
break;
Expand Down Expand Up @@ -261,6 +265,9 @@ void EPD_Mode()
EPD_view_mode = VIEW_MODE_TEXT;
EPD_vmode_updated = true;
} else if (EPD_view_mode == VIEW_MODE_TEXT) {
EPD_view_mode = VIEW_MODE_BARO;
EPD_vmode_updated = true;
} else if (EPD_view_mode == VIEW_MODE_BARO) {
EPD_view_mode = VIEW_MODE_TIME;
EPD_vmode_updated = true;
} else if (EPD_view_mode == VIEW_MODE_TIME) {
Expand All @@ -281,6 +288,9 @@ void EPD_Up()
case VIEW_MODE_TEXT:
EPD_text_prev();
break;
case VIEW_MODE_BARO:
EPD_baro_prev();
break;
case VIEW_MODE_TIME:
EPD_time_prev();
break;
Expand All @@ -303,6 +313,9 @@ void EPD_Down()
case VIEW_MODE_TEXT:
EPD_text_next();
break;
case VIEW_MODE_BARO:
EPD_baro_next();
break;
case VIEW_MODE_TIME:
EPD_time_next();
break;
Expand Down
6 changes: 6 additions & 0 deletions software/firmware/source/SoftRF/src/driver/EPD.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum
VIEW_MODE_STATUS,
VIEW_MODE_RADAR,
VIEW_MODE_TEXT,
VIEW_MODE_BARO,
VIEW_MODE_TIME
};

Expand Down Expand Up @@ -213,6 +214,11 @@ void EPD_text_loop();
void EPD_text_next();
void EPD_text_prev();

void EPD_baro_setup();
void EPD_baro_loop();
void EPD_baro_next();
void EPD_baro_prev();

void EPD_time_setup();
void EPD_time_loop();
void EPD_time_next();
Expand Down
6 changes: 3 additions & 3 deletions software/firmware/source/SoftRF/src/platform/nRF52.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,22 +278,22 @@ static void nRF52_setup()
pinMode(SOC_GPIO_PIN_3V3_PWR, OUTPUT);
delay(100);

if (SoC->Battery_voltage() > 2.0) { /* VBUS is ON */
if (SoC->Battery_voltage() > BATTERY_THRESHOLD_INVALID) { /* VBUS is ON */
nRF52_board = NRF52_LILYGO_TECHO_REV_0;
pinMode(SOC_GPIO_PIN_IO_PWR, OUTPUT); /* VDD_POWR is ON */
pinMode(SOC_GPIO_PIN_3V3_PWR, INPUT);
} else {
pinMode(SOC_GPIO_PIN_IO_PWR, OUTPUT); /* VDD_POWR is ON */
delay(100);

if (SoC->Battery_voltage() > 2.0) {
if (SoC->Battery_voltage() > BATTERY_THRESHOLD_INVALID) {
nRF52_board = NRF52_LILYGO_TECHO_REV_0;
pinMode(SOC_GPIO_PIN_3V3_PWR, INPUT);
} else {
digitalWrite(SOC_GPIO_PIN_3V3_PWR, HIGH); /* PWR_EN is ON */
delay(100);

if (SoC->Battery_voltage() > 2.0) {
if (SoC->Battery_voltage() > BATTERY_THRESHOLD_INVALID) {
nRF52_board = NRF52_LILYGO_TECHO_REV_2;
} else {
pinMode(SOC_GPIO_PIN_3V3_PWR, INPUT);
Expand Down
2 changes: 2 additions & 0 deletions software/firmware/source/SoftRF/src/protocol/data/JSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,8 @@ void parseUISettings(JsonObject& root)
ui_settings.vmode = VIEW_MODE_RADAR;
} else if (!strcmp(vmode_s,"TEXT")) {
ui_settings.vmode = VIEW_MODE_TEXT;
} else if (!strcmp(vmode_s,"BARO")) {
ui_settings.vmode = VIEW_MODE_BARO;
} else if (!strcmp(vmode_s,"TIME")) {
ui_settings.vmode = VIEW_MODE_TIME;
}
Expand Down
Loading