kopia lustrzana https://github.com/pjalocha/esp32-ogn-tracker
Minor fixes
rodzic
0878e8378d
commit
6fe9318d78
|
@ -339,17 +339,20 @@ void OLED_DrawSystem(u8g2_t *OLED)
|
||||||
Len=0;
|
Len=0;
|
||||||
#ifdef WITH_BMP180
|
#ifdef WITH_BMP180
|
||||||
Len+=Format_String(Line+Len, "BMP180 0x");
|
Len+=Format_String(Line+Len, "BMP180 0x");
|
||||||
|
Len+=Format_Hex(Line+Len, Baro.ADDR);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_BMP280
|
#ifdef WITH_BMP280
|
||||||
Len+=Format_String(Line+Len, "BMP280 0x");
|
Len+=Format_String(Line+Len, "BMP280 0x");
|
||||||
|
Len+=Format_Hex(Line+Len, Baro.ADDR);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_BME280
|
#ifdef WITH_BME280
|
||||||
Len+=Format_String(Line+Len, "BME280 0x");
|
Len+=Format_String(Line+Len, "BME280 0x");
|
||||||
|
Len+=Format_Hex(Line+Len, Baro.ADDR);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_MS5607
|
#ifdef WITH_MS5607
|
||||||
Len+=Format_String(Line+Len, "MS5607 0x");
|
Len+=Format_String(Line+Len, "MS5607 0x");
|
||||||
#endif
|
|
||||||
Len+=Format_Hex(Line+Len, Baro.ADDR);
|
Len+=Format_Hex(Line+Len, Baro.ADDR);
|
||||||
|
#endif
|
||||||
Line[Len]=0;
|
Line[Len]=0;
|
||||||
u8g2_DrawStr(OLED, 0, 36, Line);
|
u8g2_DrawStr(OLED, 0, 36, Line);
|
||||||
|
|
||||||
|
@ -571,7 +574,7 @@ void vTaskCTRL(void* pvParameters)
|
||||||
|
|
||||||
LED_TimerCheck(1); // update the LED flashes
|
LED_TimerCheck(1); // update the LED flashes
|
||||||
#ifdef WITH_BEEPER
|
#ifdef WITH_BEEPER
|
||||||
Play_TimerCheck(1); // read the button(s)
|
Play_TimerCheck(); // update the LED flashes
|
||||||
#endif
|
#endif
|
||||||
bool PageChange=0;
|
bool PageChange=0;
|
||||||
int32_t PressRelease=Button_TimerCheck();
|
int32_t PressRelease=Button_TimerCheck();
|
||||||
|
|
17
main/hal.cpp
17
main/hal.cpp
|
@ -186,6 +186,7 @@ GPIO HELTEC TTGO JACEK T-Beam FollowMe Restrictions
|
||||||
#define PIN_LED_TX GPIO_NUM_15
|
#define PIN_LED_TX GPIO_NUM_15
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// #define PIN_LED_TX GPIO_NUM_??
|
||||||
// #define PIN_LED_RX GPIO_NUM_??
|
// #define PIN_LED_RX GPIO_NUM_??
|
||||||
|
|
||||||
#if defined(WITH_HELTEC) || defined(WITH_TTGO)
|
#if defined(WITH_HELTEC) || defined(WITH_TTGO)
|
||||||
|
@ -258,13 +259,13 @@ GPIO HELTEC TTGO JACEK T-Beam FollowMe Restrictions
|
||||||
#define PIN_I2C_SDA GPIO_NUM_4 // SDA pin
|
#define PIN_I2C_SDA GPIO_NUM_4 // SDA pin
|
||||||
#define OLED_I2C_ADDR 0x3C // I2C address of the OLED display
|
#define OLED_I2C_ADDR 0x3C // I2C address of the OLED display
|
||||||
#define PIN_OLED_RST GPIO_NUM_16 // OLED RESET: low-active
|
#define PIN_OLED_RST GPIO_NUM_16 // OLED RESET: low-active
|
||||||
#endif
|
#endif // HELTEC || TTGO
|
||||||
|
|
||||||
#ifdef WITH_TBEAM // T-Beam
|
#ifdef WITH_TBEAM // T-Beam
|
||||||
#define PIN_I2C_SCL GPIO_NUM_22 // SCL pin => this way the pin pattern fits the BMP280 module
|
#define PIN_I2C_SCL GPIO_NUM_22 // SCL pin => this way the pin pattern fits the BMP280 module
|
||||||
#define PIN_I2C_SDA GPIO_NUM_21 // SDA pin
|
#define PIN_I2C_SDA GPIO_NUM_21 // SDA pin
|
||||||
#define OLED_I2C_ADDR 0x3C // I2C address of the OLED display
|
#define OLED_I2C_ADDR 0x3C // I2C address of the OLED display
|
||||||
#endif
|
#endif // TBEAM
|
||||||
|
|
||||||
#ifdef WITH_FollowMe //
|
#ifdef WITH_FollowMe //
|
||||||
#define PIN_I2C_SCL GPIO_NUM_22 // SCL pin
|
#define PIN_I2C_SCL GPIO_NUM_22 // SCL pin
|
||||||
|
@ -277,21 +278,23 @@ uint8_t BARO_I2C = (uint8_t)I2C_BUS;
|
||||||
|
|
||||||
#ifdef WITH_TBEAM
|
#ifdef WITH_TBEAM
|
||||||
#define PIN_BEEPER GPIO_NUM_4
|
#define PIN_BEEPER GPIO_NUM_4
|
||||||
#endif
|
#endif // TBEAM
|
||||||
|
|
||||||
#if defined(WITH_HELTEC) || defined(WITH_TTGO)
|
#if defined(WITH_HELTEC) || defined(WITH_TTGO)
|
||||||
#define PIN_BEEPER GPIO_NUM_17
|
#define PIN_BEEPER GPIO_NUM_17
|
||||||
#endif
|
#endif // HELTEC || TTGO
|
||||||
|
|
||||||
#if !defined(WITH_OLED) && !defined(WITH_U8G2) && !defined(WITH_BMP180) && !defined(WITH_BMP280) && !defined(WITH_BME280)
|
#if !defined(WITH_OLED) && !defined(WITH_U8G2) && !defined(WITH_BMP180) && !defined(WITH_BMP280) && !defined(WITH_BME280)
|
||||||
#undef PIN_I2C_SCL
|
#undef PIN_I2C_SCL
|
||||||
#undef PIN_I2C_SDA
|
#undef PIN_I2C_SDA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_FollowMe
|
||||||
#define PIN_SD_MISO GPIO_NUM_12 // SD card in simple SPI mode, using HSPI IOMUX pins
|
#define PIN_SD_MISO GPIO_NUM_12 // SD card in simple SPI mode, using HSPI IOMUX pins
|
||||||
#define PIN_SD_MOSI GPIO_NUM_13
|
#define PIN_SD_MOSI GPIO_NUM_13
|
||||||
#define PIN_SD_SCK GPIO_NUM_14
|
#define PIN_SD_SCK GPIO_NUM_14
|
||||||
#define PIN_SD_CS GPIO_NUM_15
|
#define PIN_SD_CS GPIO_NUM_15
|
||||||
|
#endif // FollowMe
|
||||||
|
|
||||||
#ifdef WITH_FollowMe
|
#ifdef WITH_FollowMe
|
||||||
#define PIN_BUTTON GPIO_NUM_39
|
#define PIN_BUTTON GPIO_NUM_39
|
||||||
|
@ -640,7 +643,7 @@ void RFM_TransferBlock(uint8_t *Data, uint8_t Len)
|
||||||
Trans.tx_buffer = Data;
|
Trans.tx_buffer = Data;
|
||||||
Trans.rx_buffer = Data;
|
Trans.rx_buffer = Data;
|
||||||
Trans.length = 8*Len;
|
Trans.length = 8*Len;
|
||||||
esp_err_t ret = spi_device_transmit(RFM_SPI, &Trans); }
|
esp_err_t ret = spi_device_polling_transmit(RFM_SPI, &Trans); }
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------
|
||||||
// BEEPER
|
// BEEPER
|
||||||
|
@ -1213,7 +1216,8 @@ void IO_Configuration(void)
|
||||||
quadwp_io_num : -1,
|
quadwp_io_num : -1,
|
||||||
quadhd_io_num : -1,
|
quadhd_io_num : -1,
|
||||||
max_transfer_sz : 64,
|
max_transfer_sz : 64,
|
||||||
flags : SPICOMMON_BUSFLAG_MASTER | SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_MISO | SPICOMMON_BUSFLAG_MOSI
|
flags : SPICOMMON_BUSFLAG_MASTER | SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_MISO | SPICOMMON_BUSFLAG_MOSI,
|
||||||
|
intr_flags : 0 // ESP_INTR_FLAG_SHARED ESP_INTR_FLAG_INTRDISABLED
|
||||||
};
|
};
|
||||||
spi_device_interface_config_t DevCfg =
|
spi_device_interface_config_t DevCfg =
|
||||||
{ command_bits : 0,
|
{ command_bits : 0,
|
||||||
|
@ -1238,6 +1242,7 @@ void IO_Configuration(void)
|
||||||
gpio_set_direction(PIN_PERIPH_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(PIN_PERIPH_RST, GPIO_MODE_OUTPUT);
|
||||||
gpio_set_level(PIN_PERIPH_RST, 1);
|
gpio_set_level(PIN_PERIPH_RST, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PIN_GPS_PPS
|
#ifdef PIN_GPS_PPS
|
||||||
gpio_set_direction(PIN_GPS_PPS, GPIO_MODE_INPUT);
|
gpio_set_direction(PIN_GPS_PPS, GPIO_MODE_INPUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
26
main/rf.cpp
26
main/rf.cpp
|
@ -65,6 +65,9 @@ static void SetRxChannel(uint8_t RxChan=RX_Channel)
|
||||||
|
|
||||||
static uint8_t ReceivePacket(void) // see if a packet has arrived
|
static uint8_t ReceivePacket(void) // see if a packet has arrived
|
||||||
{ if(!TRX.DIO0_isOn()) return 0; // DIO0 line HIGH signals a new packet has arrived
|
{ if(!TRX.DIO0_isOn()) return 0; // DIO0 line HIGH signals a new packet has arrived
|
||||||
|
#ifdef WITH_LED_RX
|
||||||
|
LED_RX_Flash(20);
|
||||||
|
#endif
|
||||||
uint8_t RxRSSI = TRX.ReadRSSI(); // signal strength for the received packet
|
uint8_t RxRSSI = TRX.ReadRSSI(); // signal strength for the received packet
|
||||||
RX_Random = (RX_Random<<1) | (RxRSSI&1); // use the lowest bit to add entropy
|
RX_Random = (RX_Random<<1) | (RxRSSI&1); // use the lowest bit to add entropy
|
||||||
|
|
||||||
|
@ -108,6 +111,9 @@ static uint8_t Transmit(uint8_t TxChan, const uint8_t *PacketByte, uint8_t Thres
|
||||||
if(RxRSSI>=Thresh) break; }
|
if(RxRSSI>=Thresh) break; }
|
||||||
if(MaxWait==0) return 0; }
|
if(MaxWait==0) return 0; }
|
||||||
|
|
||||||
|
#ifdef WITH_LED_TX
|
||||||
|
LED_TX_Flash(20);
|
||||||
|
#endif
|
||||||
TRX.WriteMode(RF_OPMODE_STANDBY); // switch to standby
|
TRX.WriteMode(RF_OPMODE_STANDBY); // switch to standby
|
||||||
// vTaskPrioritySet(0, tskIDLE_PRIORITY+2);
|
// vTaskPrioritySet(0, tskIDLE_PRIORITY+2);
|
||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
|
@ -144,7 +150,7 @@ static void TimeSlot(uint8_t TxChan, uint32_t SlotLen, const uint8_t *PacketByte
|
||||||
ReceiveUntil(End); // listen till the end of the time-slot
|
ReceiveUntil(End); // listen till the end of the time-slot
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetFreqPlan(void)
|
static void SetFreqPlan(void) // set the RF TRX according to the selected frequency hopping plan
|
||||||
{ TRX.setBaseFrequency(RF_FreqPlan.BaseFreq); // set the base frequency (recalculate to RFM69 internal synth. units)
|
{ TRX.setBaseFrequency(RF_FreqPlan.BaseFreq); // set the base frequency (recalculate to RFM69 internal synth. units)
|
||||||
TRX.setChannelSpacing(RF_FreqPlan.ChanSepar); // set the channel separation
|
TRX.setChannelSpacing(RF_FreqPlan.ChanSepar); // set the channel separation
|
||||||
TRX.setFrequencyCorrection(Parameters.RFchipFreqCorr); // set the fine correction (to counter the Xtal error)
|
TRX.setFrequencyCorrection(Parameters.RFchipFreqCorr); // set the fine correction (to counter the Xtal error)
|
||||||
|
@ -155,10 +161,24 @@ static uint8_t StartRFchip(void)
|
||||||
vTaskDelay(10); // wait 10ms
|
vTaskDelay(10); // wait 10ms
|
||||||
TRX.RESET(0); // RESET released
|
TRX.RESET(0); // RESET released
|
||||||
vTaskDelay(10); // wait 10ms
|
vTaskDelay(10); // wait 10ms
|
||||||
SetFreqPlan(); // set TRX base frequency and channel separation after the frequency hopp$
|
SetFreqPlan(); // set TRX base frequency and channel separation after the frequency hopping plan
|
||||||
TRX.Configure(0, OGN_SYNC); // setup RF chip parameters and set to channel #0
|
TRX.Configure(0, OGN_SYNC); // setup RF chip parameters and set to channel #0
|
||||||
TRX.WriteMode(RF_OPMODE_STANDBY); // set RF chip mode to STANDBY
|
TRX.WriteMode(RF_OPMODE_STANDBY); // set RF chip mode to STANDBY
|
||||||
return TRX.ReadVersion(); } // read the RF chip version and return it
|
uint8_t Version = TRX.ReadVersion();
|
||||||
|
#ifdef DEBUG_PRINT
|
||||||
|
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
||||||
|
Format_String(CONS_UART_Write, "StartRFchip() v");
|
||||||
|
Format_Hex(CONS_UART_Write, Version);
|
||||||
|
CONS_UART_Write(' ');
|
||||||
|
Format_UnsDec(CONS_UART_Write, RF_FreqPlan.BaseFreq, 4, 3);
|
||||||
|
CONS_UART_Write('+');
|
||||||
|
Format_UnsDec(CONS_UART_Write, (uint16_t)RF_FreqPlan.Channels, 2);
|
||||||
|
CONS_UART_Write('x');
|
||||||
|
Format_UnsDec(CONS_UART_Write, RF_FreqPlan.ChanSepar, 4, 3);
|
||||||
|
Format_String(CONS_UART_Write, "kHz\n");
|
||||||
|
xSemaphoreGive(CONS_Mutex);
|
||||||
|
#endif
|
||||||
|
return Version; } // read the RF chip version and return it
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
void vTaskRF(void* pvParameters)
|
void vTaskRF(void* pvParameters)
|
||||||
|
|
Ładowanie…
Reference in New Issue