]> git.tnoah.ca Git - lora-radio.git/commitdiff
Add support for LoRa32 v2.0
authorMark Qvist <mark@unsigned.io>
Mon, 24 Jan 2022 19:33:58 +0000 (20:33 +0100)
committerMark Qvist <mark@unsigned.io>
Mon, 24 Jan 2022 19:33:58 +0000 (20:33 +0100)
Config.h
Makefile
Utilities.h

index 72cc480e9d9b62ea2fa49930296a9f86825a9751..21649b9511560e01cd75ece05a050ab265a60091 100644 (file)
--- a/Config.h
+++ b/Config.h
                        const int pin_reset = 12;
                        const int pin_dio = 26;
                        #if defined(EXTERNAL_LEDS)
-                               const int pin_led_rx = 15;
-                               const int pin_led_tx = 4;
+                               const int pin_led_rx = 2;
+                               const int pin_led_tx = 0;
                        #else
-                               const int pin_led_rx = 23;
-                               const int pin_led_tx = 23;
+                               const int pin_led_rx = 22;
+                               const int pin_led_tx = 22;
                        #endif
                #elif BOARD_MODEL == BOARD_LORA32_V2_1
                        const int pin_cs = 18;
index a874d62f1ebf13f77a030bc2f27ac65e96bc240b..25ccaccf198900481d588ee89798c05f795557e9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -48,7 +48,7 @@ upload-tbeam:
        arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:t-beam
 
 upload-lora32_v20:
-       arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:ttgo-lora32
+       arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:ttgo-lora32
 
 upload-lora32_v21:
        arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:ttgo-lora32
index 5a8a7b1016d51a6dd3abe6e547ce96e9b1e891d1..5b593643022b1392f2f96c3de5db86bd3f349161 100644 (file)
@@ -42,10 +42,17 @@ uint8_t boot_vector = 0x00;
                void led_tx_on()  { digitalWrite(pin_led_tx, LOW); }
                void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
        #elif BOARD_MODEL == BOARD_LORA32_V2_0
-               void led_rx_on()  { digitalWrite(pin_led_rx, HIGH); }
-               void led_rx_off() {     digitalWrite(pin_led_rx, LOW); }
-               void led_tx_on()  { digitalWrite(pin_led_tx, HIGH); }
-               void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
+               #if defined(EXTERNAL_LEDS)
+                       void led_rx_on()  { digitalWrite(pin_led_rx, HIGH); }
+                       void led_rx_off() {     digitalWrite(pin_led_rx, LOW); }
+                       void led_tx_on()  { digitalWrite(pin_led_tx, HIGH); }
+                       void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
+               #else
+                       void led_rx_on()  { digitalWrite(pin_led_rx, LOW); }
+                       void led_rx_off() {     digitalWrite(pin_led_rx, HIGH); }
+                       void led_tx_on()  { digitalWrite(pin_led_tx, LOW); }
+                       void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
+               #endif
        #elif BOARD_MODEL == BOARD_LORA32_V2_1
                void led_rx_on()  { digitalWrite(pin_led_rx, HIGH); }
                void led_rx_off() {     digitalWrite(pin_led_rx, LOW); }
@@ -143,6 +150,19 @@ void led_indicate_warning(int cycles) {
                  }
                  led_rx_off();
                }
+       #elif BOARD_MODEL == BOARD_LORA32_V2_0
+               void led_indicate_info(int cycles) {
+                       bool forever = (cycles == 0) ? true : false;
+                       cycles = forever ? 1 : cycles;
+                       while(cycles > 0) {
+                   led_rx_off();
+                   delay(100);
+                   led_rx_on();
+                   delay(100);
+                   if (!forever) cycles--;
+                 }
+                 led_rx_off();
+               }
        #else
                void led_indicate_info(int cycles) {
                        bool forever = (cycles == 0) ? true : false;
@@ -214,10 +234,13 @@ int8_t  led_standby_direction = 0;
                                #if defined(EXTERNAL_LEDS)
                                        led_rx_off();
                                #endif
+                       #elif BOARD_MODEL == BOARD_LORA32_V2_0
+                               #if defined(EXTERNAL_LEDS)
+                                       led_rx_off();
+                               #endif
                        #else
                                led_rx_off();
                        #endif
-
                }
        }
 #endif
@@ -253,7 +276,17 @@ int8_t  led_standby_direction = 0;
                        } else {
                                led_tx_off();
                        }
-                       led_rx_off();
+                       #if BOARD_MODEL == BOARD_LORA32_V2_1
+                               #if defined(EXTERNAL_LEDS)
+                                       led_rx_off();
+                               #endif
+                       #elif BOARD_MODEL == BOARD_LORA32_V2_0
+                               #if defined(EXTERNAL_LEDS)
+                                       led_rx_off();
+                               #endif
+                       #else
+                               led_rx_off();
+                       #endif
                }
        }
 #endif