Skip to content

Commit df1aa6d

Browse files
authored
Update Irremote lib to latest master commit ca474a6 (#24226)
1 parent a922d66 commit df1aa6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+4057
-2086
lines changed

lib/lib_basic/IRremoteESP8266/IRremoteESP8266/.github/workflows/Build.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
JSONI=${JSONI//$'\n'}
2626
echo $JSONI
2727
# Set output
28-
echo "::set-output name=matrix::[${JSONI}]"
28+
echo "matrix=[${JSONI}]" >> $GITHUB_OUTPUT
2929
Build_Example:
3030
needs: Gen_Matrix
3131
runs-on: ubuntu-latest
@@ -36,30 +36,33 @@ jobs:
3636
steps:
3737
- uses: actions/checkout@v2
3838
- name: Cache pip
39-
uses: actions/cache@v2
39+
uses: actions/cache@v4
4040
with:
4141
path: ~/.cache/pip
4242
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
4343
restore-keys: |
4444
${{ runner.os }}-pip-
4545
- name: Cache PlatformIO
46-
uses: actions/cache@v2
46+
uses: actions/cache@v4
4747
with:
4848
path: ~/.platformio
4949
key: ${{ runner.os }}-${{ hashFiles('**/platformio.ini') }}
5050
- name: Cache PlatformIO build
51-
uses: actions/cache@v2
51+
uses: actions/cache@v4
5252
with:
5353
path: .pio
5454
key: pio-${{ runner.os }}-${{ matrix.project }}
5555
restore-keys: |
5656
pio-${{ runner.os }}-
5757
pio-
5858
- name: Set up Python
59-
uses: actions/setup-python@v2
59+
uses: actions/setup-python@v5
60+
with:
61+
python-version: '3.13'
6062
- name: Install PlatformIO
6163
run: |
6264
python -m pip install --upgrade pip
65+
pip install --upgrade intelhex
6366
pip install --upgrade platformio
6467
- name: Build example
6568
env:

lib/lib_basic/IRremoteESP8266/IRremoteESP8266/.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v2
45+
uses: github/codeql-action/init@v3
4646
with:
4747
languages: ${{ matrix.language }}
4848
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -56,7 +56,7 @@ jobs:
5656
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5757
# If this step fails, then you should remove it and run the build manually (see below)
5858
- name: Autobuild
59-
uses: github/codeql-action/autobuild@v2
59+
uses: github/codeql-action/autobuild@v3
6060

6161
# ℹ️ Command-line programs to run using the OS shell.
6262
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -69,4 +69,4 @@ jobs:
6969
# ./location_of_script_within_repo/buildscript.sh
7070

7171
- name: Perform CodeQL Analysis
72-
uses: github/codeql-action/analyze@v2
72+
uses: github/codeql-action/analyze@v3
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
set noparent
22
root=src
33
linelength=80
4+
filter=-whitespace/indent_namespace

lib/lib_basic/IRremoteESP8266/IRremoteESP8266/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ If you want to [contribute](.github/CONTRIBUTING.md#how-can-i-contribute) to thi
7777
- Improve our documentation
7878
- [Creating issues](.github/CONTRIBUTING.md#reporting-bugs) and [pull requests](.github/CONTRIBUTING.md#pull-requests)
7979
- Tell other people about this library
80+
- Updated documentation formatting and clarified installation steps (Hacktoberfest contribution by Prerna Utage)
81+
8082

8183
## Contributors
8284
Available [here](.github/Contributors.md)
@@ -87,3 +89,6 @@ This library was originally based on Ken Shirriff's work (https://github.com/shi
8789
[Mark Szabo](https://github.com/crankyoldgit/IRremoteESP8266) has updated the IRsend class to work on ESP8266 and [Sebastien Warin](https://github.com/sebastienwarin/IRremoteESP8266) the receiving & decoding part (IRrecv class).
8890

8991
As of v2.0, the library was almost entirely re-written with the ESP8266's resources in mind.
92+
93+
## About This Project
94+
This project allows decoding and encoding of IR signals for controlling Air Conditioners and other devices using ESP8266 or ESP32 boards.

lib/lib_basic/IRremoteESP8266/IRremoteESP8266/examples/IRMQTTServer/IRMQTTServer.ino

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ bool mountSpiffs(void) {
593593
bool saveConfig(void) {
594594
debug("Saving the config.");
595595
bool success = false;
596-
DynamicJsonDocument json(kJsonConfigMaxSize);
596+
JsonDocument json;
597597
#if MQTT_ENABLE
598598
json[kMqttServerKey] = MqttServer;
599599
json[kMqttPortKey] = MqttPort;
@@ -611,6 +611,8 @@ bool saveConfig(void) {
611611
const String key = KEY_TX_GPIO + String(i);
612612
json[key] = static_cast<int>(txGpioTable[i]);
613613
}
614+
if (json.overflowed())
615+
debug("ERROR: no enough memory to store the entire json document");
614616

615617
if (mountSpiffs()) {
616618
File configFile = FILESYSTEM.open(kConfigFile, "w");
@@ -642,7 +644,7 @@ bool loadConfigFile(void) {
642644
std::unique_ptr<char[]> buf(new char[size]);
643645

644646
configFile.readBytes(buf.get(), size);
645-
DynamicJsonDocument json(kJsonConfigMaxSize);
647+
JsonDocument json;
646648
if (!deserializeJson(json, buf.get(), kJsonConfigMaxSize)) {
647649
debug("Json config file parsed ok.");
648650
#if MQTT_ENABLE
@@ -1659,11 +1661,13 @@ bool parseStringAndSendAirCon(IRsend *irsend, const decode_type_t irType,
16591661
stateSize = inputLength / 2; // Every two hex chars is a byte.
16601662
// Use at least the minimum size.
16611663
stateSize = std::max(stateSize,
1662-
(uint16_t) (kFujitsuAcStateLengthShort - 1));
1664+
static_cast<uint16_t>(kFujitsuAcStateLengthShort -
1665+
1));
16631666
// If we think it isn't a "short" message.
16641667
if (stateSize > kFujitsuAcStateLengthShort)
16651668
// Then it has to be at least the smaller version of the "normal" size.
1666-
stateSize = std::max(stateSize, (uint16_t) (kFujitsuAcStateLength - 1));
1669+
stateSize = std::max(stateSize,
1670+
static_cast<uint16_t>(kFujitsuAcStateLength - 1));
16671671
// Lastly, it should never exceed the maximum "normal" size.
16681672
stateSize = std::min(stateSize, kFujitsuAcStateLength);
16691673
break;
@@ -1675,12 +1679,12 @@ bool parseStringAndSendAirCon(IRsend *irsend, const decode_type_t irType,
16751679
stateSize = inputLength / 2; // Every two hex chars is a byte.
16761680
// Use at least the minimum size.
16771681
stateSize = std::max(stateSize,
1678-
(uint16_t) (kHitachiAc3MinStateLength));
1682+
static_cast<uint16_t>(kHitachiAc3MinStateLength));
16791683
// If we think it isn't a "short" message.
16801684
if (stateSize > kHitachiAc3MinStateLength)
16811685
// Then it probably the "normal" size.
16821686
stateSize = std::max(stateSize,
1683-
(uint16_t) (kHitachiAc3StateLength));
1687+
static_cast<uint16_t>(kHitachiAc3StateLength));
16841688
// Lastly, it should never exceed the maximum "normal" size.
16851689
stateSize = std::min(stateSize, kHitachiAc3StateLength);
16861690
break;
@@ -1691,7 +1695,7 @@ bool parseStringAndSendAirCon(IRsend *irsend, const decode_type_t irType,
16911695
// the correct length/byte size.
16921696
stateSize = inputLength / 2; // Every two hex chars is a byte.
16931697
// Use at least the minimum size.
1694-
stateSize = std::max(stateSize, (uint16_t) 3);
1698+
stateSize = std::max(stateSize, static_cast<uint16_t>(3));
16951699
// Cap the maximum size.
16961700
stateSize = std::min(stateSize, kStateSizeMax);
16971701
break;
@@ -1702,12 +1706,13 @@ bool parseStringAndSendAirCon(IRsend *irsend, const decode_type_t irType,
17021706
// the correct length/byte size.
17031707
stateSize = inputLength / 2; // Every two hex chars is a byte.
17041708
// Use at least the minimum size.
1705-
stateSize = std::max(stateSize, (uint16_t) (kSamsungAcStateLength));
1709+
stateSize = std::max(stateSize,
1710+
static_cast<uint16_t>(kSamsungAcStateLength));
17061711
// If we think it isn't a "normal" message.
17071712
if (stateSize > kSamsungAcStateLength)
17081713
// Then it probably the extended size.
1709-
stateSize = std::max(stateSize,
1710-
(uint16_t) (kSamsungAcExtendedStateLength));
1714+
stateSize = std::max(
1715+
stateSize, static_cast<uint16_t>(kSamsungAcExtendedStateLength));
17111716
// Lastly, it should never exceed the maximum "extended" size.
17121717
stateSize = std::min(stateSize, kSamsungAcExtendedStateLength);
17131718
break;
@@ -2671,7 +2676,8 @@ void receivingMQTT(String const topic_name, String const callback_str) {
26712676
switch (ircommand[0]) {
26722677
case kPauseChar:
26732678
{ // It's a pause. Everything after the 'P' should be a number.
2674-
int32_t msecs = std::min((int32_t) strtoul(ircommand + 1, NULL, 10),
2679+
int32_t msecs = std::min(static_cast<int32_t>(strtoul(ircommand + 1,
2680+
NULL, 10)),
26752681
kMaxPauseMs);
26762682
delay(msecs);
26772683
mqtt_client.publish(MqttAck.c_str(),
@@ -3142,7 +3148,7 @@ bool sendFloat(const String topic, const float_t temp, const bool retain) {
31423148
#if MQTT_CLIMATE_JSON
31433149
void sendJsonState(const stdAc::state_t state, const String topic,
31443150
const bool retain, const bool ha_mode) {
3145-
DynamicJsonDocument json(kJsonAcStateMaxSize);
3151+
JsonDocument json;
31463152
json[KEY_PROTOCOL] = typeToString(state.protocol);
31473153
json[KEY_MODEL] = state.model;
31483154
json[KEY_COMMAND] = IRac::commandToString(state.command);
@@ -3168,23 +3174,25 @@ void sendJsonState(const stdAc::state_t state, const String topic,
31683174
json[KEY_CLEAN] = IRac::boolToString(state.clean);
31693175
json[KEY_BEEP] = IRac::boolToString(state.beep);
31703176
json[KEY_SLEEP] = state.sleep;
3177+
if (json.overflowed())
3178+
debug("ERROR: no enough memory to store the entire json document");
31713179

31723180
String payload = "";
31733181
payload.reserve(200);
31743182
serializeJson(json, payload);
31753183
sendString(topic, payload, retain);
31763184
}
31773185

3178-
bool validJsonStr(DynamicJsonDocument doc, const char* key) {
3186+
bool validJsonStr(JsonDocument doc, const char* key) {
31793187
return doc.containsKey(key) && doc[key].is<char*>();
31803188
}
31813189

3182-
bool validJsonInt(DynamicJsonDocument doc, const char* key) {
3190+
bool validJsonInt(JsonDocument doc, const char* key) {
31833191
return doc.containsKey(key) && doc[key].is<signed int>();
31843192
}
31853193

31863194
stdAc::state_t jsonToState(const stdAc::state_t current, const char *str) {
3187-
DynamicJsonDocument json(kJsonAcStateMaxSize);
3195+
JsonDocument json;
31883196
if (deserializeJson(json, str, kJsonAcStateMaxSize)) {
31893197
debug("json MQTT message did not parse. Skipping!");
31903198
return current;

lib/lib_basic/IRremoteESP8266/IRremoteESP8266/examples/IRMQTTServer/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ monitor_speed = 115200
1414
lib_deps_builtin =
1515
lib_deps_external =
1616
PubSubClient@>=2.8.0
17-
ArduinoJson@>=6.0
17+
ArduinoJson@>=7.0
1818
# Uncomment the following to enable SHT-3x support.
1919
# https://github.com/wemos/WEMOS_SHT3x_Arduino_Library.git
2020

lib/lib_basic/IRremoteESP8266/IRremoteESP8266/examples/IRrecvDump/IRrecvDump.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void dump(decode_results *results) {
8787
Serial.print(results->rawbuf[i] * kRawTick, DEC);
8888
} else {
8989
Serial.print(", ");
90-
Serial.print((uint32_t) results->rawbuf[i] * kRawTick, DEC);
90+
Serial.print(static_cast<uint32_t>(results->rawbuf[i] * kRawTick), DEC);
9191
}
9292
}
9393
Serial.println("};");

lib/lib_basic/IRremoteESP8266/IRremoteESP8266/examples/IRrecvDumpV2/IRrecvDumpV2.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ decode_results results; // Somewhere to store the results
130130
void setup() {
131131
#if defined(ESP8266)
132132
Serial.begin(kBaudRate, SERIAL_8N1, SERIAL_TX_ONLY);
133+
#elif ARDUINO_USB_CDC_ON_BOOT
134+
Serial.begin(kBaudRate);
133135
#else // ESP8266
134136
Serial.begin(kBaudRate, SERIAL_8N1);
135137
#endif // ESP8266

lib/lib_basic/IRremoteESP8266/IRremoteESP8266/examples/IRrecvDumpV3/IRrecvDumpV3.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ void setup() {
138138
OTAwifi(); // start default wifi (previously saved on the ESP) for OTA
139139
#if defined(ESP8266)
140140
Serial.begin(kBaudRate, SERIAL_8N1, SERIAL_TX_ONLY);
141+
#elif ARDUINO_USB_CDC_ON_BOOT
142+
Serial.begin(kBaudRate);
141143
#else // ESP8266
142144
Serial.begin(kBaudRate, SERIAL_8N1);
143145
#endif // ESP8266

lib/lib_basic/IRremoteESP8266/IRremoteESP8266/library.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@
4646
],
4747
"exclude": [".github", "extras", "docs", "assets"],
4848
"frameworks": "arduino",
49+
"libCompatMode": "strict",
4950
"platforms": ["espressif8266", "espressif32"]
5051
}

0 commit comments

Comments
 (0)