add IRremote

This commit is contained in:
Mit4el
2024-09-21 12:09:11 +03:00
parent af0f782f07
commit d63f1bb5bf
8 changed files with 448 additions and 82 deletions

View File

@@ -40,7 +40,7 @@ boolean isDigitDotCommaStr(const String& str);
String prettyBytes(size_t size); String prettyBytes(size_t size);
String uint64ToString(uint64_t input, uint8_t base = 10); String uint64ToStringIoTM(uint64_t input, uint8_t base = 10);
void cleanString(String& str); void cleanString(String& str);

View File

@@ -135,15 +135,15 @@
}, },
{ {
"path": "src/modules/virtual/Cron", "path": "src/modules/virtual/Cron",
"active": false "active": true
}, },
{ {
"path": "src/modules/virtual/DiscoveryHA", "path": "src/modules/virtual/DiscoveryHA",
"active": true "active": false
}, },
{ {
"path": "src/modules/virtual/DiscoveryHomeD", "path": "src/modules/virtual/DiscoveryHomeD",
"active": true "active": false
}, },
{ {
"path": "src/modules/virtual/GoogleSheet", "path": "src/modules/virtual/GoogleSheet",
@@ -155,19 +155,19 @@
}, },
{ {
"path": "src/modules/virtual/LogingDaily", "path": "src/modules/virtual/LogingDaily",
"active": false "active": true
}, },
{ {
"path": "src/modules/virtual/Math", "path": "src/modules/virtual/Math",
"active": false "active": true
}, },
{ {
"path": "src/modules/virtual/owmWeather", "path": "src/modules/virtual/owmWeather",
"active": false "active": true
}, },
{ {
"path": "src/modules/virtual/Ping", "path": "src/modules/virtual/Ping",
"active": false "active": true
}, },
{ {
"path": "src/modules/virtual/Timer", "path": "src/modules/virtual/Timer",
@@ -193,11 +193,11 @@
}, },
{ {
"path": "src/modules/sensors/A02Distance", "path": "src/modules/sensors/A02Distance",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/Acs712", "path": "src/modules/sensors/Acs712",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/Ads1115", "path": "src/modules/sensors/Ads1115",
@@ -205,11 +205,11 @@
}, },
{ {
"path": "src/modules/sensors/AhtXX", "path": "src/modules/sensors/AhtXX",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/AnalogAdc", "path": "src/modules/sensors/AnalogAdc",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/BH_1750", "path": "src/modules/sensors/BH_1750",
@@ -217,7 +217,7 @@
}, },
{ {
"path": "src/modules/sensors/BL0937", "path": "src/modules/sensors/BL0937",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/Ble", "path": "src/modules/sensors/Ble",
@@ -233,19 +233,19 @@
}, },
{ {
"path": "src/modules/sensors/Bme280", "path": "src/modules/sensors/Bme280",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/Bmp280", "path": "src/modules/sensors/Bmp280",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/Dht1122", "path": "src/modules/sensors/Dht1122",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/Ds18b20", "path": "src/modules/sensors/Ds18b20",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/DS2401", "path": "src/modules/sensors/DS2401",
@@ -289,7 +289,7 @@
}, },
{ {
"path": "src/modules/sensors/Impulse", "path": "src/modules/sensors/Impulse",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/Ina219", "path": "src/modules/sensors/Ina219",
@@ -317,7 +317,7 @@
}, },
{ {
"path": "src/modules/sensors/MQgas", "path": "src/modules/sensors/MQgas",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/Ntc", "path": "src/modules/sensors/Ntc",
@@ -329,7 +329,7 @@
}, },
{ {
"path": "src/modules/sensors/Pzem004t_v2", "path": "src/modules/sensors/Pzem004t_v2",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/RCswitch", "path": "src/modules/sensors/RCswitch",
@@ -337,11 +337,11 @@
}, },
{ {
"path": "src/modules/sensors/RTC", "path": "src/modules/sensors/RTC",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/S8", "path": "src/modules/sensors/S8",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/Scd40", "path": "src/modules/sensors/Scd40",
@@ -357,25 +357,25 @@
}, },
{ {
"path": "src/modules/sensors/Sht20", "path": "src/modules/sensors/Sht20",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/Sht30", "path": "src/modules/sensors/Sht30",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/Sonar", "path": "src/modules/sensors/Sonar",
"active": false "active": true
}, },
{ {
"path": "src/modules/sensors/UART", "path": "src/modules/sensors/UART",
"active": false "active": true
} }
], ],
"executive_devices": [ "executive_devices": [
{ {
"path": "src/modules/exec/AnalogBtn", "path": "src/modules/exec/AnalogBtn",
"active": false "active": true
}, },
{ {
"path": "src/modules/exec/BrokerMQTT", "path": "src/modules/exec/BrokerMQTT",
@@ -383,24 +383,24 @@
}, },
{ {
"path": "src/modules/exec/ButtonIn", "path": "src/modules/exec/ButtonIn",
"active": false
},
{
"path": "src/modules/exec/ButtonOut",
"active": false
},
{
"path": "src/modules/exec/Buzzer",
"active": false
},
{
"path": "src/modules/exec/EctoControlAdapter",
"active": true "active": true
}, },
{ {
"path": "src/modules/exec/Enconder", "path": "src/modules/exec/ButtonOut",
"active": true
},
{
"path": "src/modules/exec/Buzzer",
"active": true
},
{
"path": "src/modules/exec/EctoControlAdapter",
"active": false "active": false
}, },
{
"path": "src/modules/exec/Enconder",
"active": true
},
{ {
"path": "src/modules/exec/EspCam", "path": "src/modules/exec/EspCam",
"active": false "active": false
@@ -415,6 +415,10 @@
}, },
{ {
"path": "src/modules/exec/IoTServo", "path": "src/modules/exec/IoTServo",
"active": true
},
{
"path": "src/modules/exec/IRremote",
"active": false "active": false
}, },
{ {
@@ -423,15 +427,15 @@
}, },
{ {
"path": "src/modules/exec/Mcp23017", "path": "src/modules/exec/Mcp23017",
"active": false "active": true
}, },
{ {
"path": "src/modules/exec/Mp3", "path": "src/modules/exec/Mp3",
"active": false "active": true
}, },
{ {
"path": "src/modules/exec/Multitouch", "path": "src/modules/exec/Multitouch",
"active": false "active": true
}, },
{ {
"path": "src/modules/exec/MySensors", "path": "src/modules/exec/MySensors",
@@ -439,15 +443,15 @@
}, },
{ {
"path": "src/modules/exec/Pcf8574", "path": "src/modules/exec/Pcf8574",
"active": false "active": true
}, },
{ {
"path": "src/modules/exec/Pwm32", "path": "src/modules/exec/Pwm32",
"active": false "active": true
}, },
{ {
"path": "src/modules/exec/Pwm8266", "path": "src/modules/exec/Pwm8266",
"active": false "active": true
}, },
{ {
"path": "src/modules/exec/SDcard", "path": "src/modules/exec/SDcard",
@@ -471,11 +475,11 @@
}, },
{ {
"path": "src/modules/exec/TelegramLT", "path": "src/modules/exec/TelegramLT",
"active": false "active": true
}, },
{ {
"path": "src/modules/exec/Telegram_v2", "path": "src/modules/exec/Telegram_v2",
"active": true "active": false
}, },
{ {
"path": "src/modules/exec/Thermostat", "path": "src/modules/exec/Thermostat",
@@ -489,11 +493,11 @@
"screens": [ "screens": [
{ {
"path": "src/modules/display/DwinI", "path": "src/modules/display/DwinI",
"active": false "active": true
}, },
{ {
"path": "src/modules/display/Lcd2004", "path": "src/modules/display/Lcd2004",
"active": false "active": true
}, },
{ {
"path": "src/modules/display/Nextion", "path": "src/modules/display/Nextion",
@@ -509,11 +513,11 @@
}, },
{ {
"path": "src/modules/display/Oled64", "path": "src/modules/display/Oled64",
"active": false "active": true
}, },
{ {
"path": "src/modules/display/Smi2_m", "path": "src/modules/display/Smi2_m",
"active": false "active": true
}, },
{ {
"path": "src/modules/display/TM16XX", "path": "src/modules/display/TM16XX",

View File

@@ -722,16 +722,69 @@ build_src_filter =
[env:esp32_4mb3f_fromitems] [env:esp32_4mb3f_fromitems]
lib_deps = lib_deps =
gyverlibs/FastBot https://github.com/enjoyneering/AHTxx.git
adafruit/Adafruit BME280 Library
adafruit/Adafruit BMP280 Library
beegee-tokyo/DHT sensor library for ESPx
https://github.com/milesburton/Arduino-Temperature-Control-Library
robtillaart/SHT2x@^0.1.1
WEMOS SHT3x@1.0.0
plerup/EspSoftwareSerial
gyverlibs/EncButton @ ^2.0
https://github.com/RoboticsBrno/ServoESP32#v1.0.3
adafruit/Adafruit MCP23017 Arduino Library@^2.1.0
adafruit/Adafruit BusIO @ ^1.13.2
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
adafruit/Adafruit BusIO @ ^1.13.2
plerup/EspSoftwareSerial
https://github.com/robotclass/RobotClass_LiquidCrystal_I2C
marcoschwartz/LiquidCrystal_I2C@^1.1.4
https://github.com/stblassitude/Adafruit_SSD1306_Wemos_OLED
https://github.com/adafruit/Adafruit-GFX-Library
build_src_filter = build_src_filter =
+<modules/virtual/DiscoveryHA> +<modules/virtual/Cron>
+<modules/virtual/DiscoveryHomeD>
+<modules/virtual/Loging> +<modules/virtual/Loging>
+<modules/virtual/LogingDaily>
+<modules/virtual/Math>
+<modules/virtual/owmWeather>
+<modules/virtual/Ping>
+<modules/virtual/Timer> +<modules/virtual/Timer>
+<modules/virtual/Variable> +<modules/virtual/Variable>
+<modules/virtual/VButton> +<modules/virtual/VButton>
+<modules/exec/EctoControlAdapter> +<modules/sensors/A02Distance>
+<modules/exec/Telegram_v2> +<modules/sensors/Acs712>
+<modules/sensors/AhtXX>
+<modules/sensors/AnalogAdc>
+<modules/sensors/BL0937>
+<modules/sensors/Bme280>
+<modules/sensors/Bmp280>
+<modules/sensors/Dht1122>
+<modules/sensors/Ds18b20>
+<modules/sensors/Impulse>
+<modules/sensors/MQgas>
+<modules/sensors/Pzem004t_v2>
+<modules/sensors/RTC>
+<modules/sensors/S8>
+<modules/sensors/Sht20>
+<modules/sensors/Sht30>
+<modules/sensors/Sonar>
+<modules/sensors/UART>
+<modules/exec/AnalogBtn>
+<modules/exec/ButtonIn>
+<modules/exec/ButtonOut>
+<modules/exec/Buzzer>
+<modules/exec/Enconder>
+<modules/exec/IoTServo>
+<modules/exec/Mcp23017>
+<modules/exec/Mp3>
+<modules/exec/Multitouch>
+<modules/exec/Pcf8574>
+<modules/exec/Pwm32>
+<modules/exec/TelegramLT>
+<modules/display/DwinI>
+<modules/display/Lcd2004>
+<modules/display/Oled64>
+<modules/display/Smi2_m>
[env:esp32cam_4mb_fromitems] [env:esp32cam_4mb_fromitems]
lib_deps = lib_deps =

View File

@@ -0,0 +1,215 @@
#include "Global.h"
#include "classes/IoTItem.h"
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRac.h>
#include <IRutils.h>
IRac* ac;
const uint16_t kIrLed = 4; // The ESP GPIO pin to use that controls the IR LED.
class IRremote : public IoTItem {
private:
String _set_id; // заданная температура
//float pv_last = 0; // предыдущая температура
//float sp, pv, pv2;
//String interim;
int enable = 1;
float _tmp;
int _prot; // протокол
int _pinTx; // Выход модуля передатчика
public:
IRremote(String parameters): IoTItem(parameters) {
jsonRead(parameters, "pinTx", _pinTx); //передатчик
jsonRead(parameters, "prot", _prot); // используемый протокол
jsonRead(parameters, "set_id", _set_id); // id установленной температуры
if (_pinTx >= 0) {
IoTgpio.pinMode(_pinTx, OUTPUT);
IoTgpio.digitalWrite(_pinTx, false); }
// Set up what we want to send.
// See state_t, opmode_t, fanspeed_t, swingv_t, & swingh_t in IRsend.h for
// all the various options.
ac = new IRac(kIrLed);
ac->next.protocol = (decode_type_t)_prot;
ac->next.model = 1; // Некоторые кондиционеры имеют разные модели. Попробуйте только первое.
ac->next.mode = stdAc::opmode_t::kCool; // Сначала запустите в прохладном режиме.
ac->next.celsius = true; // Используйте градусы Цельсия в качестве единиц измерения температуры. Ложь = Фаренгейт
ac->next.degrees = 20; // 20 degrees.
ac->next.fanspeed = stdAc::fanspeed_t::kMedium; // Запустите вентилятор на средней скорости.
ac->next.swingv = stdAc::swingv_t::kOff; // Не поворачивайте вентилятор вверх или вниз.
ac->next.swingh = stdAc::swingh_t::kOff; // Не поворачивайте вентилятор влево или вправо.
ac->next.light = false; // Выключите все светодиоды/световые приборы/дисплеи, которые сможем.
ac->next.beep = false; // Если есть возможность, выключите все звуковые сигналы кондиционера.
ac->next.econo = false; // Turn off any economy modes if we can.
ac->next.filter = false; // Turn off any Ion/Mold/Health filters if we can.
ac->next.turbo = false; // Don't use any turbo/powerful/etc modes.
ac->next.quiet = false; // Don't use any quiet/silent/etc modes.
ac->next.sleep = -1; // Don't set any sleep time or modes.
ac->next.clean = false; // Turn off any Cleaning options if we can.
ac->next.clock = -1; // Don't set any current time if we can avoid it.
ac->next.power = false; // Initially start with the unit off.
Serial.println("Try to turn on & off every supported A/C type ...");
}
void doByInterval() {
// pv_last = pv;
}
IoTValue execute(String command, std::vector<IoTValue> &param) {
if (command == "on") {
ac->next.power = true; // Типа команда включить
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC on ");
}
if (command == "off") {
ac->next.power = false;
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC off ");
}
if (command == "cool") {
ac->next.mode = stdAc::opmode_t::kCool;
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC cool ");
}
if (command == "heat") {
ac->next.mode = stdAc::opmode_t::kHeat;
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC heat ");
}
if (command == "dry") {
ac->next.mode = stdAc::opmode_t::kDry;
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC dry ");
}
if (command == "auto") {
ac->next.fanspeed = stdAc::fanspeed_t::kAuto;
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC speed1 ");
}
if (command == "speedmin") {
ac->next.fanspeed = stdAc::fanspeed_t::kMin;
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC speed min ");
}
if (command == "speedlow") {
ac->next.fanspeed = stdAc::fanspeed_t::kLow;
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC speed low ");
}
if (command == "speedmed") {
ac->next.fanspeed = stdAc::fanspeed_t::kMedium; // Надо выбрать под конкретный кондиционер из 6-ти вариантов
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC speed medium ");
}
if (command == "speedhigh") {
ac->next.fanspeed = stdAc::fanspeed_t::kHigh; // Надо выбрать под конкретный кондиционер из 6-ти вариантов
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC speed high");
}
if (command == "speedmax") {
ac->next.fanspeed = stdAc::fanspeed_t::kMax; // Надо выбрать под конкретный кондиционер из 6-ти вариантов
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC speed max");
}
if (command == "speedmh") {
ac->next.fanspeed = stdAc::fanspeed_t::kMediumHigh; // Надо выбрать под конкретный кондиционер из 6-ти вариантов
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC speed mh");
}
//setTemp acc.setTemp(val)
if (command == "setTemp") {
// заданная температура
IoTItem *tmp = findIoTItem(_set_id);
if (tmp)
{
//interim = tmp->getValue();
_tmp = ::atof(tmp->getValue().c_str());
ac->next.degrees = _tmp; // set Temp 17 C - 30 C.
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC set temp -> " + String(_tmp) );
}
else
{
// если не заполнены настройки кондиционера
setValue("ошибка настройки кондиционера");
}
//ac->next.degrees = _tmp; // set Temp 17 C - 30 C.
//ac->sendAc(); // Send the message.
}
//ac->next.swingv = stdAc::swingv_t::kOff;
if (command == "swing") {
ac->next.swingv = stdAc::swingv_t::kMiddle;; // Надо выбрать под конкретный кондиционер из 6-ти вариантов
ac->sendAc(); // Send the message.
SerialPrint("i", F("IRremote"), "Ballu AC swing middle");
}
return {}; // команда поддерживает возвращаемое значения. Т.е. по итогу выполнения команды или общения с внешней системой, можно вернуть значение в сценарий для дальнейшей обработки
}
~IRremote() {};
};
void* getAPI_IRremote(String subtype, String param) {
if (subtype == F("IRremote")) {
return new IRremote(param);
} else {
return nullptr;
}
}

View File

@@ -0,0 +1,94 @@
{
"menuSection": "executive_devices",
"configItem": [{
"global": 0,
"name": "Управление кондиционером",
"type": "Reading",
"subtype": "IRremote",
"id": "ir",
"pinTx": 4,
"set_id": "",
"int": 1,
"prot": 15
}],
"about": {
"authorName": "Serghei Crasnicov",
"authorContact": "https://t.me/Serghei63",
"authorGit": "https://github.com/Serghei63",
"specialThanks": "Mikhail Bubnov https://t.me/Mit4bmw , Олег Астахов https://t.me/Threedreality , Valentin Khandriga @Valiuhaaa",
"moduleName": "IRremote",
"moduleVersion": "2.0",
"usedRam": {
"esp32_4mb": 15,
"esp8266_4mb": 15
},
"title": "Эмулятор IR пульта",
"moduleDesc": "Позволяет управлять кондиционером и другой техникой по IR каналу",
"propInfo": {
"pinTx": "GPIO номер, к которому подключен инфракрасный приемник.",
"prot": " Цифровой код протокола . UNKNOWN = -1, UNUSED = 0, COOLIX - 15, SAMSUNG_AC - 46 ....",
"set_id": "id установленной температуры"
},
"funcInfo": [
{
"name": "on",
"descr": "Включить конциционер",
"params": []
},
{
"name": "off",
"descr": "Выключить конциционер",
"params": []
},
{
"name": "cool",
"descr": "Режим охлаждения",
"params": []
},
{
"name": "heat",
"descr": "Режим нагрева",
"params": []
},
{
"name": "dry",
"descr": "Режим осушения",
"params": []
},
{
"name": "speed1",
"descr": "Медленная скорость вентилятора",
"params": []
},
{
"name": "speed2",
"descr": "Средняя скорость вентилятора",
"params": []
},
{
"name": "speed3",
"descr": "Максимальная скорость вентилятора",
"params": []
},
{
"name": "setTemp",
"descr": "Установленная температура",
"params": []
}
]
},
"defActive": false,
"usedLibs": {
"esp32*": [
"https://github.com/crankyoldgit/IRremoteESP8266"
],
"esp82*": [
"https://github.com/crankyoldgit/IRremoteESP8266"
]
}
}

View File

@@ -19,21 +19,21 @@ class Telegram : public IoTItem {
msg = deleteBeforeDelimiter(msg, "_"); msg = deleteBeforeDelimiter(msg, "_");
generateOrder(selectToMarker(msg, "_"), selectToMarkerLast(msg, "_")); generateOrder(selectToMarker(msg, "_"), selectToMarkerLast(msg, "_"));
_myBot.sendMessage(_chatID, "order done"); _myBot.sendMessage(_chatID, "order done");
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToString(_chatID) + ", msg: " + String(msg)); SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToStringIoTM(_chatID) + ", msg: " + String(msg));
} else if (msg.indexOf("get") != -1) { } else if (msg.indexOf("get") != -1) {
msg = deleteBeforeDelimiter(msg, "_"); msg = deleteBeforeDelimiter(msg, "_");
IoTItem* item = findIoTItem(msg); IoTItem* item = findIoTItem(msg);
if (item) { if (item) {
_myBot.sendMessage(_chatID, item->getValue()); _myBot.sendMessage(_chatID, item->getValue());
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToString(_chatID) + ", msg: " + String(msg)); SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToStringIoTM(_chatID) + ", msg: " + String(msg));
} }
} else if (msg.indexOf("all") != -1) { } else if (msg.indexOf("all") != -1) {
String list = returnListOfParams(); String list = returnListOfParams();
_myBot.sendMessage(_chatID, list); _myBot.sendMessage(_chatID, list);
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToString(_chatID) + "\n" + list); SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToStringIoTM(_chatID) + "\n" + list);
} else if (msg.indexOf("help") != -1) { } else if (msg.indexOf("help") != -1) {
_myBot.sendMessage(_chatID, "ID: " + chipId); _myBot.sendMessage(_chatID, "ID: " + chipId);
_myBot.sendMessage(_chatID, "chatID: " + uint64ToString(_chatID)); _myBot.sendMessage(_chatID, "chatID: " + uint64ToStringIoTM(_chatID));
_myBot.sendMessage(_chatID, F("Wrong order, use /all to get all values, /get_id to get value, or /set_id_value to set value")); _myBot.sendMessage(_chatID, F("Wrong order, use /all to get all values, /get_id to get value, or /set_id_value to set value"));
} else { } else {
setValue(msg); setValue(msg);
@@ -70,7 +70,7 @@ class Telegram : public IoTItem {
if (_receiveMsg) { if (_receiveMsg) {
TBMessage msg; TBMessage msg;
if (_myBot.getNewMessage(msg)) { if (_myBot.getNewMessage(msg)) {
SerialPrint("->", F("Telegram"), "chat ID: " + uint64ToString(msg.sender.id) + ", msg: " + msg.text); SerialPrint("->", F("Telegram"), "chat ID: " + uint64ToStringIoTM(msg.sender.id) + ", msg: " + msg.text);
if (_autos) { if (_autos) {
_chatID = msg.sender.id; _chatID = msg.sender.id;
} }
@@ -100,12 +100,12 @@ class Telegram : public IoTItem {
void sendTelegramMsg(bool often, String msg) { void sendTelegramMsg(bool often, String msg) {
if (often) { if (often) {
_myBot.sendMessage(_chatID, msg); _myBot.sendMessage(_chatID, msg);
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToString(_chatID) + ", msg: " + msg); SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToStringIoTM(_chatID) + ", msg: " + msg);
} else { } else {
if (_prevMsg != msg) { if (_prevMsg != msg) {
_prevMsg = msg; _prevMsg = msg;
_myBot.sendMessage(_chatID, msg); _myBot.sendMessage(_chatID, msg);
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToString(_chatID) + ", msg: " + msg); SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToStringIoTM(_chatID) + ", msg: " + msg);
} }
} }
} }

View File

@@ -14,14 +14,14 @@ void scanI2C() {
if (error == 0){ if (error == 0){
message += "I2C device found at address 0x"; message += "I2C device found at address 0x";
message += uint64ToString(address, 16); message += uint64ToStringIoTM(address, 16);
message += " !"; message += " !";
nDevices++; nDevices++;
} }
else if (error==4) { else if (error==4) {
message += "Unknow error at address 0x"; message += "Unknow error at address 0x";
message += uint64ToString(address, 16); message += uint64ToStringIoTM(address, 16);
} }
} }
if (nDevices == 0) if (nDevices == 0)

View File

@@ -183,7 +183,7 @@ String prettyBytes(size_t size) {
return String(size / 1024.0 / 1024.0 / 1024.0) + "GB"; return String(size / 1024.0 / 1024.0 / 1024.0) + "GB";
} }
String uint64ToString(uint64_t input, uint8_t base) { String uint64ToStringIoTM(uint64_t input, uint8_t base) {
String result = ""; String result = "";
do { do {