Skip to content

Commit

Permalink
Merge pull request #519 from MartinMueller2003/main
Browse files Browse the repository at this point in the history
Fixed configuration failures on platforms that do not have SD defined.
  • Loading branch information
forkineye committed Apr 22, 2022
2 parents fe2ef58 + 7c5f8c8 commit 52a07ae
Show file tree
Hide file tree
Showing 14 changed files with 222 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yaml
Expand Up @@ -58,6 +58,12 @@ jobs:
# mh et esp32 mini kit
- target: "d1_mini_mhetesp32minikit"
chip: "esp32"
# Twilight Lord
- target: "d1_mini_twilightlord"
chip: "esp32"
# Twilight Lord ETH
- target: "d1_mini_twilightlord_eth"
chip: "esp32"

runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 0 additions & 4 deletions ESPixelStick/src/FileMgr.cpp
Expand Up @@ -90,12 +90,10 @@ bool c_FileMgr::SetConfig (JsonObject & json)
{
JsonObject JsonDeviceConfig = json[CN_device];

#if defined (SUPPORT_SD) || defined(SUPPORT_SD_MMC)
ConfigChanged |= setFromJSON (miso_pin, JsonDeviceConfig, CN_miso_pin);
ConfigChanged |= setFromJSON (mosi_pin, JsonDeviceConfig, CN_mosi_pin);
ConfigChanged |= setFromJSON (clk_pin, JsonDeviceConfig, CN_clock_pin);
ConfigChanged |= setFromJSON (cs_pin, JsonDeviceConfig, CN_cs_pin);
#endif // defined (SUPPORT_SD) || defined(SUPPORT_SD_MMC)
}
else
{
Expand All @@ -120,12 +118,10 @@ void c_FileMgr::GetConfig (JsonObject& json)
{
// DEBUG_START;

#if defined (SUPPORT_SD) || defined(SUPPORT_SD_MMC)
json[CN_miso_pin] = miso_pin;
json[CN_mosi_pin] = mosi_pin;
json[CN_clock_pin] = clk_pin;
json[CN_cs_pin] = cs_pin;
#endif // defined (SUPPORT_SD) || defined(SUPPORT_SD_MMC)

// DEBUG_END;

Expand Down
2 changes: 0 additions & 2 deletions ESPixelStick/src/FileMgr.hpp
Expand Up @@ -109,12 +109,10 @@ class c_FileMgr
void printDirectory (File dir, int numTabs);

bool SdCardInstalled = false;
#if defined (SUPPORT_SD) || defined(SUPPORT_SD_MMC)
uint8_t miso_pin = SD_CARD_MISO_PIN;
uint8_t mosi_pin = SD_CARD_MOSI_PIN;
uint8_t clk_pin = SD_CARD_CLK_PIN;
uint8_t cs_pin = SD_CARD_CS_PIN;
#endif // def SUPPORT_SD
FileId fsUploadFile;
String fsUploadFileName;
bool fsUploadFileSavedIsEnabled = false;
Expand Down
6 changes: 5 additions & 1 deletion ESPixelStick/src/GPIO_Defs.hpp
Expand Up @@ -73,7 +73,7 @@ typedef enum
#endif // def ARDUINO_ARCH_ESP8266

// Platform specific GPIO definitions
#if defined (BOARD_ESP32_CAM)
#if defined (BOARD_ESP32_CAM)
# include "platformDefinitions/GPIO_Defs_ESP32_CAM.hpp"
#elif defined (BOARD_ESP32_D1_MINI_ETH)
# include "platformDefinitions/GPIO_Defs_ESP32_D1_MINI_ETH.hpp"
Expand Down Expand Up @@ -101,6 +101,10 @@ typedef enum
# include "platformDefinitions/GPIO_Defs_ESP32_TTGO_T8.hpp"
#elif defined (BOARD_ESP32_WT32ETH01)
# include "platformDefinitions/GPIO_Defs_ESP32_WT32ETH01.hpp"
#elif defined(BOARD_ESP32_TWILIGHTLORD)
# include "platformDefinitions/GPIO_Defs_ESP32_TWILIGHTLORD.hpp"
#elif defined(BOARD_ESP32_TWILIGHTLORD_ETH)
# include "platformDefinitions/GPIO_Defs_ESP32_TWILIGHTLORD_ETH.hpp"
#elif defined (BOARD_ESP01S)
# include "platformDefinitions/GPIO_Defs_ESP8266_ESP01S.hpp"
#elif defined (BOARD_ESPS_V3)
Expand Down
3 changes: 3 additions & 0 deletions ESPixelStick/src/output/OutputCommon.cpp
Expand Up @@ -399,6 +399,7 @@ bool c_OutputCommon::SetConfig (JsonObject & jsonConfig)
bool response = setFromJSON (tempDataPin, jsonConfig, CN_data_pin);

DataPin = gpio_num_t (tempDataPin);
// DEBUG_V(String(" DataPin: ") + String(DataPin));

// DEBUG_END;

Expand All @@ -414,6 +415,8 @@ void c_OutputCommon::GetConfig (JsonObject & jsonConfig)
// enums need to be converted to uints for json
jsonConfig[CN_data_pin] = uint8_t (DataPin);

// DEBUG_V(String(" DataPin: ") + String(DataPin));

// DEBUG_END;
} // GetConfig

Expand Down
7 changes: 6 additions & 1 deletion ESPixelStick/src/output/OutputUart.cpp
Expand Up @@ -212,8 +212,10 @@ void c_OutputUart::GetConfig(JsonObject &jsonConfig)
// DEBUG_START;

// enums need to be converted to uints for json
jsonConfig[CN_data_pin] = uint8_t(OutputUartConfig.DataPin);
// jsonConfig[CN_data_pin] = uint8_t(OutputUartConfig.DataPin);
jsonConfig[CN_baudrate] = OutputUartConfig.Baudrate;
// DEBUG_V(String(" DataPin: ") + String(OutputUartConfig.DataPin));
// DEBUG_V(String("Baudrate: ") + String(OutputUartConfig.Baudrate));

// DEBUG_END;
} // GetConfig
Expand Down Expand Up @@ -538,6 +540,9 @@ bool c_OutputUart::SetConfig(JsonObject &jsonConfig)

OutputUartConfig.DataPin = gpio_num_t(tempDataPin);

// DEBUG_V(String(" DataPin: ") + String(OutputUartConfig.DataPin));
// DEBUG_V(String("Baudrate: ") + String(OutputUartConfig.Baudrate));

StartUart();

// DEBUG_END;
Expand Down
4 changes: 1 addition & 3 deletions ESPixelStick/src/platformDefinitions/GPIO_Defs_ESP32_CAM.hpp
Expand Up @@ -46,9 +46,7 @@
# define SD_CARD_DATA_1 gpio_num_t::GPIO_NUM_4
# define SD_CARD_DATA_2 gpio_num_t::GPIO_NUM_12
# define SD_CARD_DATA_3 gpio_num_t::GPIO_NUM_13
#endif // def SUPPORT_SD_MMC

#ifdef SUPPORT_SD
#else // SUPPORT_SD
# define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_2
# define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_15
# define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14
Expand Down
Expand Up @@ -34,6 +34,13 @@
#define DEFAULT_I2C_SDA gpio_num_t::GPIO_NUM_2
#define DEFAULT_I2C_SCL gpio_num_t::GPIO_NUM_32

// File Manager - Defnitions must be present even if SD is not supported
// #define SUPPORT_SD
#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_12
#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_13
#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14
#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_15

// Output Types
// Not Finished - #define SUPPORT_OutputType_TLS3001
// #define SUPPORT_OutputType_APA102 // SPI
Expand Down
Expand Up @@ -33,9 +33,15 @@
#define DEFAULT_RELAY_GPIO gpio_num_t::GPIO_NUM_15

//I2c over Q3 and Q4 (might require HW pullups to be installed)
#define DEFAULT_I2C_SDA gpio_num_t::GPIO_NUM_2
#define DEFAULT_I2C_SCL gpio_num_t::GPIO_NUM_32
#define DEFAULT_I2C_SDA gpio_num_t::GPIO_NUM_2
#define DEFAULT_I2C_SCL gpio_num_t::GPIO_NUM_32

// File Manager - Defnitions must be present even if SD is not supported
// #define SUPPORT_SD
#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_12
#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_13
#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14
#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_15

// #include <ETH.h>
#include "../network/ETH_m.h"
Expand Down
Expand Up @@ -31,6 +31,14 @@
#define DEFAULT_I2C_SDA gpio_num_t::GPIO_NUM_2
#define DEFAULT_I2C_SCL gpio_num_t::GPIO_NUM_32

// File Manager - Defnitions must be present even if SD is not supported
// #define SUPPORT_SD
#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_12
#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_13
#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14
#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_15


// Output Types
// Not Finished - #define SUPPORT_OutputType_TLS3001
// #define SUPPORT_OutputType_APA102 // SPI
Expand Down
Expand Up @@ -33,6 +33,12 @@
#define DEFAULT_I2C_SDA gpio_num_t::GPIO_NUM_2
#define DEFAULT_I2C_SCL gpio_num_t::GPIO_NUM_32

// File Manager - Defnitions must be present even if SD is not supported
// #define SUPPORT_SD
#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_12
#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_13
#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14
#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_15

// #include <ETH.h>
#include "../network/ETH_m.h"
Expand Down
@@ -0,0 +1,60 @@
#pragma once
/*
* GPIO_Defs_ESP32_TWILIGHTLORD.hpp - Output Management class
*
* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
* Copyright (c) 2021 Shelby Merrick
* http://www.forkineye.com
*
* This program is provided free for you to use in any way that you wish,
* subject to the laws and regulations where you are using it. Due diligence
* is strongly suggested before using this code. Please give credit where due.
*
* The Author makes no warranty of any kind, express or implied, with regard
* to this program or the documentation contained in this document. The
* Author shall not be liable in any event for incidental or consequential
* damages in connection with, or arising out of, the furnishing, performance
* or use of these programs.
*
*/

//Output Manager
#define SUPPORT_UART_OUTPUT
#define DEFAULT_UART_1_GPIO gpio_num_t::GPIO_NUM_2
#define DEFAULT_UART_2_GPIO gpio_num_t::GPIO_NUM_4
#define UART_LAST OutputChannelId_UART_1

#define SUPPORT_RMT_OUTPUT
#define DEFAULT_RMT_0_GPIO gpio_num_t::GPIO_NUM_14
#define DEFAULT_RMT_1_GPIO gpio_num_t::GPIO_NUM_31
#define DEFAULT_RMT_2_GPIO gpio_num_t::GPIO_NUM_32
#define DEFAULT_RMT_3_GPIO gpio_num_t::GPIO_NUM_33
#define DEFAULT_RMT_4_GPIO gpio_num_t::GPIO_NUM_34
#define RMT_LAST OutputChannelId_RMT_5

//I2C
#define DEFAULT_I2C_SDA gpio_num_t::GPIO_NUM_5
#define DEFAULT_I2C_SCL gpio_num_t::GPIO_NUM_6

// File Manager - Defnitions must be present even if SD is not supported
// #define SUPPORT_SD
#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_12
#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_13
#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14
#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_15

// Output Types
// Not Finished - #define SUPPORT_OutputType_TLS3001
// #define SUPPORT_OutputType_APA102 // SPI
#define SUPPORT_OutputType_DMX // UART / RMT
#define SUPPORT_OutputType_GECE // UART / RMT
#define SUPPORT_OutputType_GS8208 // UART / RMT
#define SUPPORT_OutputType_Renard // UART / RMT
#define SUPPORT_OutputType_Serial // UART / RMT
#define SUPPORT_OutputType_TM1814 // UART / RMT
#define SUPPORT_OutputType_UCS1903 // UART / RMT
#define SUPPORT_OutputType_UCS8903 // UART / RMT
// #define SUPPORT_OutputType_WS2801 // SPI
#define SUPPORT_OutputType_WS2811 // UART / RMT
#define SUPPORT_OutputType_Relay // GPIO
#define SUPPORT_OutputType_Servo_PCA9685 // I2C (default pins)
@@ -0,0 +1,97 @@
#pragma once
/*
* GPIO_Defs_ESP32_TWILIGHTLORD_ETH.hpp - Output Management class
*
* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
* Copyright (c) 2021 Shelby Merrick
* http://www.forkineye.com
*
* This program is provided free for you to use in any way that you wish,
* subject to the laws and regulations where you are using it. Due diligence
* is strongly suggested before using this code. Please give credit where due.
*
* The Author makes no warranty of any kind, express or implied, with regard
* to this program or the documentation contained in this document. The
* Author shall not be liable in any event for incidental or consequential
* damages in connection with, or arising out of, the furnishing, performance
* or use of these programs.
*
*/

#define SUPPORT_ETHERNET

//Output Manager
#define SUPPORT_UART_OUTPUT
#define DEFAULT_UART_1_GPIO gpio_num_t::GPIO_NUM_2
#define DEFAULT_UART_2_GPIO gpio_num_t::GPIO_NUM_4
#define UART_LAST OutputChannelId_UART_1

#define SUPPORT_RMT_OUTPUT
#define DEFAULT_RMT_0_GPIO gpio_num_t::GPIO_NUM_14
#define DEFAULT_RMT_1_GPIO gpio_num_t::GPIO_NUM_31
#define DEFAULT_RMT_2_GPIO gpio_num_t::GPIO_NUM_32
#define DEFAULT_RMT_3_GPIO gpio_num_t::GPIO_NUM_33
#define DEFAULT_RMT_4_GPIO gpio_num_t::GPIO_NUM_34
#define RMT_LAST OutputChannelId_RMT_5

//Power relay output over Q1 or Q1R
#define DEFAULT_RELAY_GPIO gpio_num_t::GPIO_NUM_15

//I2c over Q3 and Q4 (might require HW pullups to be installed)
#define DEFAULT_I2C_SDA gpio_num_t::GPIO_NUM_2
#define DEFAULT_I2C_SCL gpio_num_t::GPIO_NUM_32

// File Manager - Defnitions must be present even if SD is not supported
// #define SUPPORT_SD
#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_12
#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_13
#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14
#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_15

// #include <ETH.h>
#include "../network/ETH_m.h"

/*
* ETH_CLOCK_GPIO0_IN - default: external clock from crystal oscillator
* ETH_CLOCK_GPIO0_OUT - 50MHz clock from internal APLL output on GPIO0 - possibly an inverter is needed for LAN8720
* ETH_CLOCK_GPIO16_OUT - 50MHz clock from internal APLL output on GPIO16 - possibly an inverter is needed for LAN8720
* ETH_CLOCK_GPIO17_OUT - 50MHz clock from internal APLL inverted output on GPIO17 - tested with LAN8720
*/
#define DEFAULT_ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT

// Pin# of the enable signal for the external crystal oscillator (-1 to disable for internal APLL source)
#define DEFAULT_ETH_POWER_PIN gpio_num_t::GPIO_NUM_5
#define DEFAULT_ETH_POWER_PIN_ACTIVE HIGH

// Type of the Ethernet PHY (LAN8720 or TLK110)
#define DEFAULT_ETH_TYPE ETH_PHY_LAN8720

// I2C-address of Ethernet PHY (0 or 1 for LAN8720, 31 for TLK110)
#define ETH_ADDR_PHY_LAN8720 0
// #define ETH_ADDR_PHY_LAN8720 1
//#define ETH_ADDR_PHY_TLK110 31
#define DEFAULT_ETH_ADDR ETH_ADDR_PHY_LAN8720
#define DEFAULT_ETH_TXEN gpio_num_t::GPIO_NUM_21
#define DEFAULT_ETH_TXD0 gpio_num_t::GPIO_NUM_19
#define DEFAULT_ETH_TXD1 gpio_num_t::GPIO_NUM_22
#define DEFAULT_ETH_CRSDV gpio_num_t::GPIO_NUM_27
#define DEFAULT_ETH_RXD0 gpio_num_t::GPIO_NUM_25
#define DEFAULT_ETH_RXD1 gpio_num_t::GPIO_NUM_26
#define DEFAULT_ETH_MDC_PIN gpio_num_t::GPIO_NUM_23
#define DEFAULT_ETH_MDIO_PIN gpio_num_t::GPIO_NUM_18

// Output Types
// Not Finished - #define SUPPORT_OutputType_TLS3001
// #define SUPPORT_OutputType_APA102 // SPI
#define SUPPORT_OutputType_DMX // UART / RMT
#define SUPPORT_OutputType_GECE // UART
#define SUPPORT_OutputType_GS8208 // UART / RMT
#define SUPPORT_OutputType_Renard // UART / RMT
#define SUPPORT_OutputType_Serial // UART / RMT
#define SUPPORT_OutputType_TM1814 // UART / RMT
#define SUPPORT_OutputType_UCS1903 // UART / RMT
#define SUPPORT_OutputType_UCS8903 // UART / RMT
// #define SUPPORT_OutputType_WS2801 // SPI
#define SUPPORT_OutputType_WS2811 // UART / RMT
#define SUPPORT_OutputType_Relay // GPIO
#define SUPPORT_OutputType_Servo_PCA9685 // I2C (default pins)
16 changes: 15 additions & 1 deletion platformio.ini
Expand Up @@ -4,7 +4,7 @@
; Local configuration should be done in platformio_user.ini

[platformio]
default_envs = espsv3, d1_mini, d32_pro, d32_pro_eth, esp32_cam, esp32_ttgo_t8, d1_mini32, d1_mini32_eth, esp32_wt32eth01, esp32_quinled_quad, esp32_quinled_quad_ae_plus, esp32_quinled_quad_eth, esp32_quinled_uno, esp32_quinled_uno_ae_plus, esp32_quinled_uno_eth, esp01s, d1_mini_mhetesp32minikit
default_envs = espsv3, d1_mini, d32_pro, d32_pro_eth, esp32_cam, esp32_ttgo_t8, d1_mini32, d1_mini32_eth, esp32_wt32eth01, esp32_quinled_quad, esp32_quinled_quad_ae_plus, esp32_quinled_quad_eth, esp32_quinled_uno, esp32_quinled_uno_ae_plus, esp32_quinled_uno_eth, esp01s, d1_mini_mhetesp32minikit, d1_mini_twilightlord, d1_mini_twilightlord_eth
src_dir = ./ESPixelStick
data_dir = ./ESPixelStick/data
build_cache_dir = ~/.buildcache
Expand Down Expand Up @@ -257,3 +257,17 @@ board = mhetesp32minikit
build_flags =
${esp32git.build_flags}
-D BOARD_ESP32_QUINLED_UNO_ETH

[env:d1_mini_twilightlord]
extends = esp32git
board = wemos_d1_mini32
build_flags =
${esp32git.build_flags}
-D BOARD_ESP32_TWILIGHTLORD

[env:d1_mini_twilightlord_eth]
extends = esp32git
board = wemos_d1_mini32
build_flags =
${esp32git.build_flags}
-D BOARD_ESP32_TWILIGHTLORD_ETH

0 comments on commit 52a07ae

Please sign in to comment.