pull/10/head
Pawel Jalocha 2019-06-02 09:01:59 +01:00
rodzic 0878e8378d
commit 6fe9318d78
4 zmienionych plików z 41 dodań i 13 usunięć

Wyświetl plik

@ -339,17 +339,20 @@ void OLED_DrawSystem(u8g2_t *OLED)
Len=0;
#ifdef WITH_BMP180
Len+=Format_String(Line+Len, "BMP180 0x");
Len+=Format_Hex(Line+Len, Baro.ADDR);
#endif
#ifdef WITH_BMP280
Len+=Format_String(Line+Len, "BMP280 0x");
Len+=Format_Hex(Line+Len, Baro.ADDR);
#endif
#ifdef WITH_BME280
Len+=Format_String(Line+Len, "BME280 0x");
Len+=Format_Hex(Line+Len, Baro.ADDR);
#endif
#ifdef WITH_MS5607
Len+=Format_String(Line+Len, "MS5607 0x");
#endif
Len+=Format_Hex(Line+Len, Baro.ADDR);
#endif
Line[Len]=0;
u8g2_DrawStr(OLED, 0, 36, Line);
@ -571,7 +574,7 @@ void vTaskCTRL(void* pvParameters)
LED_TimerCheck(1); // update the LED flashes
#ifdef WITH_BEEPER
Play_TimerCheck(1); // read the button(s)
Play_TimerCheck(); // update the LED flashes
#endif
bool PageChange=0;
int32_t PressRelease=Button_TimerCheck();

Wyświetl plik

@ -186,6 +186,7 @@ GPIO HELTEC TTGO JACEK T-Beam FollowMe Restrictions
#define PIN_LED_TX GPIO_NUM_15
#endif
// #define PIN_LED_TX GPIO_NUM_??
// #define PIN_LED_RX GPIO_NUM_??
#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 OLED_I2C_ADDR 0x3C // I2C address of the OLED display
#define PIN_OLED_RST GPIO_NUM_16 // OLED RESET: low-active
#endif
#endif // HELTEC || TTGO
#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_SDA GPIO_NUM_21 // SDA pin
#define OLED_I2C_ADDR 0x3C // I2C address of the OLED display
#endif
#endif // TBEAM
#ifdef WITH_FollowMe //
#define PIN_I2C_SCL GPIO_NUM_22 // SCL pin
@ -277,21 +278,23 @@ uint8_t BARO_I2C = (uint8_t)I2C_BUS;
#ifdef WITH_TBEAM
#define PIN_BEEPER GPIO_NUM_4
#endif
#endif // TBEAM
#if defined(WITH_HELTEC) || defined(WITH_TTGO)
#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)
#undef PIN_I2C_SCL
#undef PIN_I2C_SDA
#endif
#ifdef WITH_FollowMe
#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_SCK GPIO_NUM_14
#define PIN_SD_CS GPIO_NUM_15
#endif // FollowMe
#ifdef WITH_FollowMe
#define PIN_BUTTON GPIO_NUM_39
@ -640,7 +643,7 @@ void RFM_TransferBlock(uint8_t *Data, uint8_t Len)
Trans.tx_buffer = Data;
Trans.rx_buffer = Data;
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
@ -1213,7 +1216,8 @@ void IO_Configuration(void)
quadwp_io_num : -1,
quadhd_io_num : -1,
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 =
{ command_bits : 0,
@ -1238,6 +1242,7 @@ void IO_Configuration(void)
gpio_set_direction(PIN_PERIPH_RST, GPIO_MODE_OUTPUT);
gpio_set_level(PIN_PERIPH_RST, 1);
#endif
#ifdef PIN_GPS_PPS
gpio_set_direction(PIN_GPS_PPS, GPIO_MODE_INPUT);
#endif

Wyświetl plik

@ -65,6 +65,9 @@ static void SetRxChannel(uint8_t RxChan=RX_Channel)
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
#ifdef WITH_LED_RX
LED_RX_Flash(20);
#endif
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
@ -108,6 +111,9 @@ static uint8_t Transmit(uint8_t TxChan, const uint8_t *PacketByte, uint8_t Thres
if(RxRSSI>=Thresh) break; }
if(MaxWait==0) return 0; }
#ifdef WITH_LED_TX
LED_TX_Flash(20);
#endif
TRX.WriteMode(RF_OPMODE_STANDBY); // switch to standby
// vTaskPrioritySet(0, tskIDLE_PRIORITY+2);
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
}
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.setChannelSpacing(RF_FreqPlan.ChanSepar); // set the channel separation
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
TRX.RESET(0); // RESET released
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.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"
void vTaskRF(void* pvParameters)

Wyświetl plik

@ -16,8 +16,8 @@
extern FIFO<OGN_TxPacket<OGN_Packet>, 4> RF_TxFIFO; // buffer for transmitted packets
extern uint8_t RX_OGN_Packets; // [packets] counts received packets
// extern uint8_t RX_AverRSSI; // [-0.5dBm] average RSSI
// extern int8_t RF_Temp; // [degC] temperature of the RF chip: uncalibrated
// extern uint8_t RX_AverRSSI; // [-0.5dBm] average RSSI
// extern int8_t RF_Temp; // [degC] temperature of the RF chip: uncalibrated
extern RFM_TRX TRX; // RF transceiver
extern FreqPlan RF_FreqPlan; // frequency hopping pattern calculator
extern uint16_t TX_Credit; // counts transmitted packets vs. time to avoid using more than 1% of the time