Skip to content

Commit

Permalink
Bump version to v1.4.5
Browse files Browse the repository at this point in the history
* Update examples
* Update watchdog
  • Loading branch information
hung-eoh committed Nov 26, 2024
1 parent 6c01e50 commit 344bb0c
Show file tree
Hide file tree
Showing 15 changed files with 424 additions and 34 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp"
"typeinfo": "cpp",
"*.tpp": "cpp"
}
}
72 changes: 71 additions & 1 deletion examples/Realtek/Realtek_PlugNPlay/Realtek_PlugNPlay.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,61 @@
#define ERA_LOCATION_VN
// #define ERA_LOCATION_SG

/* Define setting button */
// #define BUTTON_PIN 0

#if defined(BUTTON_PIN)
// Active low (false), Active high (true)
#define BUTTON_INVERT false
#define BUTTON_HOLD_TIMEOUT 5000UL

// This directive is used to specify whether the configuration should be erased.
// If it's set to true, the configuration will be erased.
#define ERA_ERASE_CONFIG true
#endif

#include <Arduino.h>
#include <ERaSimpleMBRealtek.hpp>
#include <ERa.hpp>
#if defined(BUTTON_PIN)
#include <GTimer.h>
#include <ERa/ERaButton.hpp>
#endif

WiFiClient mbTcpClient;

#if defined(BUTTON_PIN)
ERaButton button;
const uint32_t timerIdButton {0};

static void handlerButton(uint32_t data) {
button.run();
(void)data;
}

#if ERA_VERSION_NUMBER >= ERA_VERSION_VAL(1, 2, 0)
static void eventButton(uint8_t pin, ButtonEventT event) {
if (event != ButtonEventT::BUTTON_ON_HOLD) {
return;
}
ERa.switchToConfig(ERA_ERASE_CONFIG);
(void)pin;
}
#else
static void eventButton(ButtonEventT event) {
if (event != ButtonEventT::BUTTON_ON_HOLD) {
return;
}
ERa.switchToConfig(ERA_ERASE_CONFIG);
}
#endif

void initButton() {
pinMode(BUTTON_PIN, INPUT);
button.setButton(BUTTON_PIN, digitalReadArduino, eventButton,
BUTTON_INVERT).onHold(BUTTON_HOLD_TIMEOUT);
GTimer.begin(timerIdButton, (100 * 1000), handlerButton);
}
#endif

/* This function will run every time ERa is connected */
ERA_CONNECTED() {
Expand All @@ -42,8 +95,25 @@ void setup() {
Serial.begin(115200);
#endif

#if defined(BUTTON_PIN)
/* Initializing button. */
initButton();
#endif

/* Set board id */
// ERa.setBoardID("Board_1");

/* Setup Client for Modbus TCP/IP */
ERa.setModbusClient(mbTcpClient);

/* White labeling App (use this ONLY if you have a branded ERa App) */
// ERa.setVendorName("MyORG");
// ERa.setVendorPrefix("MyPrefix");

/* Set scan WiFi. If activated, the board will
check WiFi before connect. */
ERa.setScanWiFi(true);

/* Initializing the ERa library. */
ERa.begin();

Expand Down
68 changes: 68 additions & 0 deletions examples/Realtek/Realtek_WiFi_Basic/Realtek_WiFi_Basic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,65 @@
// You should get Auth Token in the ERa App or ERa Dashboard
#define ERA_AUTH_TOKEN "ERA2706"

/* Define setting button */
// #define BUTTON_PIN 0

#if defined(BUTTON_PIN)
// Active low (false), Active high (true)
#define BUTTON_INVERT false
#define BUTTON_HOLD_TIMEOUT 5000UL

// This directive is used to specify whether the configuration should be erased.
// If it's set to true, the configuration will be erased.
#define ERA_ERASE_CONFIG false
#endif

#include <Arduino.h>
#include <ERa.hpp>
#if defined(BUTTON_PIN)
#include <GTimer.h>
#include <ERa/ERaButton.hpp>
#endif

const char ssid[] = "YOUR_SSID";
const char pass[] = "YOUR_PASSWORD";

WiFiClient mbTcpClient;

#if defined(BUTTON_PIN)
ERaButton button;
const uint32_t timerIdButton {0};

static void handlerButton(uint32_t data) {
button.run();
(void)data;
}

#if ERA_VERSION_NUMBER >= ERA_VERSION_VAL(1, 2, 0)
static void eventButton(uint8_t pin, ButtonEventT event) {
if (event != ButtonEventT::BUTTON_ON_HOLD) {
return;
}
ERa.switchToConfig(ERA_ERASE_CONFIG);
(void)pin;
}
#else
static void eventButton(ButtonEventT event) {
if (event != ButtonEventT::BUTTON_ON_HOLD) {
return;
}
ERa.switchToConfig(ERA_ERASE_CONFIG);
}
#endif

void initButton() {
pinMode(BUTTON_PIN, INPUT);
button.setButton(BUTTON_PIN, digitalReadArduino, eventButton,
BUTTON_INVERT).onHold(BUTTON_HOLD_TIMEOUT);
GTimer.begin(timerIdButton, (100 * 1000), handlerButton);
}
#endif

/* This function will run every time ERa is connected */
ERA_CONNECTED() {
ERA_LOG("ERa", "ERa connected!");
Expand All @@ -48,8 +101,23 @@ void setup() {
Serial.begin(115200);
#endif

#if defined(BUTTON_PIN)
/* Initializing button. */
initButton();
/* Enable read/write WiFi credentials */
ERa.setPersistent(true);
#endif

/* Set board id */
// ERa.setBoardID("Board_1");

/* Setup Client for Modbus TCP/IP */
ERa.setModbusClient(mbTcpClient);

/* Set scan WiFi. If activated, the board will
check WiFi before connect. */
ERa.setScanWiFi(true);

/* Initializing the ERa library. */
ERa.begin(ssid, pass);

Expand Down
68 changes: 68 additions & 0 deletions examples/Realtek/Realtek_WiFi_SSL/Realtek_WiFi_SSL.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,65 @@
#define ERA_AUTH_TOKEN "ERA2706"
#define ERA_USE_SSL

/* Define setting button */
// #define BUTTON_PIN 0

#if defined(BUTTON_PIN)
// Active low (false), Active high (true)
#define BUTTON_INVERT false
#define BUTTON_HOLD_TIMEOUT 5000UL

// This directive is used to specify whether the configuration should be erased.
// If it's set to true, the configuration will be erased.
#define ERA_ERASE_CONFIG false
#endif

#include <Arduino.h>
#include <ERa.hpp>
#if defined(BUTTON_PIN)
#include <GTimer.h>
#include <ERa/ERaButton.hpp>
#endif

const char ssid[] = "YOUR_SSID";
const char pass[] = "YOUR_PASSWORD";

WiFiClient mbTcpClient;

#if defined(BUTTON_PIN)
ERaButton button;
const uint32_t timerIdButton {0};

static void handlerButton(uint32_t data) {
button.run();
(void)data;
}

#if ERA_VERSION_NUMBER >= ERA_VERSION_VAL(1, 2, 0)
static void eventButton(uint8_t pin, ButtonEventT event) {
if (event != ButtonEventT::BUTTON_ON_HOLD) {
return;
}
ERa.switchToConfig(ERA_ERASE_CONFIG);
(void)pin;
}
#else
static void eventButton(ButtonEventT event) {
if (event != ButtonEventT::BUTTON_ON_HOLD) {
return;
}
ERa.switchToConfig(ERA_ERASE_CONFIG);
}
#endif

void initButton() {
pinMode(BUTTON_PIN, INPUT);
button.setButton(BUTTON_PIN, digitalReadArduino, eventButton,
BUTTON_INVERT).onHold(BUTTON_HOLD_TIMEOUT);
GTimer.begin(timerIdButton, (100 * 1000), handlerButton);
}
#endif

/* This function will run every time ERa is connected */
ERA_CONNECTED() {
ERA_LOG("ERa", "ERa connected!");
Expand All @@ -49,8 +102,23 @@ void setup() {
Serial.begin(115200);
#endif

#if defined(BUTTON_PIN)
/* Initializing button. */
initButton();
/* Enable read/write WiFi credentials */
ERa.setPersistent(true);
#endif

/* Set board id */
// ERa.setBoardID("Board_1");

/* Setup Client for Modbus TCP/IP */
ERa.setModbusClient(mbTcpClient);

/* Set scan WiFi. If activated, the board will
check WiFi before connect. */
ERa.setScanWiFi(true);

/* Initializing the ERa library. */
ERa.begin(ssid, pass);

Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ERa",
"version": "1.4.4",
"version": "1.4.5",
"description": "E-Ra by EoH. An IoT Market Enabler! It supports WiFi, Ethernet, Zigbee, Modbus, Serial. Works with boards like Arduino, ESP8266, ESP32, STM32, Raspberry Pi...",
"keywords": "ERa, E-Ra, esp8266, esp32, stm32, raspberry-pi, http, mqtt, zigbee, modbus, sensors, control, device, smartphone, mobile, app, web, cloud, communication, protocol, iot, wifi, ethernet, serial",
"authors":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ERa
version=1.4.4
version=1.4.5
author=EoH Ltd
license=MIT
maintainer=EoH Ltd <info@eoh.io>
Expand Down
6 changes: 3 additions & 3 deletions linux/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

ERA_MAJOR = 1
ERA_MINOR = 4
ERA_PATCH = 4
ERA_VERSION = "1.4.4"
ERA_FIRMWARE_VERSION = "1.4.4"
ERA_PATCH = 5
ERA_VERSION = "1.4.5"
ERA_FIRMWARE_VERSION = "1.4.5"

BUTTON_GPIO = 16

Expand Down
8 changes: 4 additions & 4 deletions src/ERa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#if defined(ARDUINO) && defined(ESP32)
#if defined(ERA_USE_SSL)
#include <ERaEsp32SSL.hpp>
#include <ERaSimpleMBEsp32SSL.hpp>
#else
#include <ERaEsp32.hpp>
#include <ERaSimpleMBEsp32.hpp>
#endif
#elif defined(ARDUINO) && defined(ESP8266)
#if defined(ERA_USE_SSL)
Expand All @@ -16,9 +16,9 @@
#elif defined(ARDUINO) && \
(defined(RTL8722DM) || defined(ARDUINO_AMEBA))
#if defined(ERA_USE_SSL)
#include <ERaRealtekSSLWiFi.hpp>
#include <ERaRealtekSSL.hpp>
#else
#include <ERaRealtekWiFi.hpp>
#include <ERaRealtek.hpp>
#endif
#elif defined(ARDUINO) && defined(ARDUINO_ARCH_STM32)
#include <TinyGsmClient.hpp>
Expand Down
4 changes: 2 additions & 2 deletions src/ERa/ERaVersion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define ERA_MAJOR 1
#define ERA_MINOR 4
#define ERA_PATCH 4
#define ERA_PATCH 5

#define ERA_VERSION_TO_STR_2(val) # val
#define ERA_VERSION_TO_STR(val) ERA_VERSION_TO_STR_2(val)
Expand All @@ -17,7 +17,7 @@
#define ERA_VERSION ERA_VERSION_TO_STR(ERA_MAJOR) "." \
ERA_VERSION_TO_STR(ERA_MINOR) "." \
ERA_VERSION_TO_STR(ERA_PATCH)
#define ERA_VERSION_1_4_4
#define ERA_VERSION_1_4_5

#if !defined(ERA_FIRMWARE_VERSION)
#define ERA_FIRMWARE_VERSION ERA_VERSION
Expand Down
2 changes: 1 addition & 1 deletion src/Modbus/ERaModbusTransp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ class ERaModbusTransp
}
}
ERA_FORCE_UNUSED(param);
ERA_FORCE_UNUSED(skip);
ERA_FORCE_UNUSED(processWrite);
ERA_FORCE_UNUSED(skip);
return status;
}
Expand Down
Loading

0 comments on commit 344bb0c

Please sign in to comment.