Rearrange docu in /help and correct some examples

This commit is contained in:
fauresystems
2019-11-15 19:27:07 +01:00
parent ea0a9425d1
commit 447f33f62c
29 changed files with 157 additions and 96 deletions
+15 -8
View File
@@ -15,7 +15,6 @@
</ItemGroup>
<ItemGroup>
<Text Include="$(MSBuildThisFileDirectory)keywords.txt" />
<Text Include="$(MSBuildThisFileDirectory)LICENSE.txt" />
<Text Include="$(MSBuildThisFileDirectory)library.properties" />
</ItemGroup>
<ItemGroup>
@@ -26,13 +25,14 @@
<None Include="$(MSBuildThisFileDirectory)examples\BlinkOnBridgePubSub\BlinkOnBridgePubSub.ino" />
<None Include="$(MSBuildThisFileDirectory)examples\BlinkOnEthernetProps\BlinkOnEthernetProps.ino" />
<None Include="$(MSBuildThisFileDirectory)examples\BlinkOnWifiProps\BlinkOnWifiProps.ino" />
<None Include="$(MSBuildThisFileDirectory)help\Arduino_Props.md" />
<None Include="$(MSBuildThisFileDirectory)help\Props.md" />
<None Include="$(MSBuildThisFileDirectory)help\PropsAction.md" />
<None Include="$(MSBuildThisFileDirectory)help\PropsData.md" />
<None Include="$(MSBuildThisFileDirectory)help\WifiNinaFirmware.md" />
<None Include="$(MSBuildThisFileDirectory)LICENSE" />
<None Include="$(MSBuildThisFileDirectory)LICENSE.md" />
<None Include="$(MSBuildThisFileDirectory)Props.md" />
<None Include="$(MSBuildThisFileDirectory)PropsAction.md" />
<None Include="$(MSBuildThisFileDirectory)PropsData.md" />
<None Include="$(MSBuildThisFileDirectory)Arduino_Props.md" />
<None Include="$(MSBuildThisFileDirectory)README.md" />
<None Include="$(MSBuildThisFileDirectory)WifiNinaFirmware.md" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)src\ArduinoProps.cpp" />
@@ -53,7 +53,14 @@
<ClInclude Include="$(MSBuildThisFileDirectory)src\WifiProps.h" />
</ItemGroup>
<ItemGroup>
<Image Include="$(MSBuildThisFileDirectory)examples-shot.png" />
<Image Include="$(MSBuildThisFileDirectory)install-shot.png" />
<Image Include="$(MSBuildThisFileDirectory)help\dependencies-shot.png" />
<Image Include="$(MSBuildThisFileDirectory)help\examples-shot.png" />
<Image Include="$(MSBuildThisFileDirectory)help\install-shot.png" />
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-1.png" />
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-2.png" />
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-3.png" />
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-4.png" />
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-5.png" />
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-6.png" />
</ItemGroup>
</Project>
+46 -8
View File
@@ -12,18 +12,17 @@
<Filter Include="Examples">
<UniqueIdentifier>{a17437ae-fae9-404e-b013-d8b8094f7732}</UniqueIdentifier>
</Filter>
<Filter Include="Help">
<UniqueIdentifier>{5f7b209e-a331-4095-bf45-013b0c4639aa}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="$(MSBuildThisFileDirectory)library.properties" />
<Text Include="$(MSBuildThisFileDirectory)keywords.txt" />
<Text Include="$(MSBuildThisFileDirectory)LICENSE.txt" />
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)LICENSE.md" />
<None Include="$(MSBuildThisFileDirectory)README.md" />
<None Include="$(MSBuildThisFileDirectory)Props.md" />
<None Include="$(MSBuildThisFileDirectory)PropsAction.md" />
<None Include="$(MSBuildThisFileDirectory)PropsData.md" />
<None Include="$(MSBuildThisFileDirectory)EXAMPLES.md" />
<None Include="$(MSBuildThisFileDirectory)examples\BlinkOnBridgeProps\BlinkOnBridgeProps.ino">
<Filter>Examples</Filter>
@@ -39,8 +38,22 @@
</None>
<None Include="$(MSBuildThisFileDirectory)ArduinoProps.zip" />
<None Include="$(MSBuildThisFileDirectory)create-library-zip.bat" />
<None Include="$(MSBuildThisFileDirectory)Arduino_Props.md" />
<None Include="$(MSBuildThisFileDirectory)WifiNinaFirmware.md" />
<None Include="$(MSBuildThisFileDirectory)help\Arduino_Props.md">
<Filter>Help</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)help\Props.md">
<Filter>Help</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)help\PropsAction.md">
<Filter>Help</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)help\PropsData.md">
<Filter>Help</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)help\WifiNinaFirmware.md">
<Filter>Help</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)LICENSE" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)src\ArduinoProps.cpp">
@@ -89,7 +102,32 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="$(MSBuildThisFileDirectory)examples-shot.png" />
<Image Include="$(MSBuildThisFileDirectory)install-shot.png" />
<Image Include="$(MSBuildThisFileDirectory)help\dependencies-shot.png">
<Filter>Help</Filter>
</Image>
<Image Include="$(MSBuildThisFileDirectory)help\examples-shot.png">
<Filter>Help</Filter>
</Image>
<Image Include="$(MSBuildThisFileDirectory)help\install-shot.png">
<Filter>Help</Filter>
</Image>
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-1.png">
<Filter>Help</Filter>
</Image>
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-2.png">
<Filter>Help</Filter>
</Image>
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-3.png">
<Filter>Help</Filter>
</Image>
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-4.png">
<Filter>Help</Filter>
</Image>
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-5.png">
<Filter>Help</Filter>
</Image>
<Image Include="$(MSBuildThisFileDirectory)help\wifinina-firmware-6.png">
<Filter>Help</Filter>
</Image>
</ItemGroup>
</Project>
BIN
View File
Binary file not shown.
+25 -12
View File
@@ -6,16 +6,20 @@ An adaptation of the internal led Blink example (https://www.arduino.cc/en/tutor
3. **BlinkOnWifiProps**: the Blink example on a Wifi props with *ArduinoProps library*
4. **BlinkOnBridgePubSub**: the Blink example on props using *PubSubClient* directly
MQTT messages are received asynchronously therefore to keep the sketch responsive to MQTT commands, calls to delay() should be avoided (except short ones, say < 100milliseconds).
MQTT messages are received asynchronously therefore to keep the sketch responsive to MQTT commands, calls to delay() should be avoided (except short ones, say < 100 milliseconds).
With *Props* class, the props code is more readable because all MQTT *PubSubClient* stuff are hidden in *Props* calls, therefore the props code is easier to write and maintain.
Asynchronous-like behavior is obtained using *PropsAction*, *TimedAction* or *VariableTimedAction*.
*Copy and change any of these sketches to build your own Arduino connected props, you will only be limited by your imagination.*
***Copy and change any of these sketches to build your own Arduino connected props, you will only be limited by your imagination.***
## 1. *BlinkOnBridgeProps*: the Blink example on a Yun props with *ArduinoProps library*
With *Props* class, the code is the most readable. All MQTT stuff are hidden in *Props* calls, your processing code is easier to write and maintain.
The library comes with a number of example sketches. See **File > Examples > ArduinoProps** within the Arduino IDE application after installing the *ArduinoProps* library from the `.zip` file.
![](help/examples-shot.png)
```csharp
/* BlinkOnBridgeProps.ino
@@ -25,7 +29,7 @@ With *Props* class, the code is the most readable. All MQTT stuff are hidden in
simple MQTT props. Avoid delay() calls (except short ones) in loop() to
ensure CPU for MQTT protocol. Use PropsAction checks instead.
Copy and change it to build your fist Arduino connected props, you will
Copy and change it to build your first Arduino connected props, you will
only be limited by your imagination.
Requirements: install ArduinoProps.zip library.
@@ -132,15 +136,15 @@ void updateBrokerAdressFromFile(const char* broker_file, BridgeProps* props)
### Memory imprint on Arduino Yun:
```bash
The sketch uses 16720 bytes (58%) of the program storage space. The maximum is 28672 bytes.
Global variables use 1122 bytes (43%) of dynamic memory, which leaves 1438 bytes for local variables. The maximum is 2560 bytes.
The sketch uses 16752 bytes (58%) of the program storage space. The maximum is 28672 bytes.
Global variables use 1120 bytes (43%) of dynamic memory, which leaves 1438 bytes for local variables. The maximum is 2560 bytes.
```
### Memory imprint on *Dragino Yun + Arduino Mega 2560:
### Memory imprint on Dragino Yun + Arduino Mega 2560:
```bash
The sketch uses 14030 bytes (5%) of the program storage space. The maximum is 258048 bytes.
Global variables use 982 bytes (11%) of dynamic memory, which leaves 7210 bytes for local variables. The maximum is 8192 bytes.
The sketch uses 14060 bytes (5%) of the program storage space. The maximum is 258048 bytes.
Global variables use 980 bytes (11%) of dynamic memory, which leaves 7210 bytes for local variables. The maximum is 8192 bytes.
```
@@ -149,15 +153,23 @@ Global variables use 982 bytes (11%) of dynamic memory, which leaves 7210 bytes
Sketch with *EthernetProps* differs slightly from code with *BridgeProps*.
The library comes with a number of example sketches. See **File > Examples > ArduinoProps** within the Arduino IDE application after installing the *ArduinoProps* library from the `.zip` file.
#### Pay atention to the board MAC address:
MAC adresses are hardware identifiers on the network so they must be unique.
A good practice is to increment only the byte at the very right (`0x03`) when adding a new Arduino Ethernet on your network.
```csharp
byte mac[] = { 0x46, 0x4F, 0xEA, 0x10, 0x20, 0x03 }; //<<< MAKE SURE IT'S UNIQUE IN YOUR NETWORK!!! and not a reserved MAC
```
![](examples-shot.png)
## 3. *BlinkOnWifiProps*: the Blink example on a Wifi props with *ArduinoProps library*
Sketch with *WifiProps* differs slightly from code with *BridgeProps*.
Please update the WiFiNINA firmware: [WiFiNINA firmware update](WifiNinaFirmware.md).
#### The board WiFiNINA firmware must be recent (> 1.0):
Uupdating WiFiNINA firmware is easy: [WiFiNINA firmware update](help/WifiNinaFirmware.md).
## 4. *BlinkOnBridgePubSub*: the Blink example on props using *PubSubClient* directly
@@ -401,6 +413,7 @@ Global variables use 1013 bytes (39%) of dynamic memory, which leaves 1547 bytes
```
Only 1 KBytes less than BlinkOnBridgeProps on Arduino Yun, and the sketch is much less readable.
## Author
-20
View File
@@ -1,20 +0,0 @@
Copyright (c) 2019 Marie Faure <dev at faure dot systems>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file not shown.
+25 -15
View File
@@ -11,35 +11,45 @@
## 1. Installation and usage
### Prepare Arduino IDE
Download [ArduinoProps.zip](https://github.com/fauresystems/ArduinoProps/raw/master/ArduinoProps.zip) from GitHub and use **Sketch > Include Library > Add .ZIP Library...**
![](install-shot.png)
![](help/install-shot.png)
Download library dependencies for Library Manager:
* ***PubSubClient***
* ***ListLib***
![](dependencies-shot.png)
![](help/dependencies-shot.png)
### Start coding your own props
Add `#include "ArduinoProps.h"` on top of your sketch and start coding.
Add `#include "ArduinoProps.h"` on top of your sketch and start coding. Reading [EXAMPLES.md](EXAMPLES.md) will be helpful.
A fork of one the examples is the fastest way to create your own props.
|ArduinoProps library documentation |
|--------------------------------------------------------|
| [This README file](README.md) |
| [Props class reference](Props.md) |
| [PropsData class reference](PropsData.md) |
| [PropsAction class reference](PropsAction.md) |
| [ArduinoProps library examples](EXAMPLES.md) |
| [Arduino Props for Escape Room 2.0](Arduino_Props.md) |
| [WiFiNINA firmware update](WifiNinaFirmware.md) |
### Find help in the documentation
Reading [EXAMPLES.md](EXAMPLES.md) will be helpful.
|ArduinoProps library documentation |
|-------------------------------------------------------------|
| [This README file](README.md) |
| [Props class reference](help/Props.md) |
| [PropsData class reference](help/PropsData.md) |
| [PropsAction class reference](help/PropsAction.md) |
| [ArduinoProps library examples](EXAMPLES.md) |
| [Arduino Props for Escape Room 2.0](help/Arduino_Props.md) |
| [WiFiNINA firmware update](help/WifiNinaFirmware.md) |
## 2. Escape room 2.0 props with Arduino
The *ArduinoProps library* allows to build *escape room 2.0 props* easily with Arduino and particularly with Arduino Yun or Arduino Mega 2560 + Dragino Yun shield however it works with Ethernet and Wifi shields too.
The *ArduinoProps library* relies on *<a href="https://github.com/knolleary/pubsubclient" target="_blank">Nick O'Leary PubSubClient</a>***** library for MQTT. MQTT is a lightweight publish/subscribe messaging protocol designed for M2M (machine to machine) telemetry in low bandwidth environments.
The *ArduinoProps library* relies on *<a href="https://github.com/knolleary/pubsubclient" target="_blank">Nick O'Leary PubSubClient</a>***** library for MQTT. MQTT is a lightweight
![](help/install-shot.png)
publish/subscribe messaging protocol designed for M2M (machine to machine) telemetry in low bandwidth environments.
### Props with *Raspberry*
Escape room 2.0 props can be powered with Raspberry Pi or any Pythonic nanocomputer using *MqttApp*, our pure Python 3 class based on <a href="https://github.com/eclipse/paho.mqtt.python" target="_blank">Eclipse Paho™ MQTT Python Client</a>.
@@ -61,7 +71,7 @@ Props receives commands in its inbox MQTT topic.
Props can subscribe to any other MQTT topic to receive othe information, for example the escape game scenario (English/French/Kids) or the game clock countdown.
### Escape room structured MQTT topics
#### Escape room structured MQTT topics
If you're running our Escape Room control software *Room 2.0* to supervise the escape room in real-time you have to respect its syntax for inbox/outbnox MQTT topics:
```csharp
Room/[escape room name]/Props/[propsname]/inbox|outbox
@@ -175,7 +185,7 @@ More MQTT topics can be use for anything (room scenario, etc.).
- Arduino Ethernet
- Arduino Ethernet Shield
For WiFi props, please update the WiFiNINA firmware: [WiFiNINA firmware update](WifiNinaFirmware.md).
For WiFi props, please update the WiFiNINA firmware: [WiFiNINA firmware update](help/WifiNinaFirmware.md).
To use other WiFi hardware compatible with any *<a href="https://github.com/knolleary/pubsubclient" target="_blank">Nick O'Leary PubSubClient</a>* library you have to fork `WifiProps.h` and `WifiProps.cpp` and to replace `WiFiNINA.h` whih appropriate WiFi library (`ESP8266WiFi.h` for example):
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

@@ -5,7 +5,7 @@
simple MQTT props. Avoid delay() calls (except short ones) in loop() to
ensure CPU for MQTT protocol. Use PropsAction checks instead.
Copy and change it to build your fist Arduino connected props, you will
Copy and change it to build your first Arduino connected props, you will
only be limited by your imagination.
Requirements: install ArduinoProps.zip library.
@@ -5,7 +5,7 @@
simple MQTT props. Avoid delay() calls (except short ones) in loop() to
ensure CPU for MQTT protocol. Use PropsAction checks instead.
Copy and change it to build your fist Arduino connected props, you will
Copy and change it to build your first Arduino connected props, you will
only be limited by your imagination.
Requirements: install ArduinoProps.zip library.
@@ -52,7 +52,7 @@ void setup()
}
delay(1500); // time for shield stuff
// can do more static IP configuration, must be called after Ethernet.begin()
//Ethernet.setSubnetMask(IPAddress(255, 255, 255, 0));
//Ethernet.setGatewayIP(IPAddress(192, 168, 1, 1));
+13 -14
View File
@@ -5,7 +5,7 @@
simple MQTT props. Avoid delay() calls (except short ones) in loop() to
ensure CPU for MQTT protocol. Use PropsAction checks instead.
Copy and change it to build your fist Arduino connected props, you will
Copy and change it to build your first Arduino connected props, you will
only be limited by your imagination.
Requirements: install ArduinoProps.zip library.
@@ -60,20 +60,19 @@ void loop()
delay(250); // acceptable freeze for this props (otherwise use PropsAction for async-like behavior)
// do static IP configuration disabling the dhcp client, must be called after every WiFi.begin()
String fv = WiFi.firmwareVersion();
if (fv.startsWith("1.0")) {
Serial.println("Please upgrade the firmware for static IP");
// see https://github.com/fauresystems/ArduinoProps/blob/master/WifiNinaFirmware.md
}
else {
//WiFi.config(IPAddress(192, 168, 1, 21), // local_ip
// IPAddress(192, 168, 1, 1), // dns_server
// IPAddress(192, 168, 1, 1), // gateway
// IPAddress(255, 255, 255, 0)); // subnet
//WiFi.setHostname("wifiprops");
}
if (fv.startsWith("1.0")) {
Serial.println("Please upgrade the firmware for static IP");
// see https://github.com/fauresystems/ArduinoProps/blob/master/WifiNinaFirmware.md
}
else {
//WiFi.config(IPAddress(192, 168, 1, 21), // local_ip
// IPAddress(192, 168, 1, 1), // dns_server
// IPAddress(192, 168, 1, 1), // gateway
// IPAddress(255, 255, 255, 0)); // subnet
}
if (WiFi.status() == WL_CONNECTED) {
wifiBegun = true;
Serial.println(WiFi.localIP());
wifiBegun = true;
Serial.println(WiFi.localIP());
Serial.println(WiFi.subnetMask());
Serial.println(WiFi.gatewayIP());
} else {
+3 -3
View File
@@ -3,7 +3,7 @@
*Props* is a base class for 3 connected props, depending on their network interface:
* ***BridgeProps*** for Yun board and Yun shield
* ***EthernetProps*** for Ethernet shield
* ***WifiProps*** for Wifi shield
* ***WifiProps*** for WiFiNINA boards
*Props* class reference:
1. Define the *Props*
@@ -131,7 +131,7 @@ Room 2.0 *outbox* topic:
format: Room/[escape room name]/Props/[props name]/outbox
example: u8"Room/Demoniak/Props/Arduino Contrôleur/outbox"
```
See [README.md](README.md): **4. Application protocol for escape room 2.0 props**.
See [README.md](../README.md): **4. Application protocol for escape room 2.0 props**.
#### *PropsData* instances
*PropsData* provides a facility to monitor data sent into MQTT outbox.
@@ -312,7 +312,7 @@ void updateBrokerAdressFromFile(const char* broker_file, BridgeProps* props)
## 6. Examples
The library comes with a number of example sketches. See **File > Examples > ArduinoProps** within the Arduino IDE application.
See [EXAMPLES.md](EXAMPLES.md) for an adaptation of the Blink example (https://www.arduino.cc/en/tutorial/blink) as a simple MQTT props:
See [EXAMPLES.md](../EXAMPLES.md) for an adaptation of the Blink example (https://www.arduino.cc/en/tutorial/blink) as a simple MQTT props:
1. **BlinkOnBridgeProps**: the Blink example on a Yun props with *ArduinoProps library*
2. **BlinkOnEthernetProps**: the Blink example on an Ethernet props with *ArduinoProps library*
+1 -1
View File
@@ -2,7 +2,7 @@
*PropsData* tracks data changes and provides escape room 2.0 propocol `DATA` ready string format.
See **4. Application protocol for escape room 2.0 props** in [README.md](README.md).
See **4. Application protocol for escape room 2.0 props** in [README.md](../README.md).
*PropsData* is an interface (base class) implemented by 4 classes:
* ***PropsDataDecimal***

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

+20 -7
View File
@@ -10,6 +10,9 @@
#include "Props.h"
#include <Process.h>
#if defined(__AVR__)
#include <avr/wdt.h>
#endif
void PropsCallback::run(char* topic, byte* payload, unsigned int len)
{
@@ -57,7 +60,7 @@ Props::Props(const char* client_id, const char* in_box, const char* out_box, con
void Props::addData(PropsData* d)
{
_dataTable.push_back(d);
_dataTable.Add(d);
}
void Props::loop()
@@ -95,12 +98,22 @@ void Props::checkDataChanges()
if (_dataSentCount > (_maximumSilentPeriod * 1000 / _sendDataAction.getInterval())) _dataSentCount = 0;
}
void Props::resetMcu()
{
#if defined(ARDUINO_ARCH_SAMD)
NVIC_SystemReset();
#elif defined(__AVR__)
wdt_enable(WDTO_15MS);
while (true);
#endif
}
void Props::sendAllData()
{
String data("DATA "), str;
for (SimpleList<PropsData*>::iterator itr = _dataTable.begin(); itr != _dataTable.end(); ++itr) {
str = (*itr)->fetch();
send(&data, &str);
for (int i = 0; i < _dataTable.Count(); i++) {
str = _dataTable[i]->fetch();
send(&data, &str);
}
if (data.length() > 5) {
@@ -111,9 +124,9 @@ void Props::sendAllData()
void Props::sendDataChanges()
{
String data("DATA "), str;
for (SimpleList<PropsData*>::iterator itr = _dataTable.begin(); itr != _dataTable.end(); ++itr) {
str = (*itr)->fetchChange();
send(&data, &str);
for (int i = 0; i < _dataTable.Count(); i++) {
str = _dataTable[i]->fetchChange();
send(&data, &str);
}
if (data.length() > 5) {
+4 -3
View File
@@ -18,7 +18,7 @@
#include <BridgeClient.h>
#include <PubSubClient.h>
#include <SimpleList.h>
#include <ListLib.h>
#include "PropsAction.h"
#include "PropsData.h"
@@ -54,8 +54,9 @@ class Props
Props(const char*, const char*, const char*, const char*, const int=1883);
virtual void begin(void(*)(String) = NULL) = 0;
void addData(PropsData*);
void loop();
void loop();
void resetIntervals(const int changes, const int silent);
void resetMcu();
void sendAllData();
void sendDataChanges();
void sendData(String); // only in outbox
@@ -86,7 +87,7 @@ class Props
unsigned long _nextReconAttempt;
uint8_t _payloadMax;
PropsAction _sendDataAction;
SimpleList<PropsData*> _dataTable;
List<PropsData*> _dataTable;
};
#endif
+1 -1
View File
@@ -5,7 +5,7 @@
Editor: https://github.com/fauresystems
License: MIT License (c) Marie Faure <dev at faure dot systems>
Class Props for Arduino with Wifi shield.
Class Props for Arduino with WiFiNINA.
*/
#include "WifiProps.h"
+1 -1
View File
@@ -5,7 +5,7 @@
Editor: https://github.com/fauresystems
License: MIT License (c) Marie Faure <dev at faure dot systems>
Class Props for Arduino with Wifi shield.
Class Props for Arduino with WiFiNINA.
*/
#ifndef WIFIPROPS_H
#define WIFIPROPS_H