mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
Restrict use of HM10 driver to ESP8266 only
This commit is contained in:
parent
47ad6db686
commit
b9f8d0b104
@ -566,16 +566,10 @@
|
||||
//#define USE_IBEACON // Add support for bluetooth LE passive scan of ibeacon devices (uses HM17 module)
|
||||
//#define USE_GPS // Add support for GPS and NTP Server for becoming Stratus 1 Time Source (+3k1 code, +132 bytes RAM)
|
||||
// #define USE_FLOG // Add support for GPS logging in OTA's Flash (Experimental) (+2k9 code, +8 bytes RAM)
|
||||
#ifdef ESP8266
|
||||
// #define USE_HM10 // Add support for HM-10 as a BLE-bridge (+9k3 code)
|
||||
#endif // ESP8266
|
||||
//#define USE_HM10 // (ESP8266 only) Add support for HM-10 as a BLE-bridge (+9k3 code)
|
||||
//#define USE_MI_ESP32 // (ESP32 only) Add support for ESP32 as a BLE-bridge (+9k2 mem, +292k flash)
|
||||
//#define USE_HRXL // Add support for MaxBotix HRXL-MaxSonar ultrasonic range finders (+0k7)
|
||||
|
||||
// -- built-in BLE of the ESP32 --------------------
|
||||
#ifdef ESP32
|
||||
// #define USE_MI_ESP32 // Add support for ESP32 as a BLE-bridge (+9k2 mem, +292k flash)
|
||||
#endif // ESP8266
|
||||
|
||||
// -- Power monitoring sensors --------------------
|
||||
#define USE_ENERGY_MARGIN_DETECTION // Add support for Energy Margin detection (+1k6 code)
|
||||
#define USE_ENERGY_POWER_LIMIT // Add additional support for Energy Power Limit detection (+1k2 code)
|
||||
|
@ -146,7 +146,8 @@
|
||||
#define USE_RDM6300 // Add support for RDM6300 125kHz RFID Reader (+0k8)
|
||||
#define USE_IBEACON // Add support for bluetooth LE passive scan of ibeacon devices (uses HM17 module)
|
||||
//#define USE_GPS // Add support for GPS and NTP Server for becoming Stratus 1 Time Source (+ 3.1kb flash, +132 bytes RAM)
|
||||
#define USE_HM10 // Add support for HM-10 as a BLE-bridge for the LYWSD03 (+5k1 code)
|
||||
#define USE_HM10 // (ESP8266 only) Add support for HM-10 as a BLE-bridge for the LYWSD03 (+5k1 code)
|
||||
//#define USE_MI_ESP32 // (ESP32 only) Add support for ESP32 as a BLE-bridge (+9k2 mem, +292k flash)
|
||||
#define USE_HRXL // Add support for MaxBotix HRXL-MaxSonar ultrasonic range finders (+0k7)
|
||||
|
||||
#define USE_ENERGY_SENSOR // Add energy sensors (-14k code)
|
||||
@ -367,7 +368,8 @@
|
||||
#undef USE_RDM6300 // Disable support for RDM6300 125kHz RFID Reader (+0k8)
|
||||
#undef USE_IBEACON // Disable support for bluetooth LE passive scan of ibeacon devices (uses HM17 module)
|
||||
#undef USE_GPS // Disable support for GPS and NTP Server for becoming Stratus 1 Time Source (+ 3.1kb flash, +132 bytes RAM)
|
||||
#undef USE_HM10 // Disable support for HM-10 as a BLE-bridge for the LYWSD03 (+5k1 code)
|
||||
#undef USE_HM10 // (ESP8266 only) Disable support for HM-10 as a BLE-bridge for the LYWSD03 (+5k1 code)
|
||||
#undef USE_MI_ESP32 // (ESP32 only) Disable support for ESP32 as a BLE-bridge (+9k2 mem, +292k flash)
|
||||
#undef USE_HRXL // Disable support for MaxBotix HRXL-MaxSonar ultrasonic range finders (+0k7)
|
||||
|
||||
//#define USE_DHT // Add support for DHT11, AM2301 (DHT21, DHT22, AM2302, AM2321) and SI7021 Temperature and Humidity sensor
|
||||
@ -467,7 +469,8 @@
|
||||
#undef USE_RDM6300 // Disable support for RDM6300 125kHz RFID Reader (+0k8)
|
||||
#undef USE_IBEACON // Disable support for bluetooth LE passive scan of ibeacon devices (uses HM17 module)
|
||||
#undef USE_GPS // Disable support for GPS and NTP Server for becoming Stratus 1 Time Source (+ 3.1kb flash, +132 bytes RAM)
|
||||
#undef USE_HM10 // Disable support for HM-10 as a BLE-bridge for the LYWSD03 (+5k1 code)
|
||||
#undef USE_HM10 // (ESP8266 only) Disable support for HM-10 as a BLE-bridge for the LYWSD03 (+5k1 code)
|
||||
#undef USE_MI_ESP32 // (ESP32 only) Disable support for ESP32 as a BLE-bridge (+9k2 mem, +292k flash)
|
||||
#undef USE_HRXL // Disable support for MaxBotix HRXL-MaxSonar ultrasonic range finders (+0k7)
|
||||
|
||||
//#undef USE_ENERGY_SENSOR // Disable energy sensors
|
||||
@ -589,7 +592,8 @@
|
||||
#undef USE_RDM6300 // Disable support for RDM6300 125kHz RFID Reader (+0k8)
|
||||
#undef USE_IBEACON // Disable support for bluetooth LE passive scan of ibeacon devices (uses HM17 module)
|
||||
#undef USE_GPS // Disable support for GPS and NTP Server for becoming Stratus 1 Time Source (+ 3.1kb flash, +132 bytes RAM)
|
||||
#undef USE_HM10 // Disable support for HM-10 as a BLE-bridge for the LYWSD03 (+5k1 code)
|
||||
#undef USE_HM10 // (ESP8266 only) Disable support for HM-10 as a BLE-bridge for the LYWSD03 (+5k1 code)
|
||||
#undef USE_MI_ESP32 // (ESP32 only) Disable support for ESP32 as a BLE-bridge (+9k2 mem, +292k flash)
|
||||
#undef USE_HRXL // Disable support for MaxBotix HRXL-MaxSonar ultrasonic range finders (+0k7)
|
||||
|
||||
#undef USE_ENERGY_SENSOR // Disable energy sensors
|
||||
|
@ -117,21 +117,6 @@ extern "C" void resetPins();
|
||||
#define MESSZ (MQTT_MAX_PACKET_SIZE -TOPSZ -7) // Max number of characters in JSON message string
|
||||
#endif
|
||||
|
||||
#ifdef ESP8266
|
||||
#ifndef ARDUINO_ESP8266_RELEASE
|
||||
#define ARDUINO_CORE_RELEASE "STAGE"
|
||||
#else
|
||||
#define ARDUINO_CORE_RELEASE ARDUINO_ESP8266_RELEASE
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ESP32
|
||||
#ifndef ARDUINO_ESP32_RELEASE
|
||||
#define ARDUINO_CORE_RELEASE "STAGE"
|
||||
#else
|
||||
#define ARDUINO_CORE_RELEASE ARDUINO_ESP32_RELEASE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_PWM_DIMMER_REMOTE
|
||||
#ifdef USE_PWM_DIMMER
|
||||
#ifndef USE_DEVICE_GROUPS
|
||||
@ -295,6 +280,32 @@ const char kWebColors[] PROGMEM =
|
||||
COLOR_BUTTON_TEXT "|" COLOR_BUTTON "|" COLOR_BUTTON_HOVER "|" COLOR_BUTTON_RESET "|" COLOR_BUTTON_RESET_HOVER "|" COLOR_BUTTON_SAVE "|" COLOR_BUTTON_SAVE_HOVER "|"
|
||||
COLOR_TIMER_TAB_TEXT "|" COLOR_TIMER_TAB_BACKGROUND "|" COLOR_TITLE_TEXT;
|
||||
|
||||
/*********************************************************************************************\
|
||||
* ESP8266 vs ESP32 related parameters
|
||||
\*********************************************************************************************/
|
||||
|
||||
#ifdef ESP8266
|
||||
|
||||
#ifndef ARDUINO_ESP8266_RELEASE
|
||||
#define ARDUINO_CORE_RELEASE "STAGE"
|
||||
#else
|
||||
#define ARDUINO_CORE_RELEASE ARDUINO_ESP8266_RELEASE
|
||||
#endif // ARDUINO_ESP8266_RELEASE
|
||||
|
||||
#endif // ESP8266
|
||||
|
||||
#ifdef ESP32
|
||||
|
||||
#ifndef ARDUINO_ESP32_RELEASE
|
||||
#define ARDUINO_CORE_RELEASE "STAGE"
|
||||
#else
|
||||
#define ARDUINO_CORE_RELEASE ARDUINO_ESP32_RELEASE
|
||||
#endif // ARDUINO_ESP32_RELEASE
|
||||
|
||||
#undef USE_HM10 // Disable support for HM-10 as a BLE-bridge (+9k3 code) on ESP32
|
||||
|
||||
#endif // ESP32
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Macros
|
||||
\*********************************************************************************************/
|
||||
|
@ -24,6 +24,8 @@
|
||||
forked - from arendst/tasmota - https://github.com/arendst/Tasmota
|
||||
|
||||
*/
|
||||
#ifdef ESP32 // ESP32 only. Use define USE_HM10 for ESP8266 support
|
||||
|
||||
#ifdef USE_MI_ESP32
|
||||
|
||||
#define XSNS_62 62
|
||||
@ -217,7 +219,7 @@ class MI32SensorCallback : public NimBLEClientCallbacks {
|
||||
} else if(params->supervision_timeout > 100) { /** 10ms units */
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@ -304,7 +306,7 @@ uint32_t MIBLEgetSensorSlot(uint8_t (&_serial)[6], uint16_t _type){
|
||||
}
|
||||
}
|
||||
if(!_success) return 0xff;
|
||||
|
||||
|
||||
DEBUG_SENSOR_LOG(PSTR("%s: vector size %u"),D_CMND_MI32, MIBLEsensors.size());
|
||||
for(uint32_t i=0; i<MIBLEsensors.size(); i++){
|
||||
if(memcmp(_serial,MIBLEsensors[i].serial,sizeof(_serial))==0){
|
||||
@ -400,7 +402,7 @@ void MI32ConnectActiveSensor(){ // only use inside a task !!
|
||||
MI32.mode.willConnect = 0;
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
MI32Client = NimBLEDevice::getDisconnectedClient();
|
||||
}
|
||||
@ -438,7 +440,7 @@ void MI32StartScanTask(){
|
||||
}
|
||||
|
||||
void MI32ScanTask(void *pvParameters){
|
||||
NimBLEScan* pScan = NimBLEDevice::getScan();
|
||||
NimBLEScan* pScan = NimBLEDevice::getScan();
|
||||
pScan->setAdvertisedDeviceCallbacks(&MI32ScanCallbacks);
|
||||
pScan->setActiveScan(false);
|
||||
pScan->start(5, MI32scanEndedCB); // hard coded duration
|
||||
@ -502,10 +504,10 @@ void MI32connectLYWSD03(){
|
||||
NimBLERemoteCharacteristic* pChr = nullptr;
|
||||
static BLEUUID serviceUUID("ebe0ccb0-7a0a-4b0c-8a1a-6ff2997da3a6");
|
||||
static BLEUUID charUUID("ebe0ccc1-7a0a-4b0c-8a1a-6ff2997da3a6");
|
||||
pSvc = MI32Client->getService(serviceUUID);
|
||||
pSvc = MI32Client->getService(serviceUUID);
|
||||
if(pSvc) {
|
||||
pChr = pSvc->getCharacteristic(charUUID);
|
||||
}
|
||||
}
|
||||
if(pChr->canNotify()) {
|
||||
if(!pChr->registerForNotify(MI32notifyCB)) {
|
||||
MI32.mode.willConnect = 0;
|
||||
@ -549,10 +551,10 @@ void MI32TimeTask(void *pvParameters){
|
||||
NimBLERemoteCharacteristic* pChr = nullptr;
|
||||
static BLEUUID serviceUUID("EBE0CCB0-7A0A-4B0C-8A1A-6FF2997DA3A6");
|
||||
static BLEUUID charUUID("EBE0CCB7-7A0A-4B0C-8A1A-6FF2997DA3A6");
|
||||
pSvc = MI32Client->getService(serviceUUID);
|
||||
pSvc = MI32Client->getService(serviceUUID);
|
||||
if(pSvc) {
|
||||
pChr = pSvc->getCharacteristic(charUUID);
|
||||
}
|
||||
}
|
||||
if(pChr->canWrite()) {
|
||||
union {
|
||||
uint8_t buf[5];
|
||||
@ -617,7 +619,7 @@ void MI32BatteryTask(void *pvParameters){
|
||||
case FLORA:
|
||||
MI32batteryFLORA();
|
||||
break;
|
||||
case LYWSD02:
|
||||
case LYWSD02:
|
||||
MI32batteryLYWSD02();
|
||||
break;
|
||||
case CGD1:
|
||||
@ -647,7 +649,7 @@ void MI32batteryFLORA(){
|
||||
static BLEUUID FLserviceUUID("00001204-0000-1000-8000-00805f9b34fb");
|
||||
static BLEUUID FLcharUUID("00001a02-0000-1000-8000-00805f9b34fb");
|
||||
|
||||
pSvc = MI32Client->getService(FLserviceUUID);
|
||||
pSvc = MI32Client->getService(FLserviceUUID);
|
||||
if(pSvc) { /** make sure it's not null */
|
||||
pChr = pSvc->getCharacteristic(FLcharUUID);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("%s: got Flora char %s"),D_CMND_MI32, pChr->getUUID().toString().c_str());
|
||||
@ -677,7 +679,7 @@ void MI32batteryLYWSD02(){
|
||||
static BLEUUID LY2serviceUUID("EBE0CCB0-7A0A-4B0C-8A1A-6FF2997DA3A6");
|
||||
static BLEUUID LY2charUUID("EBE0CCC4-7A0A-4B0C-8A1A-6FF2997DA3A6");
|
||||
|
||||
pSvc = MI32Client->getService(LY2serviceUUID);
|
||||
pSvc = MI32Client->getService(LY2serviceUUID);
|
||||
if(pSvc) {
|
||||
pChr = pSvc->getCharacteristic(LY2charUUID);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("%s: got LYWSD02 char %s"),D_CMND_MI32, pChr->getUUID().toString().c_str());
|
||||
@ -707,7 +709,7 @@ void MI32batteryCGD1(){
|
||||
static BLEUUID CGD1serviceUUID("180F");
|
||||
static BLEUUID CGD1charUUID("2A19");
|
||||
|
||||
pSvc = MI32Client->getService(CGD1serviceUUID);
|
||||
pSvc = MI32Client->getService(CGD1serviceUUID);
|
||||
if(pSvc) {
|
||||
pChr = pSvc->getCharacteristic(CGD1charUUID);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("%s: got CGD1 char %s"),D_CMND_MI32, pChr->getUUID().toString().c_str());
|
||||
@ -766,7 +768,7 @@ void MI32parseMiBeacon(char * _buf, uint32_t _slot){
|
||||
case 0x07:
|
||||
MIBLEsensors[_slot].lux=_beacon.lux & 0x00ffffff;
|
||||
DEBUG_SENSOR_LOG(PSTR("Mode 7: U24: %u Lux"), _beacon.lux & 0x00ffffff);
|
||||
break;
|
||||
break;
|
||||
case 0x08:
|
||||
_tempFloat =(float)_beacon.moist;
|
||||
if(_tempFloat<100){
|
||||
@ -898,7 +900,7 @@ bool MI32readBat(char *_buf){
|
||||
|
||||
/**
|
||||
* @brief Main loop of the driver, "high level"-loop
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
void MI32EverySecond(bool restart){
|
||||
@ -918,7 +920,7 @@ void MI32EverySecond(bool restart){
|
||||
if (MI32.mode.willSetTime == 0){
|
||||
MI32.mode.willSetTime = 1;
|
||||
MI32StartTask(MI32_TASK_TIME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MI32.mode.willReadBatt) return;
|
||||
@ -952,7 +954,7 @@ void MI32EverySecond(bool restart){
|
||||
else{
|
||||
MI32StartTask(MI32_TASK_CONN);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (MI32.state.sensor==MIBLEsensors.size()-1) {
|
||||
_nextSensorSlot= 0;
|
||||
@ -1079,7 +1081,7 @@ void MI32Show(bool json)
|
||||
ResponseAppend_P(PSTR(",\"Fertility\":%d"), MIBLEsensors[i].fertility);
|
||||
}
|
||||
}
|
||||
if (MIBLEsensors[i].type>FLORA){
|
||||
if (MIBLEsensors[i].type>FLORA){
|
||||
if(!isnan(MIBLEsensors[i].hum) && !isnan(MIBLEsensors[i].temp)){
|
||||
ResponseAppendTHD(MIBLEsensors[i].temp, MIBLEsensors[i].hum);
|
||||
}
|
||||
@ -1090,7 +1092,7 @@ void MI32Show(bool json)
|
||||
dtostrfd((MIBLEsensors[i].volt)/100.0f, Settings.flag2.temperature_resolution, slave); // reuse slave, borrow temperature resolution
|
||||
ResponseAppend_P(PSTR(",\"" D_VOLTAGE "\":%s"), slave);
|
||||
}
|
||||
}
|
||||
}
|
||||
ResponseAppend_P(PSTR("}"));
|
||||
}
|
||||
#ifdef USE_WEBSERVER
|
||||
@ -1111,7 +1113,7 @@ void MI32Show(bool json)
|
||||
WSContentSend_PD(HTTP_MI32, i+1,stemp,MIBLEsensors.size());
|
||||
for (i; i<j; i++) {
|
||||
WSContentSend_PD(HTTP_MI32_HL);
|
||||
WSContentSend_PD(HTTP_MI32_SERIAL, kMI32SlaveType[MIBLEsensors[i].type-1], D_MAC_ADDRESS, MIBLEsensors[i].serial[0], MIBLEsensors[i].serial[1],MIBLEsensors[i].serial[2],MIBLEsensors[i].serial[3],MIBLEsensors[i].serial[4],MIBLEsensors[i].serial[5]);
|
||||
WSContentSend_PD(HTTP_MI32_SERIAL, kMI32SlaveType[MIBLEsensors[i].type-1], D_MAC_ADDRESS, MIBLEsensors[i].serial[0], MIBLEsensors[i].serial[1],MIBLEsensors[i].serial[2],MIBLEsensors[i].serial[3],MIBLEsensors[i].serial[4],MIBLEsensors[i].serial[5]);
|
||||
if (MIBLEsensors[i].type==FLORA){
|
||||
if(!isnan(MIBLEsensors[i].temp)){
|
||||
char temperature[FLOATSZ];
|
||||
@ -1132,7 +1134,7 @@ void MI32Show(bool json)
|
||||
if(!isnan(MIBLEsensors[i].hum) && !isnan(MIBLEsensors[i].temp)){
|
||||
WSContentSend_THD(kMI32SlaveType[MIBLEsensors[i].type-1], MIBLEsensors[i].temp, MIBLEsensors[i].hum);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(MIBLEsensors[i].bat!=0x00){
|
||||
if (MIBLEsensors[i].type != LYWSD03MMC) WSContentSend_PD(HTTP_BATTERY, kMI32SlaveType[MIBLEsensors[i].type-1], MIBLEsensors[i].bat);
|
||||
else {
|
||||
@ -1164,7 +1166,7 @@ bool Xsns62(uint8_t function)
|
||||
MI32Init();
|
||||
}
|
||||
|
||||
if (MI32.mode.init) {
|
||||
if (MI32.mode.init) {
|
||||
switch (function) {
|
||||
case FUNC_EVERY_SECOND:
|
||||
MI32EverySecond(false);
|
||||
@ -1184,4 +1186,5 @@ bool Xsns62(uint8_t function)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif //USE_MI_ESP32
|
||||
#endif // USE_MI_ESP32
|
||||
#endif // ESP32
|
||||
|
@ -34,6 +34,8 @@
|
||||
forked - from arendst/tasmota - https://github.com/arendst/Tasmota
|
||||
|
||||
*/
|
||||
#ifdef ESP8266 // ESP8266 only. Use define USE_MI_ESP32 for ESP32 support
|
||||
|
||||
#ifdef USE_HM10
|
||||
|
||||
#define XSNS_62 62
|
||||
@ -250,7 +252,7 @@ void HM10_Launchtask(uint8_t task, uint8_t slot, uint8_t delay){
|
||||
|
||||
void HM10_TaskReplaceInSlot(uint8_t task, uint8_t slot){
|
||||
HM10.last_command = HM10_TASK_LIST[slot][0]; // save command
|
||||
HM10_TASK_LIST[slot][0] = task;
|
||||
HM10_TASK_LIST[slot][0] = task;
|
||||
}
|
||||
|
||||
void HM10_ReverseMAC(uint8_t _mac[]){
|
||||
@ -355,7 +357,7 @@ uint32_t MIBLEgetSensorSlot(uint8_t (&_serial)[6], uint16_t _type){
|
||||
}
|
||||
}
|
||||
if(!_success) return 0xff;
|
||||
|
||||
|
||||
DEBUG_SENSOR_LOG(PSTR("%s: vector size %u"),D_CMND_HM10, MIBLEsensors.size());
|
||||
for(uint32_t i=0; i<MIBLEsensors.size(); i++){
|
||||
if(memcmp(_serial,MIBLEsensors[i].serial,sizeof(_serial))==0){
|
||||
@ -470,7 +472,7 @@ void HM10parseMiBeacon(char * _buf, uint32_t _slot){
|
||||
case 0x07:
|
||||
MIBLEsensors[_slot].lux=_beacon.lux & 0x00ffffff;
|
||||
DEBUG_SENSOR_LOG(PSTR("Mode 7: U24: %u Lux"), _beacon.lux & 0x00ffffff);
|
||||
break;
|
||||
break;
|
||||
case 0x08:
|
||||
_tempFloat =(float)_beacon.moist;
|
||||
if(_tempFloat<100){
|
||||
@ -610,7 +612,7 @@ void HM10readHT_MJ_HT_V1(char *_buf){
|
||||
// T=22.7 H=42.2 (response as ASCII)
|
||||
// 0123456789012
|
||||
uint32_t _temp = (atoi(_buf+2) * 10) + atoi(_buf+5);
|
||||
uint32_t _hum = (atoi(_buf+9) * 10) + atoi(_buf+12);
|
||||
uint32_t _hum = (atoi(_buf+9) * 10) + atoi(_buf+12);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("%s: T * 10: %u, H * 10: %u"),D_CMND_HM10,_temp,_hum);
|
||||
uint32_t _slot = HM10.state.sensor;
|
||||
|
||||
@ -682,7 +684,7 @@ bool HM10SerialHandleFeedback(){ // every 50 milliseconds
|
||||
bool success = false;
|
||||
uint32_t i = 0;
|
||||
static char ret[HM10_MAX_RX_BUF] = {0};
|
||||
|
||||
|
||||
while(HM10Serial->available()) {
|
||||
// delay(0);
|
||||
if(i<HM10_MAX_RX_BUF){
|
||||
@ -719,7 +721,7 @@ bool HM10SerialHandleFeedback(){ // every 50 milliseconds
|
||||
break;
|
||||
case tempHumMJ:
|
||||
if (HM10.mode.connected) HM10readHT_MJ_HT_V1(ret);
|
||||
break;
|
||||
break;
|
||||
case none:
|
||||
if(success) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("%s: response: %s"),D_CMND_HM10, (char *)ret);
|
||||
@ -782,7 +784,7 @@ void HM10_TaskEvery100ms(){
|
||||
break;
|
||||
case TASK_HM10_CONN:
|
||||
char _con[20];
|
||||
sprintf_P(_con,"AT+CON%02x%02x%02x%02x%02x%02x",MIBLEsensors[HM10.state.sensor].serial[0],MIBLEsensors[HM10.state.sensor].serial[1],MIBLEsensors[HM10.state.sensor].serial[2],MIBLEsensors[HM10.state.sensor].serial[3],MIBLEsensors[HM10.state.sensor].serial[4],MIBLEsensors[HM10.state.sensor].serial[5]);
|
||||
sprintf_P(_con,"AT+CON%02x%02x%02x%02x%02x%02x",MIBLEsensors[HM10.state.sensor].serial[0],MIBLEsensors[HM10.state.sensor].serial[1],MIBLEsensors[HM10.state.sensor].serial[2],MIBLEsensors[HM10.state.sensor].serial[3],MIBLEsensors[HM10.state.sensor].serial[4],MIBLEsensors[HM10.state.sensor].serial[5]);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("%s: connect %s"),D_CMND_HM10, _con);
|
||||
HM10.current_task_delay = 2; // set task delay
|
||||
HM10_TaskReplaceInSlot(TASK_HM10_FEEDBACK,i);
|
||||
@ -964,10 +966,10 @@ void HM10_TaskEvery100ms(){
|
||||
}
|
||||
runningTaskLoop = false; // return to main loop
|
||||
HM10.mode.pending_task = 0; // back to main loop control
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -984,7 +986,7 @@ void HM10StatusInfo(){
|
||||
|
||||
/**
|
||||
* @brief Main loop of the driver, "high level"-loop
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
void HM10EverySecond(bool restart){
|
||||
@ -1182,14 +1184,14 @@ void HM10Show(bool json)
|
||||
ResponseAppend_P(PSTR(",\"Fertility\":%d"), MIBLEsensors[i].fertility);
|
||||
}
|
||||
}
|
||||
if (MIBLEsensors[i].type>FLORA){
|
||||
if (MIBLEsensors[i].type>FLORA){
|
||||
if(!isnan(MIBLEsensors[i].hum) && !isnan(MIBLEsensors[i].temp)){
|
||||
ResponseAppendTHD(MIBLEsensors[i].temp, MIBLEsensors[i].hum);
|
||||
}
|
||||
}
|
||||
if(MIBLEsensors[i].bat!=0x00){ // this is the error code -> no battery
|
||||
ResponseAppend_P(PSTR(",\"Battery\":%u"), MIBLEsensors[i].bat);
|
||||
}
|
||||
}
|
||||
ResponseAppend_P(PSTR("}"));
|
||||
}
|
||||
#ifdef USE_WEBSERVER
|
||||
@ -1210,7 +1212,7 @@ void HM10Show(bool json)
|
||||
WSContentSend_PD(HTTP_HM10, HM10.firmware, i+1,stemp,MIBLEsensors.size());
|
||||
for (i; i<j; i++) {
|
||||
WSContentSend_PD(HTTP_HM10_HL);
|
||||
WSContentSend_PD(HTTP_HM10_SERIAL, kHM10SlaveType[MIBLEsensors[i].type-1], D_MAC_ADDRESS, MIBLEsensors[i].serial[0], MIBLEsensors[i].serial[1],MIBLEsensors[i].serial[2],MIBLEsensors[i].serial[3],MIBLEsensors[i].serial[4],MIBLEsensors[i].serial[5]);
|
||||
WSContentSend_PD(HTTP_HM10_SERIAL, kHM10SlaveType[MIBLEsensors[i].type-1], D_MAC_ADDRESS, MIBLEsensors[i].serial[0], MIBLEsensors[i].serial[1],MIBLEsensors[i].serial[2],MIBLEsensors[i].serial[3],MIBLEsensors[i].serial[4],MIBLEsensors[i].serial[5]);
|
||||
if (MIBLEsensors[i].type==FLORA){
|
||||
if(!isnan(MIBLEsensors[i].temp)){
|
||||
char temperature[FLOATSZ];
|
||||
@ -1231,7 +1233,7 @@ void HM10Show(bool json)
|
||||
if(!isnan(MIBLEsensors[i].hum) && !isnan(MIBLEsensors[i].temp)){
|
||||
WSContentSend_THD(kHM10SlaveType[MIBLEsensors[i].type-1], MIBLEsensors[i].temp, MIBLEsensors[i].hum);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(MIBLEsensors[i].bat!=0x00){
|
||||
WSContentSend_PD(HTTP_BATTERY, kHM10SlaveType[MIBLEsensors[i].type-1], MIBLEsensors[i].bat);
|
||||
}
|
||||
@ -1255,7 +1257,7 @@ bool Xsns62(uint8_t function)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if ((pin[GPIO_HM10_RX] < 99) && (pin[GPIO_HM10_TX] < 99)) {
|
||||
if ((pin[GPIO_HM10_RX] < 99) && (pin[GPIO_HM10_TX] < 99)) {
|
||||
switch (function) {
|
||||
case FUNC_INIT:
|
||||
HM10SerialInit(); // init and start communication
|
||||
@ -1286,4 +1288,5 @@ bool Xsns62(uint8_t function)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif //USE_HM10
|
||||
#endif // USE_HM10
|
||||
#endif // ESP8266
|
Loading…
x
Reference in New Issue
Block a user