Skip to content

Commit

Permalink
Merge branch 'mega' into feature/DeviceStruct-add-pin1-3-gpio-direction
Browse files Browse the repository at this point in the history
  • Loading branch information
tonhuisman committed Sep 26, 2024
2 parents 09e5b1e + 953afd5 commit 86a54cb
Show file tree
Hide file tree
Showing 93 changed files with 4,217 additions and 2,510 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ src/CustomIR.h
docs/source/Plugin/_plugin_sets_overview.repl
*.PVS-Studio.stacktrace.txt


.platformio/
36 changes: 26 additions & 10 deletions embed_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ rm $outputfile

function minify_html {
file=$1
post_To https://www.toptal.com/developers/html-minifier/raw $file
post_To https://www.toptal.com/developers/html-minifier/api/raw $file
}

function minify_css {
file=$1
post_To https://www.toptal.com/developers/cssminifier/raw $file
post_To https://www.toptal.com/developers/cssminifier/api/raw $file
}

function minify_js {
file=$1
post_To https://www.toptal.com/developers/javascript-minifier/raw $file
post_To https://www.toptal.com/developers/javascript-minifier/api/raw $file
}

function post_To {
Expand All @@ -34,7 +34,7 @@ function post_To {
RESPONSE=/tmp/response.txt
HEADERS=/tmp/headers.txt
curl -X POST -s --data-urlencode "input@$file" $url -D $HEADERS -o $RESPONSE
status=$(cat $HEADERS | grep '^HTTP/1' | tail -1 | awk '{print $2}')
status=$(cat $HEADERS | grep '^HTTP/2' | tail -1 | awk '{print $2}')
if [[ "$status" == "200" ]]; then
cat $RESPONSE > /tmp/converter.temp
rm $RESPONSE
Expand All @@ -50,18 +50,34 @@ function minify_svg {
svgo -i /Users/User/Desktop/icons/tools.svg -o - > /tmp/converter.temp
}

function ascii2hexCstyle {
function ascii2hexCstyle { # fold at column 135 so VSCode can 'color-highlight' the array
file_name=$(constFileName $1)
result=$(cat /tmp/converter.temp | hexdump -ve '1/1 "0x%.2x,"')
result=$(echo $result | sed 's/,$//')
echo "static const char DATA_${file_name}[] PROGMEM = {$result,0};"
result=$(echo $result | sed 's/,$//' | fold -w 135)
echo "static const char DATA_${file_name}[] PROGMEM = {"
echo "$result,0"
echo "};"
echo
echo
}

# split text in 132 character chunks, replace \ by \\, replace " by ', replace temp linebreak by real linebreak, wrap in quoted PROGMEM char array
function ascii2stringCstyle {
file_name=$(constFileName $1)
result=$(cat /tmp/converter.temp)
# s/\"/\\\"/g # double-quote " to escaped double-quote \", can use for .js but increases byte count
# s/\"/'"'"'/g # replace double-quote by single-quote, in a single-quoted string, can not be used for js
result=$(echo $result | sed -r 's/(.{132})/\1\x02/g; s/\\/\\\\/g; s/\"/'"'"'/g; s/\x02/\"\n\"/g')
echo "static const char DATA_${file_name}[] PROGMEM = {"
echo "\"$result\""
echo "};"
echo
echo
}

function constFileName {
extension=$(echo $1 | egrep -io "(json|svg|css|js|html)$" | tr "[:lower:]" "[:upper:]")
file=$(echo $1 | sed 's/\.json//' | sed 's/\.svg//' | sed 's/\.css//' | sed 's/\.html//' | sed 's/\.js//' | sed 's/\.\///' | tr '/' '_' | tr '.' '_' | tr '-' '_' | tr "[:lower:]" "[:upper:]")
file=$(echo $1 | sed 's/\.json//; s/\.svg//; s/\.css//; s/\.html//; s/\.js//; s/\.\///' | tr '/' '_' | tr '.' '_' | tr '-' '_' | tr "[:lower:]" "[:upper:]")
underscore="_"
echo $file$underscore$extension
}
Expand Down Expand Up @@ -91,12 +107,12 @@ for file in $file_list; do
elif [[ "$file" == *.min.css ]]; then
echo " CSS already minified"
cat $file > /tmp/converter.temp
ascii2hexCstyle $file >> $outputfile
ascii2stringCstyle $file >> $outputfile
elif [[ "$file" == *.css ]]; then
echo " CSS minify"
minify_css $file
keepMinifiedFile $file
ascii2hexCstyle $file >> $outputfile
ascii2stringCstyle $file >> $outputfile
elif [[ "$file" == *.html ]]; then
echo " HTML minify"
minify_html $file
Expand Down
2 changes: 1 addition & 1 deletion lib/Blynk/src/BlynkParticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class BlynkTransportParticle
return client.write((const uint8_t*)buf, len);
}

void flush() { client.flush(); }
void flush() { client.PR_9453_FLUSH_TO_CLEAR(); }
bool connected() { return client.connected(); }
int available() { return client.available(); }

Expand Down
32 changes: 16 additions & 16 deletions lib/ESPEasySerial/ESPEasySerialPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const __FlashStringHelper* ESPEasySerialPort_toString(ESPEasySerialPort port, bo
case ESPEasySerialPort::serial0_swap: return shortName ? F("serial0swap") : F("HW Serial0 swap");
#endif // ifdef ESP8266
case ESPEasySerialPort::serial0: return shortName ? F("serial0") : F("HW Serial0");
#if SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 1
case ESPEasySerialPort::serial1: return shortName ? F("serial1") : F("HW Serial1");
#endif // if SOC_UART_NUM > 1
#if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 2
case ESPEasySerialPort::serial2: return shortName ? F("serial2") : F("HW Serial2");
#endif // if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 2
#if USES_SW_SERIAL
case ESPEasySerialPort::software: return shortName ? F("serialsw") : F("SW Serial");
#endif // if USES_SW_SERIAL
Expand All @@ -43,12 +43,12 @@ bool isHWserial(ESPEasySerialPort port)
case ESPEasySerialPort::serial0_swap:
#endif // ifdef ESP8266
case ESPEasySerialPort::serial0:
#if SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 1
case ESPEasySerialPort::serial1:
#endif // if SOC_UART_NUM > 1
#if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 2
case ESPEasySerialPort::serial2:
#endif // if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 2
return true;
default:
break;
Expand All @@ -63,12 +63,12 @@ bool useGPIOpins(ESPEasySerialPort port)
#ifdef ESP8266
case ESPEasySerialPort::serial0_swap:
#endif // ifdef ESP8266
#if SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 1
case ESPEasySerialPort::serial1:
#endif // if SOC_UART_NUM > 1
#if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 2
case ESPEasySerialPort::serial2:
#endif // if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 2
#if USES_SW_SERIAL
case ESPEasySerialPort::software:
#endif // if USES_SW_SERIAL
Expand All @@ -90,12 +90,12 @@ bool validSerialPort(ESPEasySerialPort port)
#ifdef ESP8266
case ESPEasySerialPort::serial0_swap:
#endif // ifdef ESP8266
#if SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 1
case ESPEasySerialPort::serial1:
#endif // if SOC_UART_NUM > 1
#if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 2
case ESPEasySerialPort::serial2:
#endif // if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 2
#if USES_SW_SERIAL
case ESPEasySerialPort::software:
#endif // if USES_SW_SERIAL
Expand Down
8 changes: 4 additions & 4 deletions lib/ESPEasySerial/ESPEasySerialPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ enum class ESPEasySerialPort : uint8_t {
#ifdef ESP8266
serial0_swap = 3,
#endif // ifdef ESP8266
#if SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 1
serial1 = 4,
#endif // if SOC_UART_NUM > 1
#if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 2
serial2 = 5,
#endif // if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 2
#if USES_SW_SERIAL
software = 6,
#endif // if USES_SW_SERIAL
Expand Down
16 changes: 8 additions & 8 deletions lib/ESPEasySerial/ESPEasySerialType_ESP32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ bool ESPeasySerialType::getSerialTypePins(ESPEasySerialPort serType, int& rxPin,

switch (serType) {
case ESPEasySerialPort::serial0: rxPin = SOC_RX0; txPin = SOC_TX0; return true;
# if SOC_UART_NUM > 1
# if USABLE_SOC_UART_NUM > 1
case ESPEasySerialPort::serial1: rxPin = SOC_RX1; txPin = SOC_TX1; return true;
# endif // if SOC_UART_NUM > 1
# if SOC_UART_NUM > 2
# endif // if USABLE_SOC_UART_NUM > 1
# if USABLE_SOC_UART_NUM > 2
case ESPEasySerialPort::serial2: rxPin = SOC_RX2; txPin = SOC_TX2; return true;
# endif // if SOC_UART_NUM > 2
# endif // if USABLE_SOC_UART_NUM > 2
# if USES_I2C_SC16IS752
case ESPEasySerialPort::sc16is752: return true;
# endif // if USES_I2C_SC16IS752
Expand All @@ -37,18 +37,18 @@ ESPEasySerialPort ESPeasySerialType::getSerialType(ESPEasySerialPort typeHint, i

// Serial1 on ESP32 uses default pins connected to flash
// So must make sure to set them to other pins.
# if SOC_UART_NUM > 1
# if USABLE_SOC_UART_NUM > 1

if ((receivePin == SOC_RX1) && (transmitPin == SOC_TX1)) {
return ESPEasySerialPort::serial1; // UART1
}
# endif // if SOC_UART_NUM > 1
# if SOC_UART_NUM > 2
# endif // if USABLE_SOC_UART_NUM > 1
# if USABLE_SOC_UART_NUM > 2

if ((receivePin == SOC_RX2) && (transmitPin == SOC_TX2)) {
return ESPEasySerialPort::serial2; // UART2
}
# endif // if SOC_UART_NUM > 2
# endif // if USABLE_SOC_UART_NUM > 2
# if USES_I2C_SC16IS752

if ((receivePin >= 0x48) && (receivePin <= 0x57)) {
Expand Down
16 changes: 16 additions & 0 deletions lib/ESPEasySerial/ESPEasySerial_common_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ static_assert(false, "Implement processor architecture");
# endif // ifdef ESP8266
#endif // ifndef SOC_UART_NUM

#ifndef USABLE_SOC_UART_NUM
# ifdef SOC_UART_HP_NUM

// In ESP-IDF 5.3 the actual difference in high-power and low-power UART ports was defined.
# define USABLE_SOC_UART_NUM SOC_UART_HP_NUM
# else // ifdef SOC_UART_HP_NUM
# ifdef ESP32C6

// ESP32-C6 has 3 UARTs (2 HP UART, and 1 LP UART)
// We can only use the high-power ones
# define USABLE_SOC_UART_NUM 2
# else // ifdef ESP32C6
# define USABLE_SOC_UART_NUM SOC_UART_NUM
# endif // ifdef ESP32C6
# endif // ifdef SOC_UART_HP_NUM
#endif // ifndef USABLE_SOC_UART_NUM

#ifdef ESP32

Expand Down
17 changes: 9 additions & 8 deletions lib/ESPEasySerial/Port_ESPEasySerial_HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <hal/uart_types.h>
#endif


Port_ESPEasySerial_HardwareSerial_t::Port_ESPEasySerial_HardwareSerial_t() {}

Port_ESPEasySerial_HardwareSerial_t::~Port_ESPEasySerial_HardwareSerial_t() {}
Expand All @@ -33,12 +34,12 @@ void Port_ESPEasySerial_HardwareSerial_t::resetConfig(const ESPEasySerialConfig&

switch (config.port) {
case ESPEasySerialPort::serial0:
#if SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 1
case ESPEasySerialPort::serial1:
#endif // if SOC_UART_NUM > 1
#if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 2
case ESPEasySerialPort::serial2:
#endif // if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 2
_config.port = config.port;
break;
default:
Expand All @@ -55,14 +56,14 @@ void Port_ESPEasySerial_HardwareSerial_t::resetConfig(const ESPEasySerialConfig&
} else if (_config.port == ESPEasySerialPort::serial0_swap) {
_serial = &Serial;
#endif // ifdef ESP8266
#if SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 1
} else if (_config.port == ESPEasySerialPort::serial1) {
_serial = &Serial1;
#endif // if SOC_UART_NUM > 1
#if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 1
#if USABLE_SOC_UART_NUM > 2
} else if (_config.port == ESPEasySerialPort::serial2) {
_serial = &Serial2;
#endif // if SOC_UART_NUM > 2
#endif // if USABLE_SOC_UART_NUM > 2
} else {
_config.port = ESPEasySerialPort::not_set;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/HeatpumpIR/DaikinHeatpumpARC480A14IR.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class DaikinHeatpumpARC480A14IR : public HeatpumpIR
{
public:
DaikinHeatpumpARC480A14IR();
void send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd);
using HeatpumpIR::send;
void send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd) override;
void send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd, uint8_t comfortMode, uint8_t econo, uint8_t sensor, uint8_t quiet, uint8_t powerful);
private:
void sendDaikin(IRSender& IR, uint8_t operatingMode, uint8_t fanSpeed, uint8_t temperature, uint8_t swingV, uint8_t swingH, uint8_t comfortMode, uint8_t econo, uint8_t sensor, uint8_t quiet, uint8_t powerful);
Expand Down
Loading

0 comments on commit 86a54cb

Please sign in to comment.