Minor i18n changes and add some platformio environs. (#955)

* rename locale files from xx_XX.h to xx-XX.h
* Enable building different langauges for IRrecvDumpV2 via platformio.
* IRrecvDumpV2: Add Comments and add back "Raw Timing" as legacy option.
* Clean up platformio.ini files.
This commit is contained in:
David Conran
2019-10-08 09:53:41 +10:00
committed by GitHub
parent 93af0268c9
commit 1ce36a8220
39 changed files with 95 additions and 85 deletions

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
build_flags =
framework = arduino
build_flags = -D_IR_LOCALE_=en-AU
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,7 +5,9 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
build_flags = -DMQTT_MAX_PACKET_SIZE=768
build_flags = -DMQTT_MAX_PACKET_SIZE=768 -D_IR_LOCALE_=en-AU
framework = arduino
platform = espressif8266
[common]
lib_deps_builtin =
@@ -26,20 +28,14 @@ lib_deps_external =
https://github.com/tzapu/WiFiManager.git#development
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
lib_deps = ${common_esp8266.lib_deps_external}
[env:d1_mini]
platform = espressif8266
framework = arduino
board = d1_mini
lib_deps = ${common_esp8266.lib_deps_external}
[env:d1_mini_no_mqtt]
platform = espressif8266
framework = arduino
board = d1_mini
build_flags =
${env.build_flags}
@@ -48,13 +44,10 @@ lib_deps = ${common_esp8266.lib_deps_external}
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev
lib_deps = ${common_esp32.lib_deps_external}
[env:esp01_1m]
platform = espressif8266
framework = arduino
board = esp01_1m
build_flags =
${env.build_flags}

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -9,6 +9,9 @@
* https://github.com/crankyoldgit/IRremoteESP8266/wiki#ir-receiving
*
* Changes:
* Version 1.0 October, 2019
* - Internationalisation (i18n) support.
* - Stop displaying the legacy raw timing info.
* Version 0.5 June, 2019
* - Move A/C description to IRac.cpp.
* Version 0.4 July, 2018
@@ -93,6 +96,11 @@ const uint8_t kTimeout = 15;
// from your device. (e.g. Other IR remotes work.)
// NOTE: Set this value very high to effectively turn off UNKNOWN detection.
const uint16_t kMinUnknownSize = 12;
// Legacy (No longer supported!)
//
// Change to `true` if you miss/need the old "Raw Timing[]" display.
#define LEGACY_TIMING_INFO false
// ==================== end of TUNEABLE PARAMETERS ====================
// Use turn on the save buffer feature for more complete capture coverage.
@@ -112,7 +120,7 @@ void setup() {
#if DECODE_HASH
// Ignore messages with less than minimum on or off pulses.
irrecv.setUnknownThreshold(kMinUnknownSize);
#endif // DECODE_HASH
#endif // DECODE_HASH
irrecv.enableIRIn(); // Start the receiver
}
@@ -123,7 +131,7 @@ void loop() {
// Display a crude timestamp.
uint32_t now = millis();
Serial.printf(D_STR_TIMESTAMP " : %06u.%03u\n", now / 1000, now % 1000);
// Check if we got an IR message tha was to big for our capture buffer.
// Check if we got an IR message that was to big for our capture buffer.
if (results.overflow)
Serial.printf(D_WARN_BUFFERFULL "\n", kCaptureBufferSize);
// Display the library version the message was captured with.
@@ -134,6 +142,11 @@ void loop() {
String description = IRAcUtils::resultAcToString(&results);
if (description.length()) Serial.println(D_STR_MESGDESC ": " + description);
yield(); // Feed the WDT as the text output can take a while to print.
#if LEGACY_TIMING_INFO
// Output legacy RAW timing info of the result.
Serial.println(resultToTimingInfo(&results));
yield(); // Feed the WDT (again)
#endif // LEGACY_TIMING_INFO
// Output the results as source code
Serial.println(resultToSourceCode(&results));
Serial.println(); // Blank line between entries

View File

@@ -2,17 +2,42 @@
src_dir = .
[env]
; Default platform
platform = espressif8266
; Default board
board = nodemcuv2
framework = arduino
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
; build_flags = -D_IR_LOCALE_=en-AU
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev
; build_flags = -D_IR_LOCALE_=en-AU
[env:de-CH]
build_flags = -D_IR_LOCALE_=de-CH
[env:de-DE]
build_flags = -D_IR_LOCALE_=de-DE
[env:en-AU]
build_flags = -D_IR_LOCALE_=en-AU
[env:en-IE]
build_flags = -D_IR_LOCALE_=en-IE
[env:en-UK]
build_flags = -D_IR_LOCALE_=en-UK
[env:en-US]
build_flags = -D_IR_LOCALE_=en-US
[env:es-ES]
build_flags = -D_IR_LOCALE_=es-ES

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
build_flags =
framework = arduino
build_flags = -D_IR_LOCALE_=en-AU
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
build_flags =
framework = arduino
build_flags = -D_IR_LOCALE_=en-AU
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
build_flags =
framework = arduino
build_flags = -D_IR_LOCALE_=en-AU
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
build_flags =
framework = arduino
build_flags = -D_IR_LOCALE_=en-AU
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
build_flags =
framework = arduino
build_flags = -D_IR_LOCALE_=en-AU
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
build_flags =
framework = arduino
build_flags = -D_IR_LOCALE_=en-AU
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,14 +5,13 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -5,6 +5,7 @@ src_dir = .
lib_extra_dirs = ../../
lib_ldf_mode = deep+
lib_ignore = examples
framework = arduino
build_flags =
[common]
@@ -26,12 +27,10 @@ lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
lib_deps = ${common_esp8266.lib_deps_external}
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev
lib_deps = ${common_esp32.lib_deps_external}

View File

@@ -1,23 +1,21 @@
[platformio]
# Default to building IRrecvDumpV2 if not in a specific example directory.
src_dir = examples/IRrecvDumpV2
[env]
lib_extra_dirs = .
lib_ldf_mode = deep+
lib_ignore = examples
build_flags =
framework = arduino
platform = espressif8266
build_flags = -D_IR_LOCALE_=en-AU
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
[env:d1_mini]
platform = espressif8266
framework = arduino
board = d1_mini
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

View File

@@ -55,7 +55,7 @@
// Set the language & locale for the library. See the `locale` dir for options.
#ifndef _IR_LOCALE_
#define _IR_LOCALE_ en_AU
#define _IR_LOCALE_ en-AU
#endif // _IR_LOCALE_
// Supported IR protocols

View File

@@ -7,7 +7,7 @@
// Load the appropriate locale header file.
#ifndef _IR_LOCALE_
#define _IR_LOCALE_ en_AU
#define _IR_LOCALE_ en-AU
#endif // _IR_LOCALE_
#define ENQUOTE_(x) #x

View File

@@ -5,7 +5,7 @@
#define LOCALE_DE_CH_H_
// Import German / Germany as default overrides.
#include "locale/de_DE.h"
#include "locale/de-DE.h"
// As we have loaded another language, we need to #undef anything we need
// to update/change.

View File

@@ -2,10 +2,14 @@
// The default text to use throughout the library.
// The library will use this text if no locale (_IR_LOCALE_) is set or if
// the locale doesn't define particular values.
// If they are defined, this file should NOT over ride them.
// If they are defined, this file should NOT override them.
//
// This file should contain a #define for every translateable/locale dependant
// string used by the library.
// string used by the library. Language specific files don't have to include
// everything.
//
// NOTE: ASCII/UTF-8 characters only. Unicode is NOT supported.
//
// The defaults are English (AU) / en-AU. Australia (AU) is pretty much the same
// as English (UK) for this libraries use case.
#ifndef LOCALE_DEFAULTS_H_

View File

@@ -3,6 +3,6 @@
// This file will override the default values located in `defaults.h`.
#ifndef LOCALE_EN_AU_H_
#define LOCALE_EN_AU_H_
// Nothing should really need to be set here, as en_AU is the default
// Nothing should really need to be set here, as en-AU is the default
// locale/language.
#endif // LOCALE_EN_AU_H__

View File

@@ -3,6 +3,6 @@
// This file will override the default values located in `defaults.h`.
#ifndef LOCALE_EN_IE_H_
#define LOCALE_EN_IE_H_
// Nothing should really need to be set here, as en_IE is the same as en_AU,
// Nothing should really need to be set here, as en-IE is the same as en-AU,
// which is the default locale/language.
#endif // LOCALE_EN_IE_H__

View File

@@ -3,6 +3,6 @@
// This file will override the default values located in `defaults.h`.
#ifndef LOCALE_EN_UK_H_
#define LOCALE_EN_UK_H_
// Nothing should really need to be set here, as en_UK is the same as en_AU,
// Nothing should really need to be set here, as en-UK is the same as en-AU,
// which is the default locale/language.
#endif // LOCALE_EN_UK_H__

View File

@@ -21,7 +21,7 @@ INCLUDES = -I$(USER_DIR) -I.
# Flags passed to the preprocessor.
# Set Google Test's header directory as a system directory, such that
# the compiler doesn't generate warnings in Google Test headers.
CPPFLAGS += -isystem $(GTEST_DIR)/include -DUNIT_TEST -D_IR_LOCALE_=en_AU
CPPFLAGS += -isystem $(GTEST_DIR)/include -DUNIT_TEST -D_IR_LOCALE_=en-AU
# Flags passed to the C++ compiler.
CXXFLAGS += -g -Wall -Wextra -pthread -std=gnu++11

View File

@@ -18,7 +18,7 @@ INCLUDES = -I$(USER_DIR) -I$(TEST_DIR)
# Flags passed to the preprocessor.
# Set Google Test's header directory as a system directory, such that
# the compiler doesn't generate warnings in Google Test headers.
CPPFLAGS += -DUNIT_TEST -D_IR_LOCALE_=en_AU
CPPFLAGS += -DUNIT_TEST -D_IR_LOCALE_=en-AU
# Flags passed to the C++ compiler.
CXXFLAGS += -g -Wall -Wextra -pthread -std=gnu++11