Fix various SX1280 issues, revamp RX ISR flow

This commit is contained in:
jacob.eva 2024-07-03 11:06:52 +01:00
parent 11c9522d53
commit 379dce99b3
No known key found for this signature in database
GPG Key ID: 0B92E083BBCCAA1E
7 changed files with 236 additions and 84 deletions

View File

@ -626,9 +626,8 @@
#define HAS_PMU true
#define HAS_NP false
#define HAS_SD false
#define HAS_RF_SWITCH_RX_TX true
#define CONFIG_UART_BUFFER_SIZE 6144
#define CONFIG_QUEUE_SIZE 6144
#define CONFIG_QUEUE_0_SIZE 6144
#define CONFIG_QUEUE_MAX_LENGTH 200
#define EEPROM_SIZE 296
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
@ -647,7 +646,7 @@
true // DIO2_AS_RF_SWITCH
}
};
const uint8_t interface_pins[INTERFACE_COUNT][10] = {
const int8_t interface_pins[INTERFACE_COUNT][10] = {
// SX1262
{
42, // pin_ss

View File

@ -100,6 +100,9 @@
uint32_t stat_rx = 0;
uint32_t stat_tx = 0;
unsigned long last_tx = 0;
unsigned long last_rx = 0;
// Power management
#define BATTERY_STATE_DISCHARGING 0x01
#define BATTERY_STATE_CHARGING 0x02

View File

@ -143,6 +143,10 @@ const uint8_t pages = 3;
uint8_t disp_page = START_PAGE;
uint8_t interface_page = START_PAGE;
uint8_t* online_interface_list;
uint8_t online_interfaces = 0;
#if DISPLAY == OLED
#define WATERFALL_SIZE 46
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
@ -369,7 +373,7 @@ void draw_lora_icon(RadioInterface* radio, int px, int py) {
// todo: make display show other interfaces
if (radio_online) {
#if DISPLAY == OLED
if (interface_page == radio->getIndex()) {
if (online_interface_list[interface_page] == radio->getIndex()) {
stat_area.drawBitmap(px - 2, py - 2, bm_dot_sqr, 18, 18, GxEPD_WHITE, GxEPD_BLACK);
// redraw stat area on next refresh
@ -381,7 +385,7 @@ void draw_lora_icon(RadioInterface* radio, int px, int py) {
stat_area.drawBitmap(px, py, bm_rf+0*32, 16, 16, GxEPD_WHITE, GxEPD_BLACK);
}
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
if (interface_page == radio->getIndex()) {
if (online_interface_list[interface_page] == radio->getIndex()) {
stat_area.drawBitmap(px - 2, py - 2, bm_dot_sqr, 34, 36, GxEPD_WHITE, GxEPD_BLACK);
// redraw stat area on next refresh
@ -666,19 +670,38 @@ void draw_stat_area() {
}
if (millis()-last_interface_page_flip >= page_interval) {
int online_interfaces = 0;
int online_interfaces_check = 0;
// todo, is there a more efficient way of doing this?
for (int i = 0; i < INTERFACE_COUNT; i++) {
if (interface_obj[i]->getRadioOnline()) {
online_interfaces++;
online_interfaces_check++;
}
}
if (online_interfaces != online_interfaces_check) {
online_interfaces = online_interfaces_check;
}
// cap at two for now, as only two boxes to symbolise interfaces
// available on display
if (online_interfaces > 2) {