mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
Arduino set Knx uart bugfix (#32)
* bugfix, print not allowed in constructor * Update tpuart_data_link_layer.cpp - start confirm timout only after last byte was sent - increase BYTE_TIMEOUT * -bugfix Arduino set knxUart * Update knx-bme680.ino * Update knx-demo.ino * Update knx-hdc1008.ino * Update knx-sonoffS20.ino * Update knx-bme680.ino * Update knx-demo.ino * Update arduino_platform.cpp * Update dpt.h * Update esp32_platform.h * Update esp_platform.h
This commit is contained in:
parent
f2d45b233a
commit
68b0002490
@ -42,10 +42,10 @@ bool trigger = false;
|
|||||||
// Entry point for the example
|
// Entry point for the example
|
||||||
void setup(void)
|
void setup(void)
|
||||||
{
|
{
|
||||||
SerialDBG.begin(115200);
|
Serial.begin(115200);
|
||||||
ArduinoPlatform::SerialDebug = SerialDBG;
|
ArduinoPlatform::SerialDebug = Serial;
|
||||||
delay(5000);
|
delay(5000);
|
||||||
SerialDBG.println("start");
|
Serial.println("start");
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
WiFiManager wifiManager;
|
WiFiManager wifiManager;
|
||||||
@ -92,8 +92,8 @@ void setup(void)
|
|||||||
if (knx.configured())
|
if (knx.configured())
|
||||||
{
|
{
|
||||||
cyclSend = knx.paramInt(0);
|
cyclSend = knx.paramInt(0);
|
||||||
SerialDBG.print("Zykl. send:");
|
Serial.print("Zykl. send:");
|
||||||
SerialDBG.println(cyclSend);
|
Serial.println(cyclSend);
|
||||||
goRawTemperature.dataPointType(Dpt(9, 1));
|
goRawTemperature.dataPointType(Dpt(9, 1));
|
||||||
goPressure.dataPointType(Dpt(9, 1));
|
goPressure.dataPointType(Dpt(9, 1));
|
||||||
goRawHumidity.dataPointType(Dpt(9, 1));
|
goRawHumidity.dataPointType(Dpt(9, 1));
|
||||||
@ -112,7 +112,7 @@ void setup(void)
|
|||||||
iaqSensor.updateSubscription(sensorList, sizeof(sensorList)/sizeof(bsec_virtual_sensor_t), BSEC_SAMPLE_RATE_LP);
|
iaqSensor.updateSubscription(sensorList, sizeof(sensorList)/sizeof(bsec_virtual_sensor_t), BSEC_SAMPLE_RATE_LP);
|
||||||
checkIaqSensorStatus();
|
checkIaqSensorStatus();
|
||||||
String output = "Timestamp [ms], raw temperature [°C], pressure [hPa], raw relative humidity [%], gas [Ohm], IAQ, IAQ accuracy, temperature [°C], relative humidity [%], CO2";
|
String output = "Timestamp [ms], raw temperature [°C], pressure [hPa], raw relative humidity [%], gas [Ohm], IAQ, IAQ accuracy, temperature [°C], relative humidity [%], CO2";
|
||||||
SerialDBG.println(output);
|
Serial.println(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function that is looped forever
|
// Function that is looped forever
|
||||||
@ -150,7 +150,7 @@ void loop(void)
|
|||||||
output += ", " + String(iaqSensor.runInStatus);
|
output += ", " + String(iaqSensor.runInStatus);
|
||||||
output += ", " + String(iaqSensor.stabStatus);
|
output += ", " + String(iaqSensor.stabStatus);
|
||||||
|
|
||||||
SerialDBG.println(output);
|
Serial.println(output);
|
||||||
updateState();
|
updateState();
|
||||||
|
|
||||||
if (sendCounter++ == cyclSend || trigger)
|
if (sendCounter++ == cyclSend || trigger)
|
||||||
@ -180,26 +180,26 @@ void checkIaqSensorStatus(void)
|
|||||||
if (iaqSensor.status != BSEC_OK) {
|
if (iaqSensor.status != BSEC_OK) {
|
||||||
if (iaqSensor.status < BSEC_OK) {
|
if (iaqSensor.status < BSEC_OK) {
|
||||||
String output = "BSEC error code : " + String(iaqSensor.status);
|
String output = "BSEC error code : " + String(iaqSensor.status);
|
||||||
SerialDBG.println(output);
|
Serial.println(output);
|
||||||
for (;;)
|
for (;;)
|
||||||
errLeds(); /* Halt in case of failure */
|
errLeds(); /* Halt in case of failure */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String output = "BSEC warning code : " + String(iaqSensor.status);
|
String output = "BSEC warning code : " + String(iaqSensor.status);
|
||||||
SerialDBG.println(output);
|
Serial.println(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iaqSensor.bme680Status != BME680_OK) {
|
if (iaqSensor.bme680Status != BME680_OK) {
|
||||||
if (iaqSensor.bme680Status < BME680_OK) {
|
if (iaqSensor.bme680Status < BME680_OK) {
|
||||||
String output = "BME680 error code : " + String(iaqSensor.bme680Status);
|
String output = "BME680 error code : " + String(iaqSensor.bme680Status);
|
||||||
SerialDBG.println(output);
|
Serial.println(output);
|
||||||
for (;;)
|
for (;;)
|
||||||
errLeds(); /* Halt in case of failure */
|
errLeds(); /* Halt in case of failure */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String output = "BME680 warning code : " + String(iaqSensor.bme680Status);
|
String output = "BME680 warning code : " + String(iaqSensor.bme680Status);
|
||||||
SerialDBG.println(output);
|
Serial.println(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,10 +216,10 @@ void errLeds(void)
|
|||||||
uint8_t* loadBme680State(uint8_t* buffer)
|
uint8_t* loadBme680State(uint8_t* buffer)
|
||||||
{
|
{
|
||||||
// Existing state in EEPROM
|
// Existing state in EEPROM
|
||||||
SerialDBG.println("Reading state from EEPROM");
|
Serial.println("Reading state from EEPROM");
|
||||||
|
|
||||||
for (uint8_t i = 0; i < BSEC_MAX_STATE_BLOB_SIZE; i++) {
|
for (uint8_t i = 0; i < BSEC_MAX_STATE_BLOB_SIZE; i++) {
|
||||||
SerialDBG.println(buffer[i], HEX);
|
Serial.println(buffer[i], HEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
iaqSensor.setState(buffer);
|
iaqSensor.setState(buffer);
|
||||||
@ -232,10 +232,10 @@ uint8_t* saveBme680State(uint8_t* buffer)
|
|||||||
iaqSensor.getState(buffer);
|
iaqSensor.getState(buffer);
|
||||||
checkIaqSensorStatus();
|
checkIaqSensorStatus();
|
||||||
|
|
||||||
SerialDBG.println("Writing state to EEPROM");
|
Serial.println("Writing state to EEPROM");
|
||||||
|
|
||||||
for (uint8_t i = 0; i < BSEC_MAX_STATE_BLOB_SIZE; i++) {
|
for (uint8_t i = 0; i < BSEC_MAX_STATE_BLOB_SIZE; i++) {
|
||||||
SerialDBG.println(buffer[i], HEX);
|
Serial.println(buffer[i], HEX);
|
||||||
}
|
}
|
||||||
return buffer + BSEC_MAX_STATE_BLOB_SIZE;
|
return buffer + BSEC_MAX_STATE_BLOB_SIZE;
|
||||||
}
|
}
|
||||||
@ -266,8 +266,8 @@ void updateState(void)
|
|||||||
// callback from trigger-GO
|
// callback from trigger-GO
|
||||||
void triggerCallback(GroupObject& go)
|
void triggerCallback(GroupObject& go)
|
||||||
{
|
{
|
||||||
SerialDBG.println("trigger");
|
Serial.println("trigger");
|
||||||
SerialDBG.println((bool)go.value());
|
Serial.println((bool)go.value());
|
||||||
if (!go.value())
|
if (!go.value())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -275,11 +275,11 @@ void triggerCallback(GroupObject& go)
|
|||||||
/* We call bsec_update_subscription() in order to instruct BSEC to perform an extra measurement at the next
|
/* We call bsec_update_subscription() in order to instruct BSEC to perform an extra measurement at the next
|
||||||
possible time slot
|
possible time slot
|
||||||
*/
|
*/
|
||||||
SerialDBG.println("Triggering ULP plus.");
|
Serial.println("Triggering ULP plus.");
|
||||||
bsec_virtual_sensor_t sensorList[] = {
|
bsec_virtual_sensor_t sensorList[] = {
|
||||||
BSEC_OUTPUT_IAQ, BSEC_OUTPUT_CO2_EQUIVALENT
|
BSEC_OUTPUT_IAQ, BSEC_OUTPUT_CO2_EQUIVALENT
|
||||||
};
|
};
|
||||||
|
|
||||||
iaqSensor.updateSubscription(sensorList, 1, BSEC_SAMPLE_RATE_ULP_MEASUREMENT_ON_DEMAND);
|
iaqSensor.updateSubscription(sensorList, 1, BSEC_SAMPLE_RATE_ULP_MEASUREMENT_ON_DEMAND);
|
||||||
checkIaqSensorStatus();
|
checkIaqSensorStatus();
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,8 @@ void resetCallback(GroupObject& go)
|
|||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
SerialDBG.begin(115200);
|
Serial.begin(115200);
|
||||||
ArduinoPlatform::SerialDebug = SerialDBG;
|
ArduinoPlatform::SerialDebug = Serial;
|
||||||
|
|
||||||
randomSeed(millis());
|
randomSeed(millis());
|
||||||
|
|
||||||
@ -77,16 +77,16 @@ void setup()
|
|||||||
goMin.dataPointType(DPT_Value_Temp);
|
goMin.dataPointType(DPT_Value_Temp);
|
||||||
goMax.dataPointType(DPT_Value_Temp);
|
goMax.dataPointType(DPT_Value_Temp);
|
||||||
|
|
||||||
SerialDBG.print("Timeout: ");
|
Serial.print("Timeout: ");
|
||||||
SerialDBG.println(knx.paramByte(0));
|
Serial.println(knx.paramByte(0));
|
||||||
SerialDBG.print("Zykl. senden: ");
|
Serial.print("Zykl. senden: ");
|
||||||
SerialDBG.println(knx.paramByte(1));
|
Serial.println(knx.paramByte(1));
|
||||||
SerialDBG.print("Min/Max senden: ");
|
Serial.print("Min/Max senden: ");
|
||||||
SerialDBG.println(knx.paramByte(2));
|
Serial.println(knx.paramByte(2));
|
||||||
SerialDBG.print("Aenderung senden: ");
|
Serial.print("Aenderung senden: ");
|
||||||
SerialDBG.println(knx.paramByte(3));
|
Serial.println(knx.paramByte(3));
|
||||||
SerialDBG.print("Abgleich: ");
|
Serial.print("Abgleich: ");
|
||||||
SerialDBG.println(knx.paramByte(4));
|
Serial.println(knx.paramByte(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
// pin or GPIO the programming led is connected to. Default is LED_BUILTIN
|
// pin or GPIO the programming led is connected to. Default is LED_BUILTIN
|
||||||
@ -110,4 +110,4 @@ void loop()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
measureTemp();
|
measureTemp();
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,10 @@ uint32_t cyclSend = 0;
|
|||||||
// Entry point for the example
|
// Entry point for the example
|
||||||
void setup(void)
|
void setup(void)
|
||||||
{
|
{
|
||||||
SerialDBG.begin(115200);
|
Serial.begin(115200);
|
||||||
ArduinoPlatform::SerialDebug = SerialDBG;
|
ArduinoPlatform::SerialDebug = Serial;
|
||||||
delay(5000);
|
delay(5000);
|
||||||
SerialDBG.println("start");
|
Serial.println("start");
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
WiFiManager wifiManager;
|
WiFiManager wifiManager;
|
||||||
@ -45,15 +45,15 @@ void setup(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
cyclSend = knx.paramInt(0);
|
cyclSend = knx.paramInt(0);
|
||||||
SerialDBG.print("Zykl. send:");
|
Serial.print("Zykl. send:");
|
||||||
SerialDBG.println(cyclSend);
|
Serial.println(cyclSend);
|
||||||
}
|
}
|
||||||
|
|
||||||
// start the framework.
|
// start the framework.
|
||||||
knx.start();
|
knx.start();
|
||||||
|
|
||||||
String output = "Timestamp [ms], temperature [°C], relative humidity [%]";
|
String output = "Timestamp [ms], temperature [°C], relative humidity [%]";
|
||||||
SerialDBG.println(output);
|
Serial.println(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ void loop(void)
|
|||||||
String output = String(millis());
|
String output = String(millis());
|
||||||
output += ", " + String(temp);
|
output += ", " + String(temp);
|
||||||
output += ", " + String(humi);
|
output += ", " + String(humi);
|
||||||
SerialDBG.println(output);
|
Serial.println(output);
|
||||||
|
|
||||||
if (sendCounter++ == cyclSend)
|
if (sendCounter++ == cyclSend)
|
||||||
{
|
{
|
||||||
|
@ -24,8 +24,8 @@ void switchCallback(GroupObject& go)
|
|||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
SerialDBG.begin(115200);
|
Serial.begin(115200);
|
||||||
ArduinoPlatform::SerialDebug = SerialDBG;
|
ArduinoPlatform::SerialDebug = Serial;
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
WiFiManager wifiManager;
|
WiFiManager wifiManager;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
Stream& ArduinoPlatform::SerialDebug = Serial;
|
Stream& ArduinoPlatform::SerialDebug = Serial;
|
||||||
|
|
||||||
ArduinoPlatform::ArduinoPlatform(HardwareSerial& knxSerial) : _knxSerial(knxSerial)
|
ArduinoPlatform::ArduinoPlatform(HardwareSerial* knxSerial) : _knxSerial(knxSerial)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,19 +68,21 @@ int ArduinoPlatform::readBytes(uint8_t * buffer, uint16_t maxLen)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArduinoPlatform::knxUart( HardwareSerial& serial )
|
void ArduinoPlatform::knxUart( HardwareSerial* serial )
|
||||||
{
|
{
|
||||||
|
closeUart();
|
||||||
_knxSerial = serial;
|
_knxSerial = serial;
|
||||||
|
setupUart();
|
||||||
}
|
}
|
||||||
|
|
||||||
HardwareSerial& ArduinoPlatform::knxUart()
|
HardwareSerial* ArduinoPlatform::knxUart()
|
||||||
{
|
{
|
||||||
return _knxSerial;
|
return _knxSerial;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArduinoPlatform::setupUart()
|
void ArduinoPlatform::setupUart()
|
||||||
{
|
{
|
||||||
_knxSerial.begin(19200, SERIAL_8E1);
|
_knxSerial->begin(19200, SERIAL_8E1);
|
||||||
while (!_knxSerial)
|
while (!_knxSerial)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -88,33 +90,33 @@ void ArduinoPlatform::setupUart()
|
|||||||
|
|
||||||
void ArduinoPlatform::closeUart()
|
void ArduinoPlatform::closeUart()
|
||||||
{
|
{
|
||||||
_knxSerial.end();
|
_knxSerial->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ArduinoPlatform::uartAvailable()
|
int ArduinoPlatform::uartAvailable()
|
||||||
{
|
{
|
||||||
return _knxSerial.available();
|
return _knxSerial->available();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t ArduinoPlatform::writeUart(const uint8_t data)
|
size_t ArduinoPlatform::writeUart(const uint8_t data)
|
||||||
{
|
{
|
||||||
//printHex("<p", &data, 1);
|
//printHex("<p", &data, 1);
|
||||||
return _knxSerial.write(data);
|
return _knxSerial->write(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t ArduinoPlatform::writeUart(const uint8_t *buffer, size_t size)
|
size_t ArduinoPlatform::writeUart(const uint8_t *buffer, size_t size)
|
||||||
{
|
{
|
||||||
//printHex("<p", buffer, size);
|
//printHex("<p", buffer, size);
|
||||||
return _knxSerial.write(buffer, size);
|
return _knxSerial->write(buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ArduinoPlatform::readUart()
|
int ArduinoPlatform::readUart()
|
||||||
{
|
{
|
||||||
int val = _knxSerial.read();
|
int val = _knxSerial->read();
|
||||||
//if(val > 0)
|
//if(val > 0)
|
||||||
// printHex("p>", (uint8_t*)&val, 1);
|
// printHex("p>", (uint8_t*)&val, 1);
|
||||||
return val;
|
return val;
|
||||||
@ -127,7 +129,7 @@ size_t ArduinoPlatform::readBytesUart(uint8_t *buffer, size_t length)
|
|||||||
uint8_t* pos = buffer;
|
uint8_t* pos = buffer;
|
||||||
while (toRead > 0)
|
while (toRead > 0)
|
||||||
{
|
{
|
||||||
size_t val = _knxSerial.readBytes(pos, toRead);
|
size_t val = _knxSerial->readBytes(pos, toRead);
|
||||||
pos += val;
|
pos += val;
|
||||||
toRead -= val;
|
toRead -= val;
|
||||||
}
|
}
|
||||||
@ -267,4 +269,4 @@ void println(double num)
|
|||||||
void println(void)
|
void println(void)
|
||||||
{
|
{
|
||||||
ArduinoPlatform::SerialDebug.println();
|
ArduinoPlatform::SerialDebug.println();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ extern Stream& _serialDBG;
|
|||||||
class ArduinoPlatform : public Platform
|
class ArduinoPlatform : public Platform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ArduinoPlatform(HardwareSerial& knxSerial);
|
ArduinoPlatform(HardwareSerial* knxSerial);
|
||||||
|
|
||||||
// ip stuff
|
// ip stuff
|
||||||
uint32_t currentIpAddress();
|
uint32_t currentIpAddress();
|
||||||
@ -25,8 +25,8 @@ class ArduinoPlatform : public Platform
|
|||||||
int readBytes(uint8_t* buffer, uint16_t maxLen);
|
int readBytes(uint8_t* buffer, uint16_t maxLen);
|
||||||
|
|
||||||
//uart
|
//uart
|
||||||
virtual void knxUart( HardwareSerial& serial );
|
virtual void knxUart( HardwareSerial* serial);
|
||||||
virtual HardwareSerial& knxUart();
|
virtual HardwareSerial* knxUart();
|
||||||
virtual void setupUart();
|
virtual void setupUart();
|
||||||
virtual void closeUart();
|
virtual void closeUart();
|
||||||
virtual int uartAvailable();
|
virtual int uartAvailable();
|
||||||
@ -40,5 +40,5 @@ class ArduinoPlatform : public Platform
|
|||||||
protected:
|
protected:
|
||||||
uint32_t _mulitcastAddr;
|
uint32_t _mulitcastAddr;
|
||||||
uint16_t _mulitcastPort;
|
uint16_t _mulitcastPort;
|
||||||
HardwareSerial& _knxSerial;
|
HardwareSerial* _knxSerial;
|
||||||
};
|
};
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
#include "knx/bits.h"
|
#include "knx/bits.h"
|
||||||
|
|
||||||
Esp32Platform::Esp32Platform() : ArduinoPlatform(Serial1)
|
Esp32Platform::Esp32Platform() : ArduinoPlatform(&Serial1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Esp32Platform::Esp32Platform( HardwareSerial& s) : ArduinoPlatform(s)
|
Esp32Platform::Esp32Platform( HardwareSerial* s) : ArduinoPlatform(s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ void Esp32Platform::macAddress(uint8_t * addr)
|
|||||||
|
|
||||||
void Esp32Platform::restart()
|
void Esp32Platform::restart()
|
||||||
{
|
{
|
||||||
Serial.println("restart");
|
ArduinoPlatform::SerialDebug.println("restart");
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,4 +95,4 @@ void Esp32Platform::commitToEeprom()
|
|||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
|
|
||||||
#define SerialDBG Serial
|
|
||||||
|
|
||||||
class Esp32Platform : public ArduinoPlatform
|
class Esp32Platform : public ArduinoPlatform
|
||||||
{
|
{
|
||||||
@ -11,7 +10,7 @@ class Esp32Platform : public ArduinoPlatform
|
|||||||
using ArduinoPlatform::_mulitcastPort;
|
using ArduinoPlatform::_mulitcastPort;
|
||||||
public:
|
public:
|
||||||
Esp32Platform();
|
Esp32Platform();
|
||||||
Esp32Platform( HardwareSerial& s);
|
Esp32Platform( HardwareSerial* s);
|
||||||
|
|
||||||
// ip stuff
|
// ip stuff
|
||||||
uint32_t currentIpAddress() override;
|
uint32_t currentIpAddress() override;
|
||||||
@ -35,4 +34,4 @@ private:
|
|||||||
WiFiUDP _udp;
|
WiFiUDP _udp;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
#include "knx/bits.h"
|
#include "knx/bits.h"
|
||||||
|
|
||||||
EspPlatform::EspPlatform() : ArduinoPlatform(Serial)
|
EspPlatform::EspPlatform() : ArduinoPlatform(&Serial)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
EspPlatform::EspPlatform( HardwareSerial& s) : ArduinoPlatform(s)
|
EspPlatform::EspPlatform( HardwareSerial* s) : ArduinoPlatform(s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ void EspPlatform::macAddress(uint8_t * addr)
|
|||||||
|
|
||||||
void EspPlatform::restart()
|
void EspPlatform::restart()
|
||||||
{
|
{
|
||||||
Serial.println("restart");
|
ArduinoPlatform::SerialDebug.println("restart");
|
||||||
ESP.reset();
|
ESP.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
|
|
||||||
#define SerialDBG Serial
|
|
||||||
|
|
||||||
class EspPlatform : public ArduinoPlatform
|
class EspPlatform : public ArduinoPlatform
|
||||||
{
|
{
|
||||||
@ -12,7 +11,7 @@ class EspPlatform : public ArduinoPlatform
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
EspPlatform();
|
EspPlatform();
|
||||||
EspPlatform( HardwareSerial& s);
|
EspPlatform( HardwareSerial* s);
|
||||||
|
|
||||||
// ip stuff
|
// ip stuff
|
||||||
uint32_t currentIpAddress() override;
|
uint32_t currentIpAddress() override;
|
||||||
@ -36,4 +35,4 @@ private:
|
|||||||
WiFiUDP _udp;
|
WiFiUDP _udp;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -285,7 +285,7 @@
|
|||||||
#define DPT_TimePeriodHrs_Z Dpt(203, 7)
|
#define DPT_TimePeriodHrs_Z Dpt(203, 7)
|
||||||
#define DPT_UFlowRateLiter_per_h_Z Dpt(203, 11)
|
#define DPT_UFlowRateLiter_per_h_Z Dpt(203, 11)
|
||||||
#define DPT_UCountValue16_Z Dpt(203, 12)
|
#define DPT_UCountValue16_Z Dpt(203, 12)
|
||||||
#define DPT_UElCurrent?A_Z Dpt(203, 13)
|
#define DPT_UElCurrent_Z Dpt(203, 13)
|
||||||
#define DPT_PowerKW_Z Dpt(203, 14)
|
#define DPT_PowerKW_Z Dpt(203, 14)
|
||||||
#define DPT_AtmPressureAbs_Z Dpt(203, 15)
|
#define DPT_AtmPressureAbs_Z Dpt(203, 15)
|
||||||
#define DPT_PercentU16_Z Dpt(203, 17)
|
#define DPT_PercentU16_Z Dpt(203, 17)
|
||||||
@ -368,4 +368,4 @@ class Dpt
|
|||||||
unsigned short index;
|
unsigned short index;
|
||||||
bool operator==(const Dpt& other) const;
|
bool operator==(const Dpt& other) const;
|
||||||
bool operator!=(const Dpt& other) const;
|
bool operator!=(const Dpt& other) const;
|
||||||
};
|
};
|
||||||
|
@ -6,17 +6,17 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <FlashAsEEPROM.h>
|
#include <FlashAsEEPROM.h>
|
||||||
|
|
||||||
SamdPlatform::SamdPlatform() : ArduinoPlatform(Serial1)
|
SamdPlatform::SamdPlatform() : ArduinoPlatform(&Serial1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SamdPlatform::SamdPlatform( HardwareSerial& s) : ArduinoPlatform(s)
|
SamdPlatform::SamdPlatform( HardwareSerial* s) : ArduinoPlatform(s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SamdPlatform::restart()
|
void SamdPlatform::restart()
|
||||||
{
|
{
|
||||||
SerialDBG.println("restart");
|
ArduinoPlatform::SerialDebug.println("restart");
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,17 +4,15 @@
|
|||||||
|
|
||||||
#ifdef ARDUINO_ARCH_SAMD
|
#ifdef ARDUINO_ARCH_SAMD
|
||||||
|
|
||||||
#define SerialDBG SerialUSB
|
|
||||||
|
|
||||||
class SamdPlatform : public ArduinoPlatform
|
class SamdPlatform : public ArduinoPlatform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SamdPlatform();
|
SamdPlatform();
|
||||||
SamdPlatform( HardwareSerial& s);
|
SamdPlatform( HardwareSerial* s);
|
||||||
|
|
||||||
void restart();
|
void restart();
|
||||||
uint8_t* getEepromBuffer(uint16_t size);
|
uint8_t* getEepromBuffer(uint16_t size);
|
||||||
void commitToEeprom();
|
void commitToEeprom();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user