]> git.tnoah.ca Git - lora-radio.git/commitdiff
RGB led pin remap
authorMark Qvist <mark@unsigned.io>
Mon, 9 Jan 2023 21:27:52 +0000 (22:27 +0100)
committerMark Qvist <mark@unsigned.io>
Mon, 9 Jan 2023 21:27:52 +0000 (22:27 +0100)
Config.h
Console.h
RNode_Firmware.ino

index 23424b438d2f29fe1fc114efb367af8dba9cddec..21b2f6bf7777c347c26c7220f68fdff6d31b98fc 100644 (file)
--- a/Config.h
+++ b/Config.h
                        #define HAS_CONSOLE true
             #define HAS_PMU true
                        #define HAS_NP true
+                       #define HAS_SD true
                        const int pin_cs = 18;
                        const int pin_reset = 23;
                        const int pin_dio = 26;
-                       const int pin_np = 15;
+                       const int pin_np = 12;
+                       const int pin_dac = 25;
+                       const int pin_adc = 34;
+                       const int SD_MISO = 2;
+                       const int SD_MOSI = 15;
+                       const int SD_CLK = 14;
+                       const int SD_CS = 13;
                        #if HAS_NP == false
                                #if defined(EXTERNAL_LEDS)
-                                       const int pin_led_rx = 15;
+                                       const int pin_led_rx = 12;
                                        const int pin_led_tx = 4;
                                #else
                                        const int pin_led_rx = 25;
index 6505cdd3aed1a3da32c564ebad7b47b5de4928c6..1e5f1e87d4f709e3087fbe15dae3ebb989edb558 100644 (file)
--- a/Console.h
+++ b/Console.h
@@ -3,6 +3,14 @@
 #include <WiFi.h>
 #include <WebServer.h>
 
+#include "SD.h"
+#include "SPI.h"
+  
+#if HAS_SD
+  SPIClass *spi = NULL;
+#endif
+
+
 #if CONFIG_IDF_TARGET_ESP32
 #include "esp32/rom/rtc.h"
 #elif CONFIG_IDF_TARGET_ESP32S2
@@ -116,6 +124,32 @@ void console_start() {
     console_dbg("SPIFFS Ready");
   }
 
+  #if HAS_SD
+    spi = new SPIClass(HSPI);
+    spi->begin(SD_CLK, SD_MISO, SD_MOSI, SD_CS);
+    if(!SD.begin(SD_CS, *spi)){
+      console_dbg("No SD card inserted");
+    } else {
+      uint8_t cardType = SD.cardType();
+      if(cardType == CARD_NONE){
+        console_dbg("No SD card type");
+      } else {
+        console_dbg("SD Card Type: ");
+        if(cardType == CARD_MMC){
+          console_dbg("MMC");
+        } else if(cardType == CARD_SD){
+          console_dbg("SDSC");
+        } else if(cardType == CARD_SDHC){
+          console_dbg("SDHC");
+        } else {
+          console_dbg("UNKNOWN");
+        }
+        uint64_t cardSize = SD.cardSize() / (1024 * 1024);
+        Serial.printf("SD Card Size: %lluMB\n", cardSize);
+      }
+    }
+  #endif
+
   console_register_pages();
   server.begin();
   led_indicate_console();
index 51945c458259a8787fa6d3802ee314a289dce097..467b976b34a288c1ea8bb012347501880cabd018 100644 (file)
@@ -989,7 +989,7 @@ void loop() {
       if (console_active) {
         console_loop();
       } else {
-        led_indicate_standby();
+        //led_indicate_standby();
       }
     } else {