From 0057e8cb4978b390a0f86c44822a5ac00beb77fc Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Tue, 2 Apr 2019 15:13:25 -0700 Subject: [PATCH] move more things to config --- main/ugv_comms.cc | 6 +++--- main/ugv_config.h | 7 +++++++ main/ugv_display.cc | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/main/ugv_comms.cc b/main/ugv_comms.cc index a3edfc9..3a6adc8 100644 --- a/main/ugv_comms.cc +++ b/main/ugv_comms.cc @@ -61,9 +61,9 @@ void CommsClass::Init() { ESP_LOGI(TAG, "LoRa initialized"); #else e32::Config lora_config; - lora_config.uart_port = UART_NUM_2; - lora_config.uart_rx_pin = 13; - lora_config.uart_tx_pin = 15; + lora_config.uart_port = LORA_UART; + lora_config.uart_rx_pin = LORA_RX; + lora_config.uart_tx_pin = LORA_TX; ret = lora.Init(lora_config); if (ret != ESP_OK) { const char *error_name = esp_err_to_name(ret); diff --git a/main/ugv_config.h b/main/ugv_config.h index 1ebbf44..9f9fe73 100644 --- a/main/ugv_config.h +++ b/main/ugv_config.h @@ -7,7 +7,14 @@ #define LORA_FREQ (433E6) +#define LORA_UART UART_NUM_2 +#define LORA_RX 13 +#define LORA_TX 15 + #define OLED_H 64 #define OLED_W 128 +#define OLED_RESET U8X8_PIN_NONE +#define OLED_CLOCK 4 +#define OLED_DATA 5 #define GPS_UART UART_NUM_1 diff --git a/main/ugv_display.cc b/main/ugv_display.cc index 99d9757..2795fc1 100644 --- a/main/ugv_display.cc +++ b/main/ugv_display.cc @@ -18,7 +18,7 @@ void DisplayClass::Init() { // For Heltec ESP32 LoRa // oled = new U8G2_SSD1306_128X64_NONAME_F_HW_I2C(U8G2_R0, 16, 15, 4); // For wemos Lolin ESP32 - oled = new U8G2_SSD1306_128X64_NONAME_F_HW_I2C(U8G2_R0, U8X8_PIN_NONE, 4, 5); + oled = new U8G2_SSD1306_128X64_NONAME_F_HW_I2C(U8G2_R0, OLED_RESET, OLED_CLOCK, OLED_DATA); oled->initDisplay(); oled->clearDisplay(); oled->setPowerSave(false);