Skip to content

Commit b6368bd

Browse files
authored
IRMQTTServer: Build a minimal OTA image via PlatformIO. (#1541)
* Allow some flags to be set by compiler flags. * Fix an issue when all protocols are disabled. * Upgrade from deprecated build flag `-Wl,-Teagle.flash.1m64.ld` to `board_build.ldscript` For #1513
1 parent 9a473c9 commit b6368bd

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

examples/IRMQTTServer/IRMQTTServer.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Send & receive arbitrary IR codes via a web server or MQTT.
3-
* Copyright David Conran 2016, 2017, 2018, 2019, 2020
3+
* Copyright David Conran 2016-2021
44
*/
55
#ifndef EXAMPLES_IRMQTTSERVER_IRMQTTSERVER_H_
66
#define EXAMPLES_IRMQTTSERVER_IRMQTTSERVER_H_
@@ -101,8 +101,9 @@ const IPAddress kSubnetMask = IPAddress(255, 255, 255, 0);
101101
// The unset default is 8%.
102102
// (Uncomment to enable)
103103
// Do you want/need mdns enabled? (https://en.wikipedia.org/wiki/Multicast_DNS)
104+
#ifndef MDNS_ENABLE
104105
#define MDNS_ENABLE true // `false` to disable and save ~21k of program space.
105-
106+
#endif // MDNS_ENABLE
106107
// ----------------------- HTTP Related Settings -------------------------------
107108
#define FIRMWARE_OTA true // Allow remote update of the firmware via http.
108109
// Less secure if enabled.
@@ -197,7 +198,9 @@ const uint16_t kMinUnknownSize = 2 * 10;
197198
// can understand the individual settings of the remote.
198199
// e.g. Aquire the A/C settings from an actual A/C IR remote and override
199200
// any local settings set via MQTT/HTTP etc.
201+
#ifndef USE_DECODED_AC_SETTINGS
200202
#define USE_DECODED_AC_SETTINGS true // `false` to disable. `true` to enable.
203+
#endif // USE_DECODED_AC_SETTINGS
201204
// Should we allow or ignore an A/C IR remote to override the A/C protocol/model
202205
// as set via MQTT or HTTP?
203206
// e.g. If `true`, you can use any fully supported A/C remote to control

examples/IRMQTTServer/platformio.ini

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,21 @@ lib_deps = ${common_esp32.lib_deps_external}
5050

5151
[env:esp01_1m]
5252
board = esp01_1m
53+
board_build.ldscript = eagle.flash.1m64.ld
54+
lib_deps = ${common_esp8266.lib_deps_external}
55+
56+
; This is just to help enable swapping IRMQTTServer via OTA on platforms with
57+
; limited flash space. It doesn't do *ANY* IR stuff. It has almost everything
58+
; turned off except OTA over http.
59+
; Produces a ".bin" file of ~380k.
60+
[env:esp8266_1m_OTA_minimal]
61+
board = esp01_1m
62+
board_build.ldscript = eagle.flash.1m64.ld
5363
build_flags =
5464
${env.build_flags}
55-
-Wl,-Teagle.flash.1m64.ld
65+
-DMQTT_ENABLE=false
66+
-D_IR_ENABLE_DEFAULT_=false
67+
-DEXAMPLES_ENABLE=false
68+
-DMDNS_ENABLE=false
69+
-DUSE_DECODED_AC_SETTINGS=false
5670
lib_deps = ${common_esp8266.lib_deps_external}

src/IRrecv.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ const uint8_t kDefaultESP32Timer = 3;
5858
#if DECODE_AC
5959
// Hitachi AC is the current largest state size.
6060
const uint16_t kStateSizeMax = kHitachiAc2StateLength;
61-
#else
62-
// Just define something
63-
const uint16_t kStateSizeMax = 0;
64-
#endif
61+
#else // DECODE_AC
62+
// Just define something (a uint64_t)
63+
const uint16_t kStateSizeMax = sizeof(uint64_t);
64+
#endif // DECODE_AC
6565

6666
// Types
6767

0 commit comments

Comments
 (0)