kopia lustrzana https://github.com/pjalocha/esp32-ogn-tracker
Add BT icon on the OLED status bar
rodzic
6283e07b58
commit
3a82baf506
|
@ -517,7 +517,7 @@ void OLED_DrawBattery(u8g2_t *OLED, GPS_Position *GPS) // draw battery status pa
|
|||
#endif
|
||||
}
|
||||
|
||||
void OLED_DrawStatusBar(u8g2_t *OLED, GPS_Position *GPS)
|
||||
void OLED_DrawStatusBar(u8g2_t *OLED, GPS_Position *GPS) // status bar on top of the OLED
|
||||
{ static bool Odd=0;
|
||||
#ifdef WITH_MAVLINK
|
||||
uint8_t Cap = MAVLINK_BattCap; // [%]
|
||||
|
@ -546,7 +546,12 @@ void OLED_DrawStatusBar(u8g2_t *OLED, GPS_Position *GPS)
|
|||
#ifdef WITH_SD
|
||||
if(SD_isMounted())
|
||||
{ u8g2_SetFont(OLED, u8g2_font_twelvedings_t_all);
|
||||
u8g2_DrawGlyph(OLED, 30, 12, 0x73); }
|
||||
u8g2_DrawGlyph(OLED, 24, 12, 0x73); }
|
||||
#endif
|
||||
#ifdef WITH_BT_SPP
|
||||
if(BT_SPP_isConnected())
|
||||
{ u8g2_SetFont(OLED, u8g2_font_open_iconic_embedded_1x_t);
|
||||
u8g2_DrawGlyph(OLED, 36, 11, 0x4A); }
|
||||
#endif
|
||||
// u8g2_SetFont(OLED, u8g2_font_5x7_tr);
|
||||
// u8g2_SetFont(OLED, u8g2_font_5x8_tr);
|
||||
|
|
|
@ -590,6 +590,8 @@ static uint32_t BT_SPP_TxCong = 0; // congestion control
|
|||
|
||||
// static const char *BT_SPP_Welcome = "ESP32 OGN-Tracker\n";
|
||||
|
||||
bool BT_SPP_isConnected(void) { return BT_SPP_Conn; } // is a client conencted to BT_SPP ?
|
||||
|
||||
static void setPilotID(esp_bd_addr_t MAC, size_t Len=6) // set PilotID in the parameters from the BT SPP client MAC (thus Pilot's smartphone)
|
||||
{ char *ID = Parameters.PilotID;
|
||||
ID[0]='B'; ID[1]='T'; ID[2]='_'; ID+=3;
|
||||
|
@ -626,7 +628,7 @@ static void esp_spp_cb(esp_spp_cb_event_t Event, esp_spp_cb_param_t *Param)
|
|||
BT_SPP_TxFIFO.Clear(); // clear the TxFIFO
|
||||
BT_SPP_Conn = Param->srv_open.handle; // store handle for esp_spp_write()
|
||||
BT_SPP_TxCong = 0; // assume no congestion
|
||||
setPilotID(Param->srv_open.rem_bda, sizeof(esp_bd_addr_t)); // PilotID is not taken from the connected BT client
|
||||
setPilotID(Param->srv_open.rem_bda, sizeof(esp_bd_addr_t)); // PilotID is now taken from the connected BT client
|
||||
// memcpy(BT_SPP_MAC, Param->srv_open.rem_bda, sizeof(esp_bd_addr_t));
|
||||
// esp_spp_write(Param->srv_open.handle, BT_SPP_Wait, (uint8_t *)BT_SPP_Welcome); // write Welcome message to the BT_SPP
|
||||
#ifdef DEBUG_PRINT
|
||||
|
|
|
@ -168,6 +168,7 @@ int NVS_Init(void); // initialize non-volatile-storage in t
|
|||
|
||||
#ifdef WITH_BT_SPP
|
||||
int BT_SPP_Init(void);
|
||||
bool BT_SPP_isConnected(void);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_SPIFFS
|
||||
|
|
Ładowanie…
Reference in New Issue