From 696e33a6772bb928eb93939f108dd7815319fd3f Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 9 Dec 2021 11:26:54 +0300 Subject: [PATCH 01/39] MI_HM10 added support Mi Scale 1. Added Mi Scale v1/Mi Scale v2 support via BLE advertising packets 2. Added features "scale" and "impedance" to features list --- tasmota/xsns_62_MI_HM10.ino | 246 +++++++++++++++++++++++++++++++++++- 1 file changed, 239 insertions(+), 7 deletions(-) diff --git a/tasmota/xsns_62_MI_HM10.ino b/tasmota/xsns_62_MI_HM10.ino index f9afa1d84..fcded93cd 100644 --- a/tasmota/xsns_62_MI_HM10.ino +++ b/tasmota/xsns_62_MI_HM10.ino @@ -131,6 +131,37 @@ struct cg_packet_t { uint8_t bat; }; }; + +struct MiScaleV1Packet_t { + //uint8_t size; // = 14 + //uint8_t uid; // = 0x16, 16-bit UUID + //uint16_t UUID; // = 0x181D + uint8_t status; // bit 0 lbs, 4 jin, 5, stabilized, 7, weight removed + uint16_t weight; + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hour; + uint8_t minute; + uint8_t second; +}; + +struct MiScaleV2Packet_t { + //uint8_t size; // = 17 + //uint8_t uid; // = 0x16, 16-bit UUID + //uint16_t UUID; // = 0x181B + uint8_t weight_unit; + uint8_t status; + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hour; + uint8_t minute; + uint8_t second; + uint16_t impedance; + uint16_t weight; +}; + #pragma pack(0) struct scan_entry_t { @@ -175,6 +206,8 @@ struct mi_sensor_t{ uint32_t NMT:1; uint32_t PIR:1; uint32_t Btn:1; + uint32_t scale:1; + uint32_t impedance:1; }; uint32_t raw; } feature; @@ -191,6 +224,7 @@ struct mi_sensor_t{ uint32_t motion:1; uint32_t noMotion:1; uint32_t Btn:1; + uint32_t scale:1; }; uint32_t raw; } eventType; @@ -213,10 +247,46 @@ struct mi_sensor_t{ uint32_t NMT; // no motion time in seconds for the MJYD2S }; uint16_t Btn; + struct { + uint8_t has_impedance; + uint8_t impedance_stabilized; + uint8_t weight_stabilized; + uint8_t weight_removed; + char weight_unit[4]; // kg, lbs, jin or empty when unknown + float weight; + uint16_t impedance; + struct { + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hour; + uint8_t minute; + uint8_t second; + } datetime; + }; }; union { uint8_t bat; // many values seem to be hard-coded garbage (LYWSD0x, GCD1) }; +/* union { + struct { + uint8_t has_impedance; + uint8_t impedance_stabilized; + uint8_t weight_stabilized; + uint8_t weight_removed; + char weight_unit[4]; // kg, lbs, jin or empty when unknown + float weight; + uint16_t impedance; + struct { + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hour; + uint8_t minute; + uint8_t second; + } datetime; + }; + } scale;*/ }; struct { @@ -284,6 +354,12 @@ const char S_JSON_HM10_COMMAND[] PROGMEM = "{\"" D_CMND_HM10 "%s%s\"}"; const char kHM10_Commands[] PROGMEM = D_CMND_HM10"|" "Scan|AT|Period|Baud|Time|Auto|Page|Beacon|Block|Option"; +const char HTTP_MISCALE_WEIGHT[] PROGMEM = "{s}%s" " Weight" "{m}%*_f %s{e}"; +const char HTTP_MISCALE_IMPEDANCE[] PROGMEM = "{s}%s" " Impedance" "{m}%u{e}"; +const char HTTP_MISCALE_WEIGHT_REMOVED[] PROGMEM = "{s}%s" " Weight removed" "{m}%s{e}"; +const char HTTP_MISCALE_STABILIZED[] PROGMEM = "{s}%s" " Stabilized" "{m}%s{e}"; + + void (*const HM10_Commands[])(void) PROGMEM = { &CmndHM10Scan, &CmndHM10AT, &CmndHM10Period, &CmndHM10Baud, &CmndHM10Time, &CmndHM10Auto, &CmndHM10Page, &CmndHM10Beacon, &CmndHM10Block, &CmndHM10Option }; @@ -299,8 +375,10 @@ void (*const HM10_Commands[])(void) PROGMEM = { &CmndHM10Scan, &CmndHM10AT, &Cmn #define MHOC401 10 #define MHOC303 11 #define ATC 12 +#define MI_SCALE_V1 13 +#define MI_SCALE_V2 14 -#define HM10_TYPES 12 //count this manually +#define HM10_TYPES 14 //count this manually const uint16_t kHM10SlaveID[HM10_TYPES]={ 0x0098, // Flora @@ -314,7 +392,9 @@ const uint16_t kHM10SlaveID[HM10_TYPES]={ 0x0153, // yee-rc 0x0387, // MHO-C401 0x06d3, // MHO-C303 - 0x0a1c // ATC -> this is a fake ID + 0x0a1c, // ATC -> this is a fake ID + 0x181d, // Mi Scale V1 + 0x181b // Mi Scale V2 }; const char kHM10DeviceType1[] PROGMEM = "Flora"; @@ -329,8 +409,10 @@ const char kHM10DeviceType9[] PROGMEM = "YEERC"; const char kHM10DeviceType10[] PROGMEM ="MHOC401"; const char kHM10DeviceType11[] PROGMEM ="MHOC303"; const char kHM10DeviceType12[] PROGMEM ="ATC"; +const char kHM10DeviceType13[] PROGMEM ="MISCALEV1"; +const char kHM10DeviceType14[] PROGMEM ="MISCALEV2"; -const char * kHM10DeviceType[] PROGMEM = {kHM10DeviceType1,kHM10DeviceType2,kHM10DeviceType3,kHM10DeviceType4,kHM10DeviceType5,kHM10DeviceType6,kHM10DeviceType7,kHM10DeviceType8,kHM10DeviceType9,kHM10DeviceType10,kHM10DeviceType11,kHM10DeviceType12}; +const char * kHM10DeviceType[] PROGMEM = {kHM10DeviceType1,kHM10DeviceType2,kHM10DeviceType3,kHM10DeviceType4,kHM10DeviceType5,kHM10DeviceType6,kHM10DeviceType7,kHM10DeviceType8,kHM10DeviceType9,kHM10DeviceType10,kHM10DeviceType11,kHM10DeviceType12,kHM10DeviceType13,kHM10DeviceType14}; /*********************************************************************************************\ * enumerations @@ -599,6 +681,13 @@ uint32_t MIBLEgetSensorSlot(uint8_t (&_MAC)[6], uint16_t _type, int _rssi){ case YEERC: _newSensor.feature.Btn=1; break; + case MI_SCALE_V1: + _newSensor.feature.scale=1; + break; + case MI_SCALE_V2: + _newSensor.feature.scale=1; + _newSensor.feature.impedance=1; + break; default: _newSensor.hum=NAN; _newSensor.feature.temp=1; @@ -804,6 +893,102 @@ void HM10parseCGD1Packet(char * _buf, uint32_t _slot){ // no MiBeacon if(HM10.option.directBridgeMode) HM10.mode.shallTriggerTele = 1; } +void HM10ParseMiScalePacket(char * _buf, uint32_t _slot, uint16_t _type){ +//void MI32ParseMiScalePacket(const uint8_t * _buf, uint32_t length, const uint8_t *addr, int RSSI, int UUID){ + MiScaleV1Packet_t *_packetV1 = (MiScaleV1Packet_t*)_buf; + MiScaleV2Packet_t *_packetV2 = (MiScaleV2Packet_t*)_buf; + + // Mi Scale V1 + if (_type == 0x181d){ // 14-1-1-2 + + if ((_slot >= 0) && (_slot < MIBLEsensors.size())){ + DEBUG_SENSOR_LOG(PSTR("HM10: %s: at slot %u"), kHM10DeviceType[MIBLEsensors[_slot].type-1],_slot); + + MIBLEsensors[_slot].eventType.scale = 1; + + MIBLEsensors[_slot].weight_stabilized = (_packetV1->status & (1 << 5)) ? 1 : 0; + MIBLEsensors[_slot].weight_removed = (_packetV1->status & (1 << 7)) ? 1 : 0; + + if (_packetV1->status & (1 << 0)) { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("lbs")); + MIBLEsensors[_slot].weight = (float)_packetV1->weight / 100.0f; + } else if(_packetV1->status & (1 << 4)) { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("jin")); + MIBLEsensors[_slot].weight = (float)_packetV1->weight / 100.0f; + } else { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("kg")); + MIBLEsensors[_slot].weight = (float)_packetV1->weight / 200.0f; + } + + if (MIBLEsensors[_slot].weight_removed) { + MIBLEsensors[_slot].weight = 0.0f; + } + // Can be changed to memcpy or smthng else ? + MIBLEsensors[_slot].datetime.year = _packetV2->year; + MIBLEsensors[_slot].datetime.month = _packetV2->month; + MIBLEsensors[_slot].datetime.day = _packetV2->day; + MIBLEsensors[_slot].datetime.hour = _packetV2->hour; + MIBLEsensors[_slot].datetime.minute = _packetV2->minute; + MIBLEsensors[_slot].datetime.second = _packetV2->second; + + MIBLEsensors[_slot].shallSendMQTT = 1; + bool triggerTele = MIBLEsensors[_slot].weight_stabilized && ! MIBLEsensors[_slot].weight_removed && MIBLEsensors[_slot].weight > 0; + + if(HM10.option.directBridgeMode || triggerTele) HM10.mode.shallTriggerTele = 1; + } + } + + // Mi Scale V2 + else if (_type == 0x181b){ // 17-1-1-2 + + if ((_slot >= 0) && (_slot < MIBLEsensors.size())){ + DEBUG_SENSOR_LOG(PSTR("HM10: %s: at slot %u"), kHM10DeviceType[MIBLEsensors[_slot].type-1],_slot); + + MIBLEsensors[_slot].eventType.scale = 1; + + MIBLEsensors[_slot].has_impedance = (_packetV2->status & (1 << 1)) ? 1 : 0; + MIBLEsensors[_slot].weight_stabilized = (_packetV2->status & (1 << 5)) ? 1 : 0; + MIBLEsensors[_slot].impedance_stabilized = (_packetV2->status & (1 << 1)) ? 1 : 0; + MIBLEsensors[_slot].weight_removed = (_packetV2->status & (1 << 7)) ? 1 : 0; + + if (_packetV2->weight_unit & (1 << 4)) { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("jin")); + MIBLEsensors[_slot].weight = (float)_packetV2->weight / 100.0f; + } else if(_packetV2->weight_unit == 3) { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("lbs")); + MIBLEsensors[_slot].weight = (float)_packetV2->weight / 100.0f; + } else if(_packetV2->weight_unit == 2) { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("kg")); + MIBLEsensors[_slot].weight = (float)_packetV2->weight / 200.0f; + } else { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("")); + MIBLEsensors[_slot].weight = (float)_packetV2->weight / 100.0f; + } + + if (MIBLEsensors[_slot].weight_removed) { + MIBLEsensors[_slot].weight = 0.0f; + MIBLEsensors[_slot].impedance = 0; + } + else if (MIBLEsensors[_slot].has_impedance) { + MIBLEsensors[_slot].impedance = _packetV2->impedance; + } + // Can be changed to memcpy or smthng else ? + MIBLEsensors[_slot].datetime.year = _packetV2->year; + MIBLEsensors[_slot].datetime.month = _packetV2->month; + MIBLEsensors[_slot].datetime.day = _packetV2->day; + MIBLEsensors[_slot].datetime.hour = _packetV2->hour; + MIBLEsensors[_slot].datetime.minute = _packetV2->minute; + MIBLEsensors[_slot].datetime.second = _packetV2->second; + + MIBLEsensors[_slot].shallSendMQTT = 1; + + bool triggerTele = MIBLEsensors[_slot].weight_stabilized && ! MIBLEsensors[_slot].weight_removed && MIBLEsensors[_slot].weight > 0; + if(HM10.option.directBridgeMode || triggerTele) HM10.mode.shallTriggerTele = 1; + } + } +} + + void HM10ParseResponse(char *buf, uint16_t bufsize) { if (!strncmp(buf,"HMSoft",6)) { //8 const char* _fw = "000"; @@ -1168,12 +1353,15 @@ bool HM10SerialHandleFeedback(){ // every 50 milliseconds } uint16_t _type = (uint8_t)HM10.rxAdvertisement.svcData[5]*256 + (uint8_t)HM10.rxAdvertisement.svcData[4]; // AddLog(LOG_LEVEL_DEBUG, PSTR("%04x %02x %04x %04x %04x"),HM10.rxAdvertisement.UUID,HM10.rxAdvertisement.TX,HM10.rxAdvertisement.CID,HM10.rxAdvertisement.SVC, _type); + DEBUG_SENSOR_LOG(PSTR("HM10: UUID %04x, TX: %02x, CID: %04x, SVC: %04x"), HM10.rxAdvertisement.UUID,HM10.rxAdvertisement.TX,HM10.rxAdvertisement.CID,HM10.rxAdvertisement.SVC); if(HM10.rxAdvertisement.SVC==0x181a) _type = 0xa1c; else if(HM10.rxAdvertisement.SVC==0xfdcd) _type = 0x0576; + else if(HM10.rxAdvertisement.SVC==0x181b || HM10.rxAdvertisement.SVC==0x181d) _type = 0x181b; uint16_t _slot = MIBLEgetSensorSlot(HM10.rxAdvertisement.MAC, _type, HM10.rxAdvertisement.RSSI); if(_slot!=0xff){ if (_type==0xa1c) HM10parseATC((char*)HM10.rxAdvertisement.svcData+2,_slot); else if (_type==0x0576) HM10parseCGD1Packet((char*)HM10.rxAdvertisement.svcData+2,_slot); + else if (_type==0x181b) HM10ParseMiScalePacket((char*)HM10.rxAdvertisement.svcData+2,_slot, _type); else HM10parseMiBeacon((char*)HM10.rxAdvertisement.svcData+2,_slot); } else{ @@ -1425,10 +1613,10 @@ void HM10_TaskEvery100ms(){ // AddLog(LOG_LEVEL_DEBUG, PSTR("%sFound done HM10_TASK"),D_CMND_HM10); // AddLog(LOG_LEVEL_DEBUG, PSTR("%snext slot:%u, i: %u"),D_CMND_HM10, HM10_TASK_LIST[i+1][0],i); if(HM10_TASK_LIST[i+1][0] == TASK_HM10_NOTASK) { // check the next entry and if there is none - DEBUG_SENSOR_LOG(PSTR("%sno Tasks left"),D_CMND_HM10); - DEBUG_SENSOR_LOG(PSTR("%sHM10_TASK_DONE current slot %u"),D_CMND_HM10, i); + DEBUG_SENSOR_LOG(PSTR("%s: no Tasks left"),D_CMND_HM10); + DEBUG_SENSOR_LOG(PSTR("%s: HM10_TASK_DONE current slot %u"),D_CMND_HM10, i); for (uint8_t j = 0; j < HM10_MAX_TASK_NUMBER+1; j++) { // do a clean-up: - DEBUG_SENSOR_LOG(PSTR("%sHM10_TASK cleanup slot %u"),D_CMND_HM10, j); + DEBUG_SENSOR_LOG(PSTR("%s: HM10_TASK cleanup slot %u"),D_CMND_HM10, j); HM10_TASK_LIST[j][0] = TASK_HM10_NOTASK; // reset all task entries HM10_TASK_LIST[j][1] = 0; // reset all delays } @@ -1927,6 +2115,39 @@ void HM10Show(bool json) } } } + //Scale + if (MIBLEsensors[i].feature.scale){ + if(MIBLEsensors[i].eventType.scale || !HM10.mode.triggeredTele || HM10.option.allwaysAggregate + #ifdef USE_HOME_ASSISTANT + ||(hass_mode==2) + #endif //USE_HOME_ASSISTANT + ){ + HM10ShowContinuation(&commaflg); + ResponseAppend_P(PSTR("\"weight_removed\":%u"), MIBLEsensors[i].weight_removed); + HM10ShowContinuation(&commaflg); + ResponseAppend_P(PSTR("\"weight_stabilized\":%u"), MIBLEsensors[i].weight_stabilized); + HM10ShowContinuation(&commaflg); + ResponseAppend_P(PSTR("\"weight_unit\":\"%s\""), MIBLEsensors[i].weight_unit); + HM10ShowContinuation(&commaflg); + ResponseAppend_P(PSTR("\"" D_JSON_WEIGHT "\":%*_f"),Settings->flag2.weight_resolution, &MIBLEsensors[i].weight); + HM10ShowContinuation(&commaflg); + ResponseAppend_P(PSTR("\"datetime\":\"%02u/%02u/%04u %02u:%02u:%02u\"") + , MIBLEsensors[i].datetime.day + , MIBLEsensors[i].datetime.month + , MIBLEsensors[i].datetime.year + , MIBLEsensors[i].datetime.hour + , MIBLEsensors[i].datetime.minute + , MIBLEsensors[i].datetime.second + ); + } + } + if (MIBLEsensors[i].feature.impedance){ + HM10ShowContinuation(&commaflg); + ResponseAppend_P(PSTR("\"impedance\":%u"), MIBLEsensors[i].has_impedance ? MIBLEsensors[i].impedance : 0); + HM10ShowContinuation(&commaflg); + ResponseAppend_P(PSTR("\"impedance_stabilized\":%u"), MIBLEsensors[i].impedance_stabilized); + } + if (HM10.option.showRSSI) { HM10ShowContinuation(&commaflg); ResponseAppend_P(PSTR("\"RSSI\":%d"), MIBLEsensors[i].rssi); @@ -1992,7 +2213,18 @@ void HM10Show(bool json) WSContentSend_PD(HTTP_HM10_FLORA_DATA, kHM10DeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].fertility); } } - if (MIBLEsensors[i].type>FLORA){ // everything "above" Flora + if (MIBLEsensors[i].type==MI_SCALE_V1 || MIBLEsensors[i].type==MI_SCALE_V2){ + + if (MIBLEsensors[i].feature.scale){ + WSContentSend_PD(HTTP_MISCALE_WEIGHT, kHM10DeviceType[MIBLEsensors[i].type-1], Settings->flag2.weight_resolution, &MIBLEsensors[i].weight, MIBLEsensors[i].weight_unit); + WSContentSend_PD(HTTP_MISCALE_WEIGHT_REMOVED, kHM10DeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].weight_removed ? PSTR("yes") : PSTR("no")); + WSContentSend_PD(HTTP_MISCALE_STABILIZED, kHM10DeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].weight_stabilized ? PSTR("yes") : PSTR("no")); + } + if (MIBLEsensors[i].feature.impedance){ + WSContentSend_PD(HTTP_MISCALE_IMPEDANCE, kHM10DeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].has_impedance ? MIBLEsensors[i].impedance : 0); + } + } + else if (MIBLEsensors[i].type>FLORA){ // everything "above" Flora if(!isnan(MIBLEsensors[i].hum) && !isnan(MIBLEsensors[i].temp)){ WSContentSend_THD(kHM10DeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].temp, MIBLEsensors[i].hum); } From d5c58cb56534f12b92ed335a6e8522957d77cb01 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 12 Dec 2021 00:01:28 +0300 Subject: [PATCH 02/39] Update xsns_62_MI_HM10.ino 1. Fixed HA topics creation: shorten sensor names to fit in total 30 chars for topic name. 2. Removed unnesessary code comment. --- tasmota/xsns_62_MI_HM10.ino | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/tasmota/xsns_62_MI_HM10.ino b/tasmota/xsns_62_MI_HM10.ino index fcded93cd..a083426b2 100644 --- a/tasmota/xsns_62_MI_HM10.ino +++ b/tasmota/xsns_62_MI_HM10.ino @@ -268,25 +268,6 @@ struct mi_sensor_t{ union { uint8_t bat; // many values seem to be hard-coded garbage (LYWSD0x, GCD1) }; -/* union { - struct { - uint8_t has_impedance; - uint8_t impedance_stabilized; - uint8_t weight_stabilized; - uint8_t weight_removed; - char weight_unit[4]; // kg, lbs, jin or empty when unknown - float weight; - uint16_t impedance; - struct { - uint16_t year; - uint8_t month; - uint8_t day; - uint8_t hour; - uint8_t minute; - uint8_t second; - } datetime; - }; - } scale;*/ }; struct { @@ -359,7 +340,6 @@ const char HTTP_MISCALE_IMPEDANCE[] PROGMEM = "{s}%s" " Impedance" "{m}%u{e}"; const char HTTP_MISCALE_WEIGHT_REMOVED[] PROGMEM = "{s}%s" " Weight removed" "{m}%s{e}"; const char HTTP_MISCALE_STABILIZED[] PROGMEM = "{s}%s" " Stabilized" "{m}%s{e}"; - void (*const HM10_Commands[])(void) PROGMEM = { &CmndHM10Scan, &CmndHM10AT, &CmndHM10Period, &CmndHM10Baud, &CmndHM10Time, &CmndHM10Auto, &CmndHM10Page, &CmndHM10Beacon, &CmndHM10Block, &CmndHM10Option }; @@ -409,8 +389,8 @@ const char kHM10DeviceType9[] PROGMEM = "YEERC"; const char kHM10DeviceType10[] PROGMEM ="MHOC401"; const char kHM10DeviceType11[] PROGMEM ="MHOC303"; const char kHM10DeviceType12[] PROGMEM ="ATC"; -const char kHM10DeviceType13[] PROGMEM ="MISCALEV1"; -const char kHM10DeviceType14[] PROGMEM ="MISCALEV2"; +const char kHM10DeviceType13[] PROGMEM ="MSCALE1"; +const char kHM10DeviceType14[] PROGMEM ="MSCALE2"; const char * kHM10DeviceType[] PROGMEM = {kHM10DeviceType1,kHM10DeviceType2,kHM10DeviceType3,kHM10DeviceType4,kHM10DeviceType5,kHM10DeviceType6,kHM10DeviceType7,kHM10DeviceType8,kHM10DeviceType9,kHM10DeviceType10,kHM10DeviceType11,kHM10DeviceType12,kHM10DeviceType13,kHM10DeviceType14}; @@ -2123,15 +2103,15 @@ void HM10Show(bool json) #endif //USE_HOME_ASSISTANT ){ HM10ShowContinuation(&commaflg); - ResponseAppend_P(PSTR("\"weight_removed\":%u"), MIBLEsensors[i].weight_removed); + ResponseAppend_P(PSTR("\"wgh_removed\":%u"), MIBLEsensors[i].weight_removed); HM10ShowContinuation(&commaflg); - ResponseAppend_P(PSTR("\"weight_stabilized\":%u"), MIBLEsensors[i].weight_stabilized); + ResponseAppend_P(PSTR("\"wgh_stabilized\":%u"), MIBLEsensors[i].weight_stabilized); HM10ShowContinuation(&commaflg); - ResponseAppend_P(PSTR("\"weight_unit\":\"%s\""), MIBLEsensors[i].weight_unit); + ResponseAppend_P(PSTR("\"wgh_unit\":\"%s\""), MIBLEsensors[i].weight_unit); HM10ShowContinuation(&commaflg); ResponseAppend_P(PSTR("\"" D_JSON_WEIGHT "\":%*_f"),Settings->flag2.weight_resolution, &MIBLEsensors[i].weight); HM10ShowContinuation(&commaflg); - ResponseAppend_P(PSTR("\"datetime\":\"%02u/%02u/%04u %02u:%02u:%02u\"") + ResponseAppend_P(PSTR("\"dtime\":\"%02u/%02u/%04u %02u:%02u:%02u\"") , MIBLEsensors[i].datetime.day , MIBLEsensors[i].datetime.month , MIBLEsensors[i].datetime.year @@ -2145,7 +2125,7 @@ void HM10Show(bool json) HM10ShowContinuation(&commaflg); ResponseAppend_P(PSTR("\"impedance\":%u"), MIBLEsensors[i].has_impedance ? MIBLEsensors[i].impedance : 0); HM10ShowContinuation(&commaflg); - ResponseAppend_P(PSTR("\"impedance_stabilized\":%u"), MIBLEsensors[i].impedance_stabilized); + ResponseAppend_P(PSTR("\"imp_stabilized\":%u"), MIBLEsensors[i].impedance_stabilized); } if (HM10.option.showRSSI) { From 1ef08e15f1513c43da34a840cd56c05e5d34999e Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 26 Jan 2022 14:25:10 +0300 Subject: [PATCH 03/39] Squashed commit of the following: commit 5563b50abdd70806099248bea875be63b1a8acbb Author: Max Date: Wed Jan 26 12:03:21 2022 +0300 Update xsns_95_cm1107.ino commit fbcfccb9732b3b47c7e5f2554e9d9f5765aad719 Merge: a7a792ff0 62458e367 Author: Max Date: Wed Jan 26 09:44:09 2022 +0300 Merge pull request #3 from arendst/development Add command ``SspmEnergyTotal`` commit a7a792ff026872736aad991aa23702fc53e278a2 Merge: a4199127a d7664c02a Author: Max Date: Tue Jan 25 18:48:12 2022 +0300 Merge remote-tracking branch 'upstream/development' into CM11_sensor commit a4199127a178265c0eefc08a07c41716ce72f7d3 Author: Max Date: Tue Jan 25 18:38:35 2022 +0300 CM11 commit ff0c88badc83ea789b217b5d400d0660573fe64c Author: Max Date: Tue Jan 25 18:37:23 2022 +0300 Create xsns_95_cm1107.ino --- tasmota/language/af_AF.h | 2 + tasmota/language/en_GB.h | 2 + tasmota/support_features.ino | 3 + tasmota/tasmota_template.h | 8 +- tasmota/tasmota_template_legacy.h | 4 + tasmota/xsns_95_cm1107.ino | 465 ++++++++++++++++++++++++++++++ tools/lv_gpio/lv_gpio_enum.h | 2 + 7 files changed, 485 insertions(+), 1 deletion(-) create mode 100644 tasmota/xsns_95_cm1107.ino diff --git a/tasmota/language/af_AF.h b/tasmota/language/af_AF.h index 4b72c6837..60460a97a 100644 --- a/tasmota/language/af_AF.h +++ b/tasmota/language/af_AF.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/en_GB.h b/tasmota/language/en_GB.h index 45a0ca3ca..71bd64bac 100644 --- a/tasmota/language/en_GB.h +++ b/tasmota/language/en_GB.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/support_features.ino b/tasmota/support_features.ino index d9bbd259b..9552f25e8 100644 --- a/tasmota/support_features.ino +++ b/tasmota/support_features.ino @@ -788,6 +788,9 @@ void ResponseAppendFeatures(void) #ifdef USE_SDM230 feature8 |= 0x00100000; // xnrg_21_sdm230.ino #endif +#ifdef USE_CM1107 + feature8 |= 0x00200000; // xsns_95_cm1107.ino +#endif // feature8 |= 0x00200000; // feature8 |= 0x00400000; // feature8 |= 0x00800000; diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index 86efb5c41..6a658521a 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -181,6 +181,7 @@ enum UserSelectablePins { GPIO_OPTION_E, // Emulated module GPIO_SDM230_TX, GPIO_SDM230_RX, // SDM230 Serial interface GPIO_ADC_MQ, // Analog MQ Sensor + GPIO_CM11_TXD, GPIO_CM11_RXD, // CM11 Serial interface GPIO_SENSOR_END }; enum ProgramSelectablePins { @@ -400,7 +401,8 @@ const char kSensorNames[] PROGMEM = D_SENSOR_SOLAXX1_RTS "|" D_SENSOR_OPTION " E|" D_SENSOR_SDM230_TX "|" D_SENSOR_SDM230_RX "|" - D_SENSOR_ADC_MQ + D_SENSOR_ADC_MQ "|" + D_SENSOR_CM11_TX "|" D_SENSOR_CM11_RX "|" ; const char kSensorNamesFixed[] PROGMEM = @@ -934,6 +936,10 @@ const uint16_t kGpioNiceList[] PROGMEM = { AGPIO(GPIO_MAX7219CS), #endif // USE_DISPLAY_MAX7219 +#ifdef USE_CM1107 + AGPIO(GPIO_CM11_TXD), // MH-Z19 Serial interface + AGPIO(GPIO_CM11_RXD), // MH-Z19 Serial interface +#endif /*-------------------------------------------------------------------------------------------*\ * ESP32 specifics \*-------------------------------------------------------------------------------------------*/ diff --git a/tasmota/tasmota_template_legacy.h b/tasmota/tasmota_template_legacy.h index 4583a9783..14d0c438b 100644 --- a/tasmota/tasmota_template_legacy.h +++ b/tasmota/tasmota_template_legacy.h @@ -87,6 +87,8 @@ enum LegacyUserSelectablePins { GPI8_LED4_INV, GPI8_MHZ_TXD, // MH-Z19 Serial interface GPI8_MHZ_RXD, // MH-Z19 Serial interface + GPI8_CM11_TXD, // MH-Z19 Serial interface + GPI8_CM11_RXD, // MH-Z19 Serial interface GPI8_PZEM0XX_TX, // PZEM0XX Serial interface GPI8_PZEM004_RX, // PZEM004T Serial interface GPI8_SAIR_TX, // SenseAir Serial interface @@ -317,6 +319,8 @@ const uint16_t kGpioConvert[] PROGMEM = { AGPIO(GPIO_LED1_INV) +3, AGPIO(GPIO_MHZ_TXD), // MH-Z19 Serial interface AGPIO(GPIO_MHZ_RXD), + AGPIO(GPIO_CM11_TXD), // MH-Z19 Serial interface + AGPIO(GPIO_CM11_RXD), AGPIO(GPIO_PZEM0XX_TX), // PZEM0XX Serial interface AGPIO(GPIO_PZEM004_RX), // PZEM004T Serial interface AGPIO(GPIO_SAIR_TX), // SenseAir Serial interface diff --git a/tasmota/xsns_95_cm1107.ino b/tasmota/xsns_95_cm1107.ino new file mode 100644 index 000000000..d5e2ffe72 --- /dev/null +++ b/tasmota/xsns_95_cm1107.ino @@ -0,0 +1,465 @@ +/* + XSNS_95_cm1107.ino - CM1107(B) CO2 sensor support for Tasmota + + Copyright (C) 2021 Theo Arends + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifdef USE_CM1107 +/*********************************************************************************************\ + * CM11xx - CO2 sensor + * https://en.gassensor.com.cn/CO2Sensor/list.html + * Adapted from Mhz19 plugin by Maksim (rekin.m ___ gmail.com) + * + * Hardware Serial will be selected if GPIO1 = [CM11 Rx] and GPIO3 = [CM11 Tx] + ********************************************************************************************** + * Filter usage + * + * Select filter usage on low stability readings + * + * ******************************************************************************************* + * Some CM11 models has manual or continuos modes - this logic not implemented. +\*********************************************************************************************/ + +#define XSNS_95 95 + +enum CM11FilterOptions {CM1107_FILTER_OFF, CM1107_FILTER_FAST, CM1107_FILTER_MEDIUM, CM1107_FILTER_MEDIUM2, CM1107_FILTER_SLOW}; + +#ifndef CM1107_FILTER_OPTION + #define CM1107_FILTER_OPTION CM1107_FILTER_FAST +#endif +/*********************************************************************************************\ + * Source: https://en.gassensor.com.cn/CO2Sensor/list.html (pdf for 1106/1107/1109 sensors) + * + * + * Automatic Baseline Correction (ABC logic function) is enabled by default but may be disabled with command + * Sensor95 0 + * and enabled again with command + * Sensor95 1 + * + * ABC logic function refers to that sensor itself do zero point judgment and automatic calibration procedure + * intelligently after a continuous operation period. The automatic calibration cycle is first 24 hours and 7 days cycle after powered on. + * + * The zero point of automatic calibration is 400ppm. + * + * This function is usually suitable for indoor air quality monitor such as offices, schools and homes, + * not suitable for greenhouse, farm and refrigeratory where this function should be off. + * + * Please do zero calibration timely, such as manual or command calibration. +\*********************************************************************************************/ + +#include + +#ifndef CO2_LOW +#define CO2_LOW 800 // Below this CO2 value show green light +#endif +#ifndef CO2_HIGH +#define CO2_HIGH 1200 // Above this CO2 value show red light +#endif + +#define CM1107_READ_TIMEOUT 400 // Must be way less than 1000 but enough to read 16 bytes at 9600 bps +#define CM1107_RETRY_COUNT 8 + +TasmotaSerial *CM11Serial; + + +const char CM11_ABC_ENABLED[] = "ABC is Enabled"; +const char CM11_ABC_DISABLED[] = "ABC is Disabled"; + +//First [0] element - lenght of cmd and data +const uint8_t cmd_read[] = {0x01,0x01}; // cm11_cmnd_read_ppm +uint8_t cmd_abc_enable[] = {0x07,0x10,0x64,0x00,0x07,0x01,0x90,0x64}; // cm11_cmnd_abc_enable. Not const because can be modified +const uint8_t cmd_abc_disable[] = {0x07,0x10,0x64,0x02,0x07,0x01,0x90,0x64}; // cm11_cmnd_abc_disable +const uint8_t cmd_zeropoint[] = {0x03,0x03,0x01,0x90}; // cm11_cmnd_zeropoint_400 +const uint8_t cmd_serial[] = {0x01,0x1F}; // cm11_cmnd_read_serial +const uint8_t cmd_sw_version[] = {0x01,0x1E}; // cm11_cmnd_read_sw_version + + +enum CM11Commands { CM11_CMND_READPPM, CM11_CMND_ABCENABLE, CM11_CMND_ABCDISABLE, CM11_CMND_ZEROPOINT, CM11_CMND_SERIAL,CM11_CMND_SW_VERSION }; +const uint8_t* kCM11Commands[] PROGMEM = { + cmd_read, + cmd_abc_enable, + cmd_abc_disable, + cmd_zeropoint, + cmd_serial, + cmd_sw_version +}; + + +uint8_t cm11_type = 1; +uint16_t cm11_last_ppm = 0; +uint8_t cm11_filter = CM1107_FILTER_OPTION; +bool cm11_abc_must_apply = false; + +float cm11_temperature = 0; +uint16_t cm11_humidity = 0; +char cm11_sw_version[30] = {0}; +char cm11_serial_number[21] = {0}; +uint8_t cm11_retry = CM1107_RETRY_COUNT; +uint8_t cm11_received = 0; +uint8_t cm11_state = 0; +uint16_t ppm_low_limit = 0; +uint16_t ppm_high_limit = 5000; + +/*********************************************************************************************/ +//256-(HEAD+LEN+CMD+DATA)%256 +uint8_t CM11CalculateChecksum(uint8_t *array,uint8_t start, uint8_t len) +{ + uint8_t checksum = 0; + for (uint8_t i = start; i < len; i++) { + checksum += array[i]; + } + checksum = checksum%256; + checksum = 255 - checksum; + return (checksum +1); +} + +size_t CM11SendCmd(uint8_t command_id) +{ + uint8_t len =kCM11Commands[command_id][0]; + uint8_t cm11_send[len+3];// = {0}; //Fix length + memset( cm11_send, 0, (len+3)*sizeof(uint8_t) ); + + cm11_send[0] = 0x11; // Start byte, fixed + + memcpy_P(&cm11_send[1], kCM11Commands[command_id], (len+1) * sizeof(uint8_t)); + + cm11_send[len+2] = CM11CalculateChecksum(cm11_send,0, len+2); + +#ifdef DEBUG_TASMOTA_SENSOR + char cmdFull[len+30];// = {0}; + memset( cmdFull, 0, (len+3)*sizeof(char) ); + for(int i=0, j=0;iwrite(cm11_send, sizeof(cm11_send)); +} + +/*********************************************************************************************/ + +bool CM11CheckAndApplyFilter(uint16_t ppm, uint8_t drift) +{ +#ifdef DEBUG_TASMOTA_SENSOR + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "CM11 ppm: %u, last ppm: %u"),ppm, cm11_last_ppm); +#endif //DEBUG_TASMOTA_SENSOR + if (cm11_last_ppm < ppm_low_limit || cm11_last_ppm > ppm_high_limit) { + // Prevent unrealistic values during start-up with filtering enabled. + // Just assume the entered value is correct. + cm11_last_ppm = ppm; + return true; + } + int32_t difference = ppm - cm11_last_ppm; + if (drift > 0 && cm11_filter != CM1107_FILTER_OFF) { + difference >>= CM1107_FILTER_SLOW; // If drifting values -> apply slow filter + }else if (CM1107_FILTER_OFF == cm11_filter) { + if (drift != 0 ) { + return false; //Do not alarm on such unstable values + } + }else { + difference >>=cm11_filter; + } + + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "CM11 diff: %d"),difference); + cm11_last_ppm = static_cast(cm11_last_ppm + difference); + return true; +} + +void CM11EverySecond(void) +{ + cm11_state++; + //If more than one command was send + //Reading preffered + if (CM11Serial->available() > 0){ + cm11_received = 0; + } + + if ((8 == cm11_state && cm11_received) || 16 == cm11_state) { // Every 8 sec start a CM11 measuring cycle (which takes 1005 +5% ms) + cm11_state = 0; + + if (cm11_retry) { + cm11_retry--; + if (!cm11_retry) { + cm11_last_ppm = 0; + cm11_temperature = 0; + cm11_humidity = 0; + } + } + + CM11Serial->flush(); // Sync reception + CM11SendCmd(CM11_CMND_READPPM); + cm11_received = 0; + } + + if ((cm11_state > 2) && !cm11_received) { // Start reading response after 3 seconds every second until received + uint8_t cm11_response[50]; + unsigned long start = millis(); + uint8_t counter = 0; + uint8_t resp_len = 50; + while (((millis() - start) < CM1107_READ_TIMEOUT) && (counter < resp_len)) { + if (CM11Serial->available() > 0) { + cm11_response[counter++] = CM11Serial->read(); + if (counter ==2 && cm11_response[0] == 0x16) { + resp_len = cm11_response[1] +3 ; + } + } else { + delay(5); + } + } + + if (counter < 5) { + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "CM1107 timeout (command sent, no responce")); + return; + } + + uint8_t crc = CM11CalculateChecksum(cm11_response,0, cm11_response[1]+2); + if (cm11_response[cm11_response[1]+2] != crc) { + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "CM1107 crc error")); + return; + } + if (0x16 != cm11_response[0]) { + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "CM1107 bad response")); + return; + } + + cm11_received = 1; + + if (cm11_response[2]==cmd_read[1]){ //0x01 - read command + uint16_t ppm = (cm11_response[3] << 8) | cm11_response[4]; + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "CM11 PPM: %u"),ppm); + if (ppm ==550) { // Preheating mode, fixed value. + //DOCs says that preheating is cm11_response[5] & (1 << 0)) ==1 (first bit ==1), but mine sensor (CM1107, sw V1.07.0.02 ) + // set first bit 0 when preheating at switch to 1 then finished. + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "CM11 preheating")); + if (Settings->SensorBits1.mhz19b_abc_disable) { + // After bootup of the sensor the ABC will be enabled. + // Thus only actively disable after bootup. + cm11_abc_must_apply = true; + } + return; + } + if(cm11_response[1] ==13) { // CM1107T with temperature and humidity + cm11_temperature = (float)(((cm11_response[7] << 8) | cm11_response[8]) - 4685)/100.0f; + cm11_humidity = (((cm11_response[9] << 8) | cm11_response[10]) - 600)/100; + cm11_type = 2; + } + uint8_t cm11_drift = (cm11_response[5] & (1 << 7)) ? 1:0; + AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "CM11 flags DF3: %02x"),cm11_response[5]); + + if (CM11CheckAndApplyFilter(ppm,cm11_drift)) { + cm11_retry = CM1107_RETRY_COUNT; +#ifdef USE_LIGHT + LightSetSignal(CO2_LOW, CO2_HIGH, cm11_last_ppm); +#endif // USE_LIGHT + + if (!cm11_drift) { // Measuring is stable. + if (cm11_abc_must_apply) { + cm11_abc_must_apply = false; + if (!Settings->SensorBits1.mhz19b_abc_disable) { + CM11SendCmd(CM11_CMND_ABCENABLE); + } else { + CM11SendCmd(CM11_CMND_ABCDISABLE); + } + } + } + + } + } + + if (cm11_response[2]==cmd_sw_version[1]){ //0x1E - read SW version + memcpy_P(cm11_sw_version, &cm11_response[3], cm11_response[1] * sizeof(uint8_t)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_DEBUG "SW version: %s"),cm11_sw_version); + } + + if (cm11_response[2]==cmd_serial[1]){ //0x1F - read serial + // Serial num coded as 5 integers 0..9999. Each integer is uint16_t size + for (uint8_t i=0; iSensorBits1.mhz19b_abc_disable = true; + CM11SendCmd(CM11_CMND_ABCDISABLE); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_95, CM11_ABC_DISABLED); + break; + case 1: + Settings->SensorBits1.mhz19b_abc_disable = false; + CM11SendCmd(CM11_CMND_ABCENABLE); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_95, CM11_ABC_ENABLED); + break; + case 2: + CM11SendCmd(CM11_CMND_ZEROPOINT); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_95, D_JSON_ZERO_POINT_CALIBRATION); + break; + case 3: + CM11SendCmd(CM11_CMND_SW_VERSION); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_95, "CM11 sw version"); + break; + case 4: + CM11SendCmd(CM11_CMND_SERIAL); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_95, "CM11 serial number"); + break; + + default: + // Set ppm limits: 5,, + // ABS period cmd(with enabling ABS): 1,[1..30] + uint32_t parm[3] = { 0 }; + ParseParameters(3, parm); + switch (parm[0]) { + case 1: + if (parm[1]>=1 && parm[1]<=30){ + cmd_abc_enable[4] = parm[1]; //set uint8 from uint32 *o*, but value limited by 30 + Settings->SensorBits1.mhz19b_abc_disable = false; + CM11SendCmd(CM11_CMND_ABCENABLE); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_95, CM11_ABC_ENABLED); + } else { + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_95, "Valid period value: [1..30]"); + } + break; + // Set sensor ppm limit. Default 0..5000, but some sensors has another range. + case 5: + if(parm[1]>=0 && parm[1] <=10000 && parm[2]>=0 && parm[2] <=10000 && parm[1]=0 && parm[1]<=4) { + cm11_filter = parm[1]; + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_95, "CM11 set filter mode"); + } + else { + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_95, "Invalid filter mode: [0..4]. 0 - Off, 1 (Fast) -> 4 (Slow)"); + } + break; + default: + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_95, "Unknown command"); + break; + } + + } + + return serviced; +} + +/*********************************************************************************************/ + +void CM11Init(void) +{ + cm11_type = 0; + if (PinUsed(GPIO_CM11_RXD) && PinUsed(GPIO_CM11_TXD)) { + CM11Serial = new TasmotaSerial(Pin(GPIO_CM11_RXD), Pin(GPIO_CM11_TXD), 1); + if (CM11Serial->begin(9600)) { + if (CM11Serial->hardwareSerial()) { ClaimSerial(); } + cm11_type = 1; + CM11SendCmd(CM11_CMND_SW_VERSION); + } + } +} + +void CM11Show(bool json) +{ + if (json) { + ResponseAppend_P(PSTR(",\"CM11\":{\"" D_JSON_CO2 "\":%d,\"" D_JSON_VERSION "\":\"%s\",\"Serial number\":\"%s\""), + cm11_last_ppm, cm11_sw_version, cm11_serial_number); + if(cm11_type == 2) { // With temp and humidity + ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE "\":%*_f"), + Settings->flag2.temperature_resolution, &cm11_temperature); + } + ResponseAppend_P(PSTR("}")); +#ifdef USE_DOMOTICZ + if (0 == TasmotaGlobal.tele_period) { + DomoticzSensor(DZ_AIRQUALITY, cm11_last_ppm); + if(cm11_type == 2) { // With temp and humidity + DomoticzFloatSensor(DZ_TEMP, cm11_temperature); + } + } +#endif // USE_DOMOTICZ +#ifdef USE_WEBSERVER + } else { + WSContentSend_PD(HTTP_SNS_CO2, "CM11", cm11_last_ppm); + if(cm11_type == 2) { // With temp and humidity + WSContentSend_Temp("CM11", cm11_temperature); + } +#endif // USE_WEBSERVER + } +} + +/*********************************************************************************************\ + * Interface +\*********************************************************************************************/ + +bool Xsns95(uint8_t function) +{ + bool result = false; + + if (cm11_type) { + switch (function) { + case FUNC_INIT: + CM11Init(); + break; + case FUNC_EVERY_SECOND: + CM11EverySecond(); + break; + case FUNC_COMMAND_SENSOR: + if (XSNS_95 == XdrvMailbox.index) { + result = CM11CommandSensor(); + } + break; + case FUNC_JSON_APPEND: + CM11Show(1); + break; +#ifdef USE_WEBSERVER + case FUNC_WEB_SENSOR: + CM11Show(0); + break; +#endif // USE_WEBSERVER + } + } + return result; +} + +#endif // USE_CM1107 diff --git a/tools/lv_gpio/lv_gpio_enum.h b/tools/lv_gpio/lv_gpio_enum.h index 74f6c64f3..51e83ae7e 100644 --- a/tools/lv_gpio/lv_gpio_enum.h +++ b/tools/lv_gpio/lv_gpio_enum.h @@ -63,6 +63,8 @@ DSB_OUT = GPIO_DSB_OUT WS2812 = GPIO_WS2812 MHZ_TXD = GPIO_MHZ_TXD MHZ_RXD = GPIO_MHZ_RXD +CM11_TXD = GPIO_CM11_TXD +CM11_RXD = GPIO_CM11_RXD PZEM0XX_TX = GPIO_PZEM0XX_TX PZEM004_RX = GPIO_PZEM004_RX PZEM016_RX = GPIO_PZEM016_RX From 22d549ca3dec53d8c9c786e37b6e38d0f745009b Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 26 Jan 2022 15:03:21 +0300 Subject: [PATCH 04/39] Update CM11 --- tasmota/language/bg_BG.h | 2 ++ tasmota/language/cs_CZ.h | 2 ++ tasmota/language/de_DE.h | 2 ++ tasmota/language/el_GR.h | 2 ++ tasmota/language/en_GB.h | 2 ++ tasmota/language/es_ES.h | 2 ++ tasmota/language/fr_FR.h | 2 ++ tasmota/language/fy_NL.h | 2 ++ tasmota/language/he_HE.h | 2 ++ tasmota/language/hu_HU.h | 2 ++ tasmota/language/it_IT.h | 2 ++ tasmota/language/ko_KO.h | 2 ++ tasmota/language/nl_NL.h | 2 ++ tasmota/language/pl_PL.h | 2 ++ tasmota/language/pt_BR.h | 2 ++ tasmota/language/pt_PT.h | 2 ++ tasmota/language/ro_RO.h | 2 ++ tasmota/language/ru_RU.h | 2 ++ tasmota/language/sk_SK.h | 2 ++ tasmota/language/sv_SE.h | 2 ++ tasmota/language/tr_TR.h | 2 ++ tasmota/language/uk_UA.h | 2 ++ tasmota/language/vi_VN.h | 2 ++ tasmota/language/zh_CN.h | 2 ++ tasmota/language/zh_TW.h | 2 ++ tasmota/support_features.ino | 5 ++--- tasmota/tasmota_template.h | 6 +++--- tasmota/tasmota_template_legacy.h | 6 +++--- tasmota/{xsns_95_cm1107.ino => xsns_95_cm110x.ino} | 4 ++-- 29 files changed, 60 insertions(+), 11 deletions(-) rename tasmota/{xsns_95_cm1107.ino => xsns_95_cm110x.ino} (99%) diff --git a/tasmota/language/bg_BG.h b/tasmota/language/bg_BG.h index 7e7cf52d0..602091030 100644 --- a/tasmota/language/bg_BG.h +++ b/tasmota/language/bg_BG.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/cs_CZ.h b/tasmota/language/cs_CZ.h index cfa6c5625..1a731d7fa 100644 --- a/tasmota/language/cs_CZ.h +++ b/tasmota/language/cs_CZ.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/de_DE.h b/tasmota/language/de_DE.h index b67a77851..bd4306de9 100644 --- a/tasmota/language/de_DE.h +++ b/tasmota/language/de_DE.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/el_GR.h b/tasmota/language/el_GR.h index 1ce06a5bb..df9fd6fff 100644 --- a/tasmota/language/el_GR.h +++ b/tasmota/language/el_GR.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/en_GB.h b/tasmota/language/en_GB.h index 71bd64bac..bcdfdd27d 100644 --- a/tasmota/language/en_GB.h +++ b/tasmota/language/en_GB.h @@ -854,6 +854,8 @@ #define D_GPIO_SHIFT595_SER "74x595 SER" #define D_SENSOR_CM11_TX "CM110x TX" #define D_SENSOR_CM11_RX "CM110x RX" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/es_ES.h b/tasmota/language/es_ES.h index 621f97679..a317601ad 100644 --- a/tasmota/language/es_ES.h +++ b/tasmota/language/es_ES.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/fr_FR.h b/tasmota/language/fr_FR.h index 83b2063c9..8a28c747d 100644 --- a/tasmota/language/fr_FR.h +++ b/tasmota/language/fr_FR.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/fy_NL.h b/tasmota/language/fy_NL.h index 86be5540a..7addac432 100644 --- a/tasmota/language/fy_NL.h +++ b/tasmota/language/fy_NL.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/he_HE.h b/tasmota/language/he_HE.h index 649df5e4b..9c0941429 100644 --- a/tasmota/language/he_HE.h +++ b/tasmota/language/he_HE.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/hu_HU.h b/tasmota/language/hu_HU.h index d09d68b55..6fad9fbb5 100644 --- a/tasmota/language/hu_HU.h +++ b/tasmota/language/hu_HU.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/it_IT.h b/tasmota/language/it_IT.h index 56b9f1944..f48d7f1e4 100644 --- a/tasmota/language/it_IT.h +++ b/tasmota/language/it_IT.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 - RCLK" #define D_GPIO_SHIFT595_OE "74x595 - OE" #define D_GPIO_SHIFT595_SER "74x595 - SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/ko_KO.h b/tasmota/language/ko_KO.h index e503f55d4..85306451c 100644 --- a/tasmota/language/ko_KO.h +++ b/tasmota/language/ko_KO.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/nl_NL.h b/tasmota/language/nl_NL.h index afe73ad75..17803a9b0 100644 --- a/tasmota/language/nl_NL.h +++ b/tasmota/language/nl_NL.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/pl_PL.h b/tasmota/language/pl_PL.h index e69836af6..68ea8596c 100644 --- a/tasmota/language/pl_PL.h +++ b/tasmota/language/pl_PL.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/pt_BR.h b/tasmota/language/pt_BR.h index 4ab70c0b6..b3314554e 100644 --- a/tasmota/language/pt_BR.h +++ b/tasmota/language/pt_BR.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/pt_PT.h b/tasmota/language/pt_PT.h index c7d398fbb..357aec476 100644 --- a/tasmota/language/pt_PT.h +++ b/tasmota/language/pt_PT.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/ro_RO.h b/tasmota/language/ro_RO.h index e2f01aff9..ab325f19a 100644 --- a/tasmota/language/ro_RO.h +++ b/tasmota/language/ro_RO.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/ru_RU.h b/tasmota/language/ru_RU.h index ad70639de..927a5e38d 100644 --- a/tasmota/language/ru_RU.h +++ b/tasmota/language/ru_RU.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "А" diff --git a/tasmota/language/sk_SK.h b/tasmota/language/sk_SK.h index e61bc00ec..322b412cb 100644 --- a/tasmota/language/sk_SK.h +++ b/tasmota/language/sk_SK.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/sv_SE.h b/tasmota/language/sv_SE.h index 8f47e8be7..ed1298eb2 100644 --- a/tasmota/language/sv_SE.h +++ b/tasmota/language/sv_SE.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/tr_TR.h b/tasmota/language/tr_TR.h index 70c6c958a..b238b88b9 100644 --- a/tasmota/language/tr_TR.h +++ b/tasmota/language/tr_TR.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/uk_UA.h b/tasmota/language/uk_UA.h index a2903fdc6..b75e1f04a 100644 --- a/tasmota/language/uk_UA.h +++ b/tasmota/language/uk_UA.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "А" diff --git a/tasmota/language/vi_VN.h b/tasmota/language/vi_VN.h index fb91d7201..13242d134 100644 --- a/tasmota/language/vi_VN.h +++ b/tasmota/language/vi_VN.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/zh_CN.h b/tasmota/language/zh_CN.h index c7cc7a136..bd9b96293 100644 --- a/tasmota/language/zh_CN.h +++ b/tasmota/language/zh_CN.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" diff --git a/tasmota/language/zh_TW.h b/tasmota/language/zh_TW.h index 563e2f666..8689fcddd 100644 --- a/tasmota/language/zh_TW.h +++ b/tasmota/language/zh_TW.h @@ -852,6 +852,8 @@ #define D_GPIO_SHIFT595_RCLK "74x595 RCLK" #define D_GPIO_SHIFT595_OE "74x595 OE" #define D_GPIO_SHIFT595_SER "74x595 SER" +#define D_SENSOR_CM11_TX "CM110x TX" +#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "安培" diff --git a/tasmota/support_features.ino b/tasmota/support_features.ino index 9552f25e8..a8be4bd25 100644 --- a/tasmota/support_features.ino +++ b/tasmota/support_features.ino @@ -788,10 +788,9 @@ void ResponseAppendFeatures(void) #ifdef USE_SDM230 feature8 |= 0x00100000; // xnrg_21_sdm230.ino #endif -#ifdef USE_CM1107 - feature8 |= 0x00200000; // xsns_95_cm1107.ino +#ifdef USE_CM110x + feature8 |= 0x00200000; // xsns_95_cm110x.ino #endif -// feature8 |= 0x00200000; // feature8 |= 0x00400000; // feature8 |= 0x00800000; diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index 6a658521a..3794aa2d9 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -936,9 +936,9 @@ const uint16_t kGpioNiceList[] PROGMEM = { AGPIO(GPIO_MAX7219CS), #endif // USE_DISPLAY_MAX7219 -#ifdef USE_CM1107 - AGPIO(GPIO_CM11_TXD), // MH-Z19 Serial interface - AGPIO(GPIO_CM11_RXD), // MH-Z19 Serial interface +#ifdef USE_CM110x + AGPIO(GPIO_CM11_TXD), // CM110x Serial interface + AGPIO(GPIO_CM11_RXD), // CM110x Serial interface #endif /*-------------------------------------------------------------------------------------------*\ * ESP32 specifics diff --git a/tasmota/tasmota_template_legacy.h b/tasmota/tasmota_template_legacy.h index 14d0c438b..40b5fd228 100644 --- a/tasmota/tasmota_template_legacy.h +++ b/tasmota/tasmota_template_legacy.h @@ -87,8 +87,8 @@ enum LegacyUserSelectablePins { GPI8_LED4_INV, GPI8_MHZ_TXD, // MH-Z19 Serial interface GPI8_MHZ_RXD, // MH-Z19 Serial interface - GPI8_CM11_TXD, // MH-Z19 Serial interface - GPI8_CM11_RXD, // MH-Z19 Serial interface + GPI8_CM11_TXD, // CM110x Serial interface + GPI8_CM11_RXD, // CM110x Serial interface GPI8_PZEM0XX_TX, // PZEM0XX Serial interface GPI8_PZEM004_RX, // PZEM004T Serial interface GPI8_SAIR_TX, // SenseAir Serial interface @@ -319,7 +319,7 @@ const uint16_t kGpioConvert[] PROGMEM = { AGPIO(GPIO_LED1_INV) +3, AGPIO(GPIO_MHZ_TXD), // MH-Z19 Serial interface AGPIO(GPIO_MHZ_RXD), - AGPIO(GPIO_CM11_TXD), // MH-Z19 Serial interface + AGPIO(GPIO_CM11_TXD), // CM110x Serial interface AGPIO(GPIO_CM11_RXD), AGPIO(GPIO_PZEM0XX_TX), // PZEM0XX Serial interface AGPIO(GPIO_PZEM004_RX), // PZEM004T Serial interface diff --git a/tasmota/xsns_95_cm1107.ino b/tasmota/xsns_95_cm110x.ino similarity index 99% rename from tasmota/xsns_95_cm1107.ino rename to tasmota/xsns_95_cm110x.ino index d5e2ffe72..d7c1e75d4 100644 --- a/tasmota/xsns_95_cm1107.ino +++ b/tasmota/xsns_95_cm110x.ino @@ -17,7 +17,7 @@ along with this program. If not, see . */ -#ifdef USE_CM1107 +#ifdef USE_CM110x /*********************************************************************************************\ * CM11xx - CO2 sensor * https://en.gassensor.com.cn/CO2Sensor/list.html @@ -462,4 +462,4 @@ bool Xsns95(uint8_t function) return result; } -#endif // USE_CM1107 +#endif // USE_CM110x From 83ab20bb11b1586e7f47d75a7e9012d4ac6da1a1 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 27 Jan 2022 16:42:58 +0300 Subject: [PATCH 05/39] some tiny updates --- tasmota/my_user_config.h | 1 + tasmota/tasmota_configurations_ESP32.h | 2 ++ tasmota/tasmota_template_legacy.h | 4 ++-- tasmota/xsns_95_cm110x.ino | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 6a4f6df4d..38b99d4de 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -724,6 +724,7 @@ // -- Serial sensors ------------------------------ //#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code) //#define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code) +//#define USE_CM110x // Add support for CM110x CO2 sensors (+2k7code) #define CO2_LOW 800 // Below this CO2 value show green light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1) #define CO2_HIGH 1200 // Above this CO2 value show red light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1) //#define USE_PMS5003 // Add support for PMS5003 and PMS7003 particle concentration sensor (+1k3 code) diff --git a/tasmota/tasmota_configurations_ESP32.h b/tasmota/tasmota_configurations_ESP32.h index bdcfcee65..16c7fc488 100644 --- a/tasmota/tasmota_configurations_ESP32.h +++ b/tasmota/tasmota_configurations_ESP32.h @@ -340,6 +340,7 @@ //#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code) //#define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code) +//#define USE_CM110x // Add support for CM110x CO2 sensors (+2k7 code) #ifndef CO2_LOW #define CO2_LOW 800 // Below this CO2 value show green light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1) #endif @@ -476,6 +477,7 @@ #define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code) #define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code) +#define USE_CM110x // Add support for CM110x CO2 sensors (+2k7 code) #ifndef CO2_LOW #define CO2_LOW 800 // Below this CO2 value show green light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1) #endif diff --git a/tasmota/tasmota_template_legacy.h b/tasmota/tasmota_template_legacy.h index 40b5fd228..31982e511 100644 --- a/tasmota/tasmota_template_legacy.h +++ b/tasmota/tasmota_template_legacy.h @@ -87,8 +87,8 @@ enum LegacyUserSelectablePins { GPI8_LED4_INV, GPI8_MHZ_TXD, // MH-Z19 Serial interface GPI8_MHZ_RXD, // MH-Z19 Serial interface - GPI8_CM11_TXD, // CM110x Serial interface - GPI8_CM11_RXD, // CM110x Serial interface + GPI8_CM11_TXD, // CM110x Serial interface + GPI8_CM11_RXD, // CM110x Serial interface GPI8_PZEM0XX_TX, // PZEM0XX Serial interface GPI8_PZEM004_RX, // PZEM004T Serial interface GPI8_SAIR_TX, // SenseAir Serial interface diff --git a/tasmota/xsns_95_cm110x.ino b/tasmota/xsns_95_cm110x.ino index d7c1e75d4..17c090c10 100644 --- a/tasmota/xsns_95_cm110x.ino +++ b/tasmota/xsns_95_cm110x.ino @@ -215,8 +215,8 @@ void CM11EverySecond(void) while (((millis() - start) < CM1107_READ_TIMEOUT) && (counter < resp_len)) { if (CM11Serial->available() > 0) { cm11_response[counter++] = CM11Serial->read(); - if (counter ==2 && cm11_response[0] == 0x16) { - resp_len = cm11_response[1] +3 ; + if (counter ==2 && cm11_response[0] == 0x16) { //0x16 - first byte in response + resp_len = cm11_response[1] +3 ; // Get expected response len (according protocol desc), +3 - first byte, len and checksum } } else { delay(5); From af2fe0da3ab799da150a5df4b1c651001cba6cb6 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 27 Jan 2022 19:42:26 +0300 Subject: [PATCH 06/39] Update en_GB.h Dublicate removed --- tasmota/language/en_GB.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/tasmota/language/en_GB.h b/tasmota/language/en_GB.h index bcdfdd27d..71bd64bac 100644 --- a/tasmota/language/en_GB.h +++ b/tasmota/language/en_GB.h @@ -854,8 +854,6 @@ #define D_GPIO_SHIFT595_SER "74x595 SER" #define D_SENSOR_CM11_TX "CM110x TX" #define D_SENSOR_CM11_RX "CM110x RX" -#define D_SENSOR_CM11_TX "CM110x TX" -#define D_SENSOR_CM11_RX "CM110x RX" // Units #define D_UNIT_AMPERE "A" From 001710d5024b5394f2970c48453a387b79f14ee1 Mon Sep 17 00:00:00 2001 From: SteWers Date: Thu, 27 Jan 2022 21:11:02 +0100 Subject: [PATCH 07/39] [Solax X1] no PV 2 per default - no secondary PV per default - the usage is described in the documentation --- tasmota/my_user_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 6a4f6df4d..61dcbee09 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -793,7 +793,7 @@ #define DDSU666_SPEED 9600 // Chint DDSU666 Modbus RS485 serial speed (default: 9600 baud) //#define USE_SOLAX_X1 // Add support for Solax X1 series Modbus log info (+3k1 code) #define SOLAXX1_SPEED 9600 // Solax X1 Modbus RS485 serial speed (default: 9600 baud) - #define SOLAXX1_PV2 // Solax X1 using second PV +// #define SOLAXX1_PV2 // Solax X1 using second PV //#define USE_LE01MR // Add support for F&F LE-01MR Modbus energy monitor (+1k code) #define LE01MR_SPEED 9600 // LE-01MR modbus baudrate (default: 9600) #define LE01MR_ADDR 1 // LE-01MR modbus address (default: 0x01) From 539c5089187c3438f4d616ada7804bf9991909c8 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Thu, 27 Jan 2022 21:30:05 +0100 Subject: [PATCH 08/39] Increase PWM channels to 16 (Esp32 only) --- CHANGELOG.md | 1 + .../Arduino_ST7789.cpp | 16 +- .../src/renderer.cpp | 4 +- .../Display_Renderer-gemu-1.0/src/renderer.h | 2 +- .../ILI9341-gemu-1.0/ILI9341_2.cpp | 14 +- lib/lib_display/UDisplay/uDisplay.cpp | 21 +- lib/lib_display/UDisplay/uDisplay.h | 7 +- .../lib_mail/src/wcs/esp8266/ESP_Mail_WCS.cpp | 4 +- .../src/WiFiClientSecureLightBearSSL.cpp | 2 +- .../ESP32-to-ESP8266-compat/src/c_types.h | 6 - .../src/eboot_command.h | 3 - .../src/esp8266toEsp32.cpp | 152 +++++----- .../src/esp8266toEsp32.h | 35 +-- .../ESP32-to-ESP8266-compat/src/osapi.h | 8 - tasmota/settings.h | 7 +- tasmota/settings.ino | 5 +- tasmota/support_command.ino | 50 ---- tasmota/support_pwm.ino | 273 ++++++++++++++++++ tasmota/support_tasmota.ino | 46 +-- tasmota/tasmota.h | 16 +- tasmota/tasmota.ino | 9 +- tasmota/tasmota_template.h | 4 +- tasmota/xdrv_04_light.ino | 23 +- tasmota/xdrv_13_display.ino | 4 +- tasmota/xdrv_24_buzzer.ino | 9 +- tasmota/xdrv_52_3_berry_webclient.ino | 14 + tasmota/xdrv_81_esp32_webcam.ino | 17 +- 27 files changed, 464 insertions(+), 288 deletions(-) delete mode 100644 lib/libesp32/ESP32-to-ESP8266-compat/src/c_types.h delete mode 100644 lib/libesp32/ESP32-to-ESP8266-compat/src/eboot_command.h delete mode 100644 lib/libesp32/ESP32-to-ESP8266-compat/src/osapi.h create mode 100644 tasmota/support_pwm.ino diff --git a/CHANGELOG.md b/CHANGELOG.md index d245af292..0ca625dce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file. - Command ``SspmScan`` to rescan Sonoff SPM modbus - Support for MQ analog sensor for air quality by Francesco Adriani (#14581) - Command ``SetOption134 1`` to disable PWM auto-phasing for lights by default (new behavior) (#14590) +- Increase PWM channels to 16 (Esp32 only) ### Changed - BME68x-Sensor-API library from v3.5.9 to v4.4.7 diff --git a/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp b/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp index 7347fa74f..b51339b32 100644 --- a/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp +++ b/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp @@ -18,6 +18,7 @@ const uint16_t ST7789_colors[]={ST7789_BLACK,ST7789_WHITE,ST7789_RED,ST7789_GREE ST7789_LIGHTGREY,ST7789_DARKGREY,ST7789_ORANGE,ST7789_GREENYELLOW,ST7789_PINK}; #ifdef ESP32 +#include "esp8266toEsp32.h" #define ST7789_DIMMER #endif @@ -258,11 +259,9 @@ void Arduino_ST7789::commonInit(const uint8_t *cmdList) { } if (_bp>=0) { -#define ESP32_PWM_CHANNEL 1 +// #define ESP32_PWM_CHANNEL 1 #ifdef ST7789_DIMMER - ledcSetup(ESP32_PWM_CHANNEL,4000,8); - ledcAttachPin(_bp,ESP32_PWM_CHANNEL); - ledcWrite(ESP32_PWM_CHANNEL,128); + analogWrite(_bp, 128); #else pinMode(_bp, OUTPUT); #endif @@ -575,7 +574,8 @@ void Arduino_ST7789::DisplayOnff(int8_t on) { writecommand(ST7789_DISPON); //Display on if (_bp>=0) { #ifdef ST7789_DIMMER - ledcWrite(ESP32_PWM_CHANNEL,dimmer); + analogWrite(_bp, dimmer); + // ledcWrite(ESP32_PWM_CHANNEL,dimmer); #else digitalWrite(_bp,HIGH); #endif @@ -584,7 +584,8 @@ void Arduino_ST7789::DisplayOnff(int8_t on) { writecommand(ST7789_DISPOFF); if (_bp>=0) { #ifdef ST7789_DIMMER - ledcWrite(ESP32_PWM_CHANNEL,0); + analogWrite(_bp, 0); + // ledcWrite(ESP32_PWM_CHANNEL,0); #else digitalWrite(_bp,LOW); #endif @@ -598,7 +599,8 @@ void Arduino_ST7789::dim(uint8_t dim) { if (dimmer>15) dimmer=15; dimmer=((float)dimmer/15.0)*255.0; #ifdef ESP32 - ledcWrite(ESP32_PWM_CHANNEL,dimmer); + analogWrite(_bp, dimmer); + // ledcWrite(ESP32_PWM_CHANNEL,dimmer); #endif } diff --git a/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.cpp b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.cpp index e09ab71a8..d71a77368 100644 --- a/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.cpp +++ b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.cpp @@ -59,10 +59,10 @@ uint16_t Renderer::GetColorFromIndex(uint8_t index) { void Renderer::dim(uint8_t contrast) { uint8_t contrast8 = ((uint32_t)contrast * 255) / 15; - dim8(contrast8, contrast8); + dim10(contrast8, contrast8 * 4); } -void Renderer::dim8(uint8_t contrast, uint8_t contrast_gamma) { +void Renderer::dim10(uint8_t contrast, uint16_t contrast_gamma) { } diff --git a/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h index 3e3304fbb..925b0ad7d 100644 --- a/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h +++ b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h @@ -72,7 +72,7 @@ public: virtual void Begin(int16_t p1,int16_t p2,int16_t p3); virtual void Updateframe(); virtual void dim(uint8_t contrast); // input has range 0..15 - virtual void dim8(uint8_t contrast, uint8_t contrast_gamma); // input has range 0..255, second arg has gamma correction for PWM + virtual void dim10(uint8_t contrast, uint16_t contrast_gamma); // input has range 0..255, second arg has gamma correction for PWM with 10 bits resolution virtual void pushColors(uint16_t *data, uint16_t len, boolean first); virtual void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); virtual void invertDisplay(boolean i); diff --git a/lib/lib_display/ILI9341-gemu-1.0/ILI9341_2.cpp b/lib/lib_display/ILI9341-gemu-1.0/ILI9341_2.cpp index 4459eb957..2da8d4091 100644 --- a/lib/lib_display/ILI9341-gemu-1.0/ILI9341_2.cpp +++ b/lib/lib_display/ILI9341-gemu-1.0/ILI9341_2.cpp @@ -53,6 +53,7 @@ // ESP32 uses 2. SPI BUS, ESP8266 uses software spi #ifdef ESP32 +#include "esp8266toEsp32.h" #undef ILI9341_2_DIMMER #define ILI9341_2_DIMMER #undef ESP32_PWM_CHANNEL @@ -248,9 +249,7 @@ void ILI9341_2::init(uint16_t width, uint16_t height) { if (_bp >= 0) { #ifdef ILI9341_2_DIMMER - ledcSetup(ESP32_PWM_CHANNEL, 4000, 8); - ledcAttachPin(_bp, ESP32_PWM_CHANNEL); - ledcWrite(ESP32_PWM_CHANNEL, 128); + analogWrite(_bp, 511); #else pinMode(_bp, OUTPUT); #endif @@ -544,7 +543,8 @@ void ILI9341_2::DisplayOnff(int8_t on) { SPI_END_TRANSACTION(); if (_bp >= 0) { #ifdef ILI9341_2_DIMMER - ledcWrite(ESP32_PWM_CHANNEL, dimmer); + analogWrite(_bp, dimmer * 4); + // ledcWrite(ESP32_PWM_CHANNEL, dimmer); #else digitalWrite(_bp, HIGH); #endif @@ -557,7 +557,8 @@ void ILI9341_2::DisplayOnff(int8_t on) { SPI_END_TRANSACTION(); if (_bp >= 0) { #ifdef ILI9341_2_DIMMER - ledcWrite(ESP32_PWM_CHANNEL, 0); + analogWrite(_bp, 0); + // ledcWrite(ESP32_PWM_CHANNEL, 0); #else digitalWrite(_bp, LOW); #endif @@ -604,7 +605,8 @@ void ILI9341_2::dim(uint8_t dim) { dimmer=((float)dimmer/15.0)*255.0; #ifdef ESP32 if (_bp>=0) { - ledcWrite(ESP32_PWM_CHANNEL,dimmer); + analogWrite(_bp, dimmer * 4); + // ledcWrite(ESP32_PWM_CHANNEL,dimmer); } else { if (_hwspi>=2) { //ili9342_dimm(dim); diff --git a/lib/lib_display/UDisplay/uDisplay.cpp b/lib/lib_display/UDisplay/uDisplay.cpp index f6ac1a20b..4581cee9c 100755 --- a/lib/lib_display/UDisplay/uDisplay.cpp +++ b/lib/lib_display/UDisplay/uDisplay.cpp @@ -20,6 +20,10 @@ #include #include "uDisplay.h" +#ifdef ESP32 +#include "esp8266toEsp32.h" +#endif + // #define UDSP_DEBUG const uint16_t udisp_colors[]={UDISP_BLACK,UDISP_WHITE,UDISP_RED,UDISP_GREEN,UDISP_BLUE,UDISP_CYAN,UDISP_MAGENTA,\ @@ -428,9 +432,7 @@ Renderer *uDisplay::Init(void) { if (bpanel >= 0) { #ifdef ESP32 - ledcSetup(ESP32_PWM_CHANNEL, 977, 8); // use 10 bits resolution like in Light - ledcAttachPin(bpanel, ESP32_PWM_CHANNEL); - ledcWrite(ESP32_PWM_CHANNEL, 8); // 38/255 correspond roughly to 50% visual brighness (with Gamma) + analogWrite(bpanel, 32); #else pinMode(bpanel, OUTPUT); digitalWrite(bpanel, HIGH); @@ -1353,7 +1355,8 @@ void uDisplay::DisplayOnff(int8_t on) { if (dsp_on != 0xff) spi_command_one(dsp_on); if (bpanel >= 0) { #ifdef ESP32 - ledcWrite(ESP32_PWM_CHANNEL, dimmer8_gamma); + analogWrite(bpanel, dimmer10_gamma); + // ledcWrite(ESP32_PWM_CHANNEL, dimmer8_gamma); #else digitalWrite(bpanel, HIGH); #endif @@ -1363,7 +1366,8 @@ void uDisplay::DisplayOnff(int8_t on) { if (dsp_off != 0xff) spi_command_one(dsp_off); if (bpanel >= 0) { #ifdef ESP32 - ledcWrite(ESP32_PWM_CHANNEL, 0); + analogWrite(bpanel, 0); + // ledcWrite(ESP32_PWM_CHANNEL, 0); #else digitalWrite(bpanel, LOW); #endif @@ -1402,16 +1406,17 @@ void udisp_dimm(uint8_t dim); // } // dim is 0..255 -void uDisplay::dim8(uint8_t dim, uint8_t dim_gamma) { // dimmer with 8 bits resolution, 0..255. Gamma correction must be done by caller +void uDisplay::dim10(uint8_t dim, uint16_t dim_gamma) { // dimmer with 8 bits resolution, 0..255. Gamma correction must be done by caller dimmer8 = dim; - dimmer8_gamma = dim_gamma; + dimmer10_gamma = dim_gamma; if (ep_mode) { return; } #ifdef ESP32 // TODO should we also add a ESP8266 version for bpanel? if (bpanel >= 0) { // is the BaclPanel GPIO configured - ledcWrite(ESP32_PWM_CHANNEL, dimmer8_gamma); + analogWrite(bpanel, dimmer10_gamma); + // ledcWrite(ESP32_PWM_CHANNEL, dimmer8_gamma); } else if (dim_cbp) { dim_cbp(dim); } diff --git a/lib/lib_display/UDisplay/uDisplay.h b/lib/lib_display/UDisplay/uDisplay.h index 3dbc5aed7..b5eae65c5 100755 --- a/lib/lib_display/UDisplay/uDisplay.h +++ b/lib/lib_display/UDisplay/uDisplay.h @@ -74,9 +74,6 @@ enum uColorType { uCOLOR_BW, uCOLOR_COLOR }; #define SPI_DC_LOW if (spi_dc >= 0) GPIO_CLR_SLOW(spi_dc); #define SPI_DC_HIGH if (spi_dc >= 0) GPIO_SET_SLOW(spi_dc); - -#define ESP32_PWM_CHANNEL 1 - #define LUTMAXSIZE 64 class uDisplay : public Renderer { @@ -93,7 +90,7 @@ class uDisplay : public Renderer { uint16_t bgcol(void); int8_t color_type(void); // void dim(uint8_t dim); // original version with 4 bits resolution 0..15 - virtual void dim8(uint8_t dim, uint8_t dim_gamma); // dimmer with 8 bits resolution, 0..255. Gamma correction must be done by caller + virtual void dim10(uint8_t dim, uint16_t dim_gamma); // dimmer with 8 bits resolution, 0..255. Gamma correction must be done by caller with 10 bits resolution uint16_t GetColorFromIndex(uint8_t index); void setRotation(uint8_t m); void fillScreen(uint16_t color); @@ -186,7 +183,7 @@ class uDisplay : public Renderer { int8_t bpanel; // backbanel GPIO, -1 if none int8_t spi_miso; uint8_t dimmer8; // 8 bits resolution, 0..255 - uint8_t dimmer8_gamma; // 8 bits resolution, 0..255, gamma corrected + uint16_t dimmer10_gamma; // 10 bits resolution, 0..1023, gamma corrected SPIClass *uspi; uint8_t sspi; SPISettings spiSettings; diff --git a/lib/lib_div/lib_mail/src/wcs/esp8266/ESP_Mail_WCS.cpp b/lib/lib_div/lib_mail/src/wcs/esp8266/ESP_Mail_WCS.cpp index f24adaef3..d419a9249 100755 --- a/lib/lib_div/lib_mail/src/wcs/esp8266/ESP_Mail_WCS.cpp +++ b/lib/lib_div/lib_mail/src/wcs/esp8266/ESP_Mail_WCS.cpp @@ -50,7 +50,9 @@ extern "C" #include #include #include -#include +#ifdef ESP8266 + #include +#endif #include #if !CORE_MOCK diff --git a/lib/lib_ssl/tls_mini/src/WiFiClientSecureLightBearSSL.cpp b/lib/lib_ssl/tls_mini/src/WiFiClientSecureLightBearSSL.cpp index d714c4bd0..4028c4c5e 100755 --- a/lib/lib_ssl/tls_mini/src/WiFiClientSecureLightBearSSL.cpp +++ b/lib/lib_ssl/tls_mini/src/WiFiClientSecureLightBearSSL.cpp @@ -43,8 +43,8 @@ #include "lwip/netif.h" #ifdef ESP8266 #include + #include "c_types.h" #endif -#include "c_types.h" #include #undef DEBUG_TLS diff --git a/lib/libesp32/ESP32-to-ESP8266-compat/src/c_types.h b/lib/libesp32/ESP32-to-ESP8266-compat/src/c_types.h deleted file mode 100644 index 22f551391..000000000 --- a/lib/libesp32/ESP32-to-ESP8266-compat/src/c_types.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once -/**/ -#include -#ifndef ICACHE_FLASH_ATTR -#define ICACHE_FLASH_ATTR -#endif diff --git a/lib/libesp32/ESP32-to-ESP8266-compat/src/eboot_command.h b/lib/libesp32/ESP32-to-ESP8266-compat/src/eboot_command.h deleted file mode 100644 index 992d014ea..000000000 --- a/lib/libesp32/ESP32-to-ESP8266-compat/src/eboot_command.h +++ /dev/null @@ -1,3 +0,0 @@ -// -// Compat with ESP32 -// diff --git a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp index fbead560a..69b0295ec 100644 --- a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp +++ b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp @@ -13,58 +13,64 @@ along with this program. If not, see . */ -// + +#ifdef ESP32 + #include "Arduino.h" -//#include "lwip/apps/sntp.h" -#include - -// See libraries\ESP32\examples\ResetReason.ino -#if ESP_IDF_VERSION_MAJOR > 3 // IDF 4+ - #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 - #include "esp32/rom/rtc.h" - #elif CONFIG_IDF_TARGET_ESP32S2 // ESP32-S2 - #include "esp32s2/rom/rtc.h" - #elif CONFIG_IDF_TARGET_ESP32C3 // ESP32-C3 - #include "esp32c3/rom/rtc.h" - #else - #error Target CONFIG_IDF_TARGET is not supported - #endif -#else // ESP32 Before IDF 4.0 - #include "rom/rtc.h" -#endif - -#include #include "esp8266toEsp32.h" +#include "driver/ledc.h" + +// Tasmota Logging +extern void AddLog(uint32_t loglevel, PGM_P formatP, ...); +enum LoggingLevels {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE}; // ESP Stuff +// replicated from `tasmota.h` +#if defined(CONFIG_IDF_TARGET_ESP32) + const uint8_t MAX_PWMS = 16; // ESP32: 16 ledc PWM channels in total - TODO for now +#elif defined(CONFIG_IDF_TARGET_ESP32S2) + const uint8_t MAX_PWMS = 8; // ESP32S2: 8 ledc PWM channels in total +#elif defined(CONFIG_IDF_TARGET_ESP32C3) + const uint8_t MAX_PWMS = 6; // ESP32C3: 6 ledc PWM channels in total +#else + const uint8_t MAX_PWMS = 5; // Unknown - revert to 5 PWM max +#endif + +// channel mapping +static uint8_t pwm_channel[MAX_PWMS]; +static uint32_t pwm_frequency = 977; // Default 977Hz +static uint8_t pwm_bit_num = 10; // Default 1023 +static bool pwm_impl_inited = false; // trigger initialization + /*********************************************************************************************\ * ESP32 analogWrite emulation support \*********************************************************************************************/ -#if CONFIG_IDF_TARGET_ESP32C3 - uint8_t _pwm_channel[PWM_SUPPORTED_CHANNELS] = { 99, 99, 99, 99, 99, 99 }; - uint32_t _pwm_frequency = 977; // Default 977Hz - uint8_t _pwm_bit_num = 10; // Default 1023 -#else // other ESP32 - uint8_t _pwm_channel[PWM_SUPPORTED_CHANNELS] = { 99, 99, 99, 99, 99, 99, 99, 99 }; - uint32_t _pwm_frequency = 977; // Default 977Hz - uint8_t _pwm_bit_num = 10; // Default 1023 -#endif // CONFIG_IDF_TARGET_ESP32C3 vs ESP32 +void _analogInit(void) { + if (pwm_impl_inited) return; + // set all channels to unaffected (255) + for (uint32_t i = 0; i < MAX_PWMS; i++) { + pwm_channel[i] = 255; + } + pwm_impl_inited = true; +} -uint32_t _analog_pin2chan(uint32_t pin) { - for (uint32_t channel = 0; channel < PWM_SUPPORTED_CHANNELS; channel++) { - if ((_pwm_channel[channel] < 99) && (_pwm_channel[channel] == pin)) { +int32_t _analog_pin2chan(uint32_t pin) { // returns -1 if uallocated + _analogInit(); // make sure the mapping array is initialized + for (uint32_t channel = 0; channel < MAX_PWMS; channel++) { + if ((pwm_channel[channel] < 255) && (pwm_channel[channel] == pin)) { return channel; } } - return 0; + return -1; } void _analogWriteFreqRange(void) { - for (uint32_t channel = 0; channel < PWM_SUPPORTED_CHANNELS; channel++) { - if (_pwm_channel[channel] < 99) { - ledcSetup(channel + PWM_CHANNEL_OFFSET, _pwm_frequency, _pwm_bit_num); + _analogInit(); // make sure the mapping array is initialized + for (uint32_t channel = 0; channel < MAX_PWMS; channel++) { + if (pwm_channel[channel] < 255) { + ledcSetup(channel, pwm_frequency, pwm_bit_num); } } } @@ -80,50 +86,43 @@ uint32_t _analogGetResolution(uint32_t x) { } void analogWriteRange(uint32_t range) { - _pwm_bit_num = _analogGetResolution(range); + pwm_bit_num = _analogGetResolution(range); _analogWriteFreqRange(); } void analogWriteFreq(uint32_t freq) { - _pwm_frequency = freq; + pwm_frequency = freq; _analogWriteFreqRange(); } -bool analogAttach(uint32_t pin) { +int32_t analogAttach(uint32_t pin) { // returns ledc channel used, or -1 if failed + _analogInit(); // make sure the mapping array is initialized // Find if pin is already attached - uint32_t channel; - for (channel = 0; channel < PWM_SUPPORTED_CHANNELS; channel++) { - if (_pwm_channel[channel] == pin) { - // Already attached - // Serial.printf("PWM: Already attached pin %d to channel %d\n", pin, channel); - return true; - } - } + int32_t channel = _analog_pin2chan(pin); + if (channel >= 0) { return channel; } // Find an empty channel - for (channel = 0; channel < PWM_SUPPORTED_CHANNELS; channel++) { - if (99 == _pwm_channel[channel]) { - _pwm_channel[channel] = pin; - ledcAttachPin(pin, channel + PWM_CHANNEL_OFFSET); - ledcSetup(channel + PWM_CHANNEL_OFFSET, _pwm_frequency, _pwm_bit_num); + for (channel = 0; channel < MAX_PWMS; channel++) { + if (255 == pwm_channel[channel]) { + pwm_channel[channel] = pin; + ledcAttachPin(pin, channel); + ledcSetup(channel, pwm_frequency, pwm_bit_num); // Serial.printf("PWM: New attach pin %d to channel %d\n", pin, channel); - return true; + return channel; } } // No more channels available - return false; + AddLog(LOG_LEVEL_INFO, "PWM: no more PWM (ledc) channel for GPIO %i", pin); + return -1; } // void analogWrite(uint8_t pin, int val); -extern "C" void __wrap__Z11analogWritehi(uint8_t pin, int val) -{ - uint32_t channel = _analog_pin2chan(pin); - if ( val >> (_pwm_bit_num-1) ) ++val; - ledcWrite(channel + PWM_CHANNEL_OFFSET, val); - // Serial.printf("write %d - %d\n",channel,val); +extern "C" void __wrap__Z11analogWritehi(uint8_t pin, int val) { + analogWritePhase(pin, val, 0); // if unspecified, use phase = 0 } + /* - The primary goal of this library is to add phase control to PWM ledc + The primary goal of this function is to add phase control to PWM ledc functions. Phase control allows to stress less the power supply of LED lights. @@ -142,35 +141,28 @@ extern "C" void __wrap__Z11analogWritehi(uint8_t pin, int val) implementation changes. */ -#include "driver/ledc.h" - -#ifdef SOC_LEDC_SUPPORT_HS_MODE -#define LEDC_CHANNELS (SOC_LEDC_CHANNEL_NUM<<1) -#else -#define LEDC_CHANNELS (SOC_LEDC_CHANNEL_NUM) -#endif - // exported from Arduno Core -extern uint8_t channels_resolution[LEDC_CHANNELS]; +extern uint8_t channels_resolution[MAX_PWMS]; void analogWritePhase(uint8_t pin, uint32_t duty, uint32_t phase) { - uint32_t chan = _analog_pin2chan(pin) + PWM_CHANNEL_OFFSET; - if (duty >> (_pwm_bit_num-1) ) ++duty; - - if(chan >= LEDC_CHANNELS){ - return; + int32_t chan = _analog_pin2chan(pin); + if (chan < 0) { // not yet allocated, try to allocate + chan = analogAttach(pin); + if (chan < 0) { return; } // failed } + + if (duty >> (pwm_bit_num-1) ) ++duty; // input is 0..1023 but PWM takes 0..1024 - so we skip at mid-range. It creates a small non-linearity + if (phase >> (pwm_bit_num-1) ) ++phase; + uint8_t group=(chan/8), channel=(chan%8); //Fixing if all bits in resolution is set = LEDC FULL ON uint32_t max_duty = (1 << channels_resolution[chan]) - 1; - phase = phase % max_duty; - - if(duty == max_duty){ // no sure whether this is needed anymore TODO - duty = max_duty + 1; - } + phase = phase & max_duty; ledc_set_duty_with_hpoint((ledc_mode_t)group, (ledc_channel_t)channel, duty, phase); ledc_update_duty((ledc_mode_t)group, (ledc_channel_t)channel); } + +#endif // ESP32 diff --git a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.h b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.h index adda5f2eb..b32e16bcf 100644 --- a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.h +++ b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.h @@ -13,39 +13,21 @@ along with this program. If not, see . */ -#pragma once +#ifndef __ESP8266TOESP32_H__ +#define __ESP8266TOESP32_H__ + #ifdef ESP32 -// my debug Stuff -#define Serial_Debug1(p) Serial.printf p -#define Serial_DebugX(p) // // basics // -// dummy defines -//#define SPIFFS_END (SPI_FLASH_SEC_SIZE * 200) -//#define SETTINGS_LOCATION SPIFFS_END - #include -#if CONFIG_IDF_TARGET_ESP32C3 - #define PWM_SUPPORTED_CHANNELS 6 - #define PWM_CHANNEL_OFFSET 1 // Webcam uses channel 0, so we offset standard PWM -#else // other ESP32 - #define PWM_SUPPORTED_CHANNELS 8 - #define PWM_CHANNEL_OFFSET 2 // Webcam uses channel 0, so we offset standard PWM -#endif // CONFIG_IDF_TARGET_ESP32C3 vs ESP32 -extern uint8_t _pwm_channel[PWM_SUPPORTED_CHANNELS]; -extern uint32_t _pwm_frequency; -extern uint8_t _pwm_bit_num; - -void _analogWriteFreqRange(void); // input range is in full range, ledc needs bits -uint32_t _analogGetResolution(uint32_t x); void analogWriteRange(uint32_t range); void analogWriteFreq(uint32_t freq); -bool analogAttach(uint32_t pin); +int32_t analogAttach(uint32_t pin); // returns the ledc channel, or -1 if failed. This is implicitly called by analogWrite if the channel was not already allocated void analogWrite(uint8_t pin, int val); // Extended version that also allows to change phase @@ -56,8 +38,6 @@ extern void analogWritePhase(uint8_t pin, uint32_t duty, uint32_t phase = 0); #define INPUT_PULLDOWN_16 INPUT_PULLUP -typedef double real64_t; - // // Time and Timer // @@ -71,7 +51,6 @@ typedef double real64_t; // Serial minimal type to hold the config typedef int SerConfu8; typedef int SerialConfig; -//#define analogWrite(a, b) // // UDP @@ -79,9 +58,6 @@ typedef int SerialConfig; //#define PortUdp_writestr(log_data) PortUdp.write((const uint8_t *)(log_data), strlen(log_data)) #define PortUdp_write(log_data, n) PortUdp.write((const uint8_t *)(log_data), n) -// -#define wifi_forceSleepBegin() - #undef LWIP_IPV6 #define REASON_DEFAULT_RST 0 // "Power on" normal startup by power on @@ -106,4 +82,5 @@ typedef int SerialConfig; #define STATION_IF 0 -#endif +#endif // ESP32 +#endif // __ESP8266TOESP32_H__ diff --git a/lib/libesp32/ESP32-to-ESP8266-compat/src/osapi.h b/lib/libesp32/ESP32-to-ESP8266-compat/src/osapi.h deleted file mode 100644 index 947de57cc..000000000 --- a/lib/libesp32/ESP32-to-ESP8266-compat/src/osapi.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once -/**/ -#include -/* -#ifndef ICACHE_FLASH_ATTR -#define ICACHE_FLASH_ATTR -#endif -*/ diff --git a/tasmota/settings.h b/tasmota/settings.h index c4be5aaee..8c2a25e41 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -474,7 +474,7 @@ typedef struct { TimeRule tflag[2]; // 2E2 uint16_t pwm_frequency; // 2E6 power_t power; // 2E8 - uint16_t pwm_value[MAX_PWMS]; // 2EC + uint16_t pwm_value[MAX_PWMS_LEGACY];// 2EC int16_t altitude; // 2F6 uint16_t tele_period; // 2F8 uint8_t display_rotate; // 2FA @@ -579,7 +579,7 @@ typedef struct { uint8_t ex_my_adc0; // 495 Free since 9.0.0.1 uint16_t light_pixels; // 496 - uint8_t light_color[5]; // 498 + uint8_t light_color[LST_MAX]; // 498 LST_MAX = 5 uint8_t light_correction; // 49D uint8_t light_dimmer; // 49E uint8_t rule_enabled; // 49F @@ -614,7 +614,8 @@ typedef struct { uint32_t ipv4_rgx_address; // 558 uint32_t ipv4_rgx_subnetmask; // 55C - uint8_t free_560[92]; // 560 + uint16_t pwm_value_ext[16-5]; // 560 Extension to pwm_value to store up to 16 PWM for ESP32. This array stores values 5..15 + uint8_t free_560[70]; // 576 SysMBitfield1 flag2; // 5BC uint32_t pulse_counter[MAX_COUNTERS]; // 5C0 diff --git a/tasmota/settings.ino b/tasmota/settings.ino index 774b5dadf..a0cc34555 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -184,10 +184,11 @@ bool RtcRebootValid(void) { extern "C" { #include "spi_flash.h" } -#include "eboot_command.h" #ifdef ESP8266 +#include "eboot_command.h" + extern "C" uint32_t _FS_start; // 1M = 0x402fb000, 2M = 0x40300000, 4M = 0x40300000 const uint32_t FLASH_FS_START = (((uint32_t)&_FS_start - 0x40200000) / SPI_FLASH_SEC_SIZE); uint32_t SETTINGS_LOCATION = FLASH_FS_START -1; // 0xFA, 0x0FF or 0x0FF @@ -1094,7 +1095,7 @@ void SettingsDefaultSet2(void) { Settings->pwm_frequency = PWM_FREQ; Settings->pwm_range = PWM_RANGE; - for (uint32_t i = 0; i < MAX_PWMS; i++) { + for (uint32_t i = 0; i < LST_MAX; i++) { Settings->light_color[i] = DEFAULT_LIGHT_COMPONENT; // Settings->pwm_value[i] = 0; } diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index c93cae16b..7f191d7b9 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -1523,56 +1523,6 @@ void CmndTemplate(void) if (!error) { TemplateJson(); } } -void CmndPwm(void) -{ - if (TasmotaGlobal.pwm_present && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_PWMS)) { - if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= Settings->pwm_range) && PinUsed(GPIO_PWM1, XdrvMailbox.index -1)) { - Settings->pwm_value[XdrvMailbox.index -1] = XdrvMailbox.payload; - analogWrite(Pin(GPIO_PWM1, XdrvMailbox.index -1), bitRead(TasmotaGlobal.pwm_inverted, XdrvMailbox.index -1) ? Settings->pwm_range - XdrvMailbox.payload : XdrvMailbox.payload); - } - Response_P(PSTR("{")); - MqttShowPWMState(); // Render the PWM status to MQTT - ResponseJsonEnd(); - } -} - -void CmndPwmfrequency(void) -{ - if ((1 == XdrvMailbox.payload) || ((XdrvMailbox.payload >= PWM_MIN) && (XdrvMailbox.payload <= PWM_MAX))) { - Settings->pwm_frequency = (1 == XdrvMailbox.payload) ? PWM_FREQ : XdrvMailbox.payload; - analogWriteFreq(Settings->pwm_frequency); // Default is 1000 (core_esp8266_wiring_pwm.c) -#ifdef USE_LIGHT - LightReapplyColor(); - LightAnimate(); -#endif // USE_LIGHT - } - ResponseCmndNumber(Settings->pwm_frequency); -} - -void CmndPwmrange(void) { - // Support only 8 (=255), 9 (=511) and 10 (=1023) bits resolution - if ((1 == XdrvMailbox.payload) || ((XdrvMailbox.payload > 254) && (XdrvMailbox.payload < 1024))) { - uint32_t pwm_range = XdrvMailbox.payload; - uint32_t pwm_resolution = 0; - while (pwm_range) { - pwm_resolution++; - pwm_range >>= 1; - } - pwm_range = (1 << pwm_resolution) - 1; - uint32_t old_pwm_range = Settings->pwm_range; - Settings->pwm_range = (1 == XdrvMailbox.payload) ? PWM_RANGE : pwm_range; - for (uint32_t i = 0; i < MAX_PWMS; i++) { - if (Settings->pwm_value[i] > Settings->pwm_range) { - Settings->pwm_value[i] = Settings->pwm_range; - } - } - if (Settings->pwm_range != old_pwm_range) { // On ESP32 this prevents loss of duty state - analogWriteRange(Settings->pwm_range); // Default is 1023 (Arduino.h) - } - } - ResponseCmndNumber(Settings->pwm_range); -} - void CmndButtonDebounce(void) { if ((XdrvMailbox.payload > 39) && (XdrvMailbox.payload < 1001)) { diff --git a/tasmota/support_pwm.ino b/tasmota/support_pwm.ino new file mode 100644 index 000000000..82e4bdd7e --- /dev/null +++ b/tasmota/support_pwm.ino @@ -0,0 +1,273 @@ +/* + support_pwm.ino - command support for Tasmota + + Copyright (C) 2021 Theo Arends & Stephan Hadinger + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + + +/***********************************************************************\ + * PWM Control for ESP32 +\***********************************************************************/ +#ifdef ESP32 + +// All changes in PWM have been applied, rearm all change indicators +void PwmRearmChanges(void) { + for (uint32_t i = 0; i < MAX_PWMS; i++) { + // Init expected changes + TasmotaGlobal.pwm_value[i] = -1; // no change wanted + TasmotaGlobal.pwm_phase[i] = -1; // no change wanted + } +} + +// Load PWM values from settings and intiliaze values +// void PwmLoadFromSettings(void) { +// for (uint32_t i = 0; i < MAX_PWMS; i++) { +// if (i < MAX_PWMS_LEGACY) { +// TasmotaGlobal.pwm_cur_value[i] = Settings->pwm_value[i]; // retrieve in Legacy pool for 0..4 +// } else { +// TasmotaGlobal.pwm_cur_value[i] = Settings->pwm_value_ext[i - MAX_PWMS_LEGACY]; // retrieve in Legacy pool for 5..15 +// } +// TasmotaGlobal.pwm_cur_phase[i] = 0; // no phase shift for now, will be recomputed at first push to GPIOs +// } +// PwmRearmChanges(); // reset expected changes +// } + +// Copy current values to Settings +void PwmSaveToSettings(void) { + for (uint32_t i = 0; i < MAX_PWMS; i++) { + if (i < MAX_PWMS_LEGACY) { + Settings->pwm_value[i] = TasmotaGlobal.pwm_cur_value[i]; // store in Legacy pool for 0..4 + } else { + Settings->pwm_value_ext[i - MAX_PWMS_LEGACY] = TasmotaGlobal.pwm_cur_value[i]; // retrieve in Legacy pool for 5..15 + } + } +} + +/***********************************************************************\ + * PWM Control for ESP32 +\***********************************************************************/ +// Apply PWM expected values to actual GPIO PWM +// As input, `TasmotaGlobal.pwm_value[]` and `TasmotaGlobal.pwm_phase[]` contain the new expected values +// or `-1` if no change. +// Auto-phasing is recomputed, and changes are applied to GPIO if there is a physical GPIO configured and an actual change needed +// +void PwmApplyGPIO(void) { + uint32_t pwm_phase_accumulator = 0; // dephase each PWM channel with the value of the previous + + for (uint32_t i = 0; i < MAX_PWMS; i++) { + // compute `pwm_val`, the virtual value of PWM (not taking into account inverted) + uint32_t pwm_val = TasmotaGlobal.pwm_cur_value[i]; // logical value of PWM, 0..1023 + if (TasmotaGlobal.pwm_value[i] >= 0) { pwm_val = TasmotaGlobal.pwm_value[i]; } // new value explicitly specified + if (pwm_val > Settings->pwm_range) { pwm_val = Settings->pwm_range; } // prevent overflow + + // gpio_val : actual value of GPIO, taking into account inversion + uint32_t gpio_val = bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - pwm_val : pwm_val; + + // compute phase + uint32_t pwm_phase = TasmotaGlobal.pwm_cur_phase[i]; // pwm_phase is the logical phase of the active pulse, ignoring inverted + uint32_t gpio_phase = pwm_phase; // gpio is the physical phase taking into account inverted + if (TasmotaGlobal.pwm_phase[i] >= 0) { + pwm_phase = TasmotaGlobal.pwm_phase[i]; // if explicit set explicitly, + } else if (Settings->flag5.pwm_force_same_phase) { + pwm_phase = 0; // if auto-phase is off + } else { + // compute auto-phase + pwm_phase = pwm_phase_accumulator; + uint32_t pwm_phase_invert = bitRead(TasmotaGlobal.pwm_inverted, i) ? pwm_val : 0; // move phase if inverted + gpio_phase = (pwm_phase + pwm_phase_invert) & Settings->pwm_range; + // accumulate phase for next GPIO + pwm_phase_accumulator = (pwm_phase + pwm_val) & Settings->pwm_range; + } + + // apply new values to GPIO if GPIO is set + if (PinUsed(GPIO_PWM1, i)) { + if ((pwm_val != TasmotaGlobal.pwm_cur_value[i]) || (pwm_phase != TasmotaGlobal.pwm_cur_phase[i])) { + // GPIO has PWM and there is a chnage to apply, apply it + analogWritePhase(Pin(GPIO_PWM1, i), gpio_val, gpio_phase); + } + } + + // set new current values + TasmotaGlobal.pwm_cur_value[i] = pwm_val; + TasmotaGlobal.pwm_cur_phase[i] = pwm_phase; + } + // AddLog(LOG_LEVEL_INFO, "PWM: Val=%03X-%03X-%03X-%03X-%03X Phase=%03X-%03X-%03X-%03X-%03X Range=%03X", + // TasmotaGlobal.pwm_cur_value[0], TasmotaGlobal.pwm_cur_value[1], TasmotaGlobal.pwm_cur_value[2], TasmotaGlobal.pwm_cur_value[3], + // TasmotaGlobal.pwm_cur_value[4], + // TasmotaGlobal.pwm_cur_phase[0], TasmotaGlobal.pwm_cur_phase[1], TasmotaGlobal.pwm_cur_phase[2], TasmotaGlobal.pwm_cur_phase[3], + // TasmotaGlobal.pwm_cur_phase[4], + // Settings->pwm_range + // ); + PwmSaveToSettings(); // copy to Settings + PwmRearmChanges(); // reset expected changes +} + +void CmndPwm(void) +{ + if (TasmotaGlobal.pwm_present && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_PWMS)) { + if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= Settings->pwm_range) && PinUsed(GPIO_PWM1, XdrvMailbox.index -1)) { + TasmotaGlobal.pwm_value[XdrvMailbox.index - 1] = XdrvMailbox.payload; + PwmApplyGPIO(); + } + Response_P(PSTR("{")); + MqttShowPWMState(); // Render the PWM status to MQTT + ResponseJsonEnd(); + } +} + +void GpioInitPwm(void) { + PwmRearmChanges(); + + for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only + if (PinUsed(GPIO_PWM1, i)) { + analogAttach(Pin(GPIO_PWM1, i)); + if (i < TasmotaGlobal.light_type) { + // force PWM GPIOs to black + TasmotaGlobal.pwm_value[i] = 0; + } else { + TasmotaGlobal.pwm_present = true; + if (i < MAX_PWMS_LEGACY) { + TasmotaGlobal.pwm_value[i] = Settings->pwm_value[i]; + } else { + TasmotaGlobal.pwm_value[i] = Settings->pwm_value_ext[i - MAX_PWMS_LEGACY]; + } + } + } + } + PwmApplyGPIO(); // apply all changes +} + +/********************************************************************************************/ + +void ResetPwm(void) +{ + for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only + TasmotaGlobal.pwm_value[i] = 0; + } + PwmApplyGPIO(); +} + +#else // now for ESP8266 + +void PwmRearmChanges(void) {} + +void CmndPwm(void) +{ + if (TasmotaGlobal.pwm_present && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_PWMS)) { + if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= Settings->pwm_range) && PinUsed(GPIO_PWM1, XdrvMailbox.index -1)) { + uint32_t pwm_index = XdrvMailbox.index - 1; + if (pwm_index < MAX_PWMS_LEGACY) { // write in the appropriate settings pool + Settings->pwm_value[pwm_index] = XdrvMailbox.payload; + } else { + Settings->pwm_value_ext[pwm_index - MAX_PWMS_LEGACY] = XdrvMailbox.payload; + } + analogWrite(Pin(GPIO_PWM1, pwm_index), bitRead(TasmotaGlobal.pwm_inverted, pwm_index) ? Settings->pwm_range - XdrvMailbox.payload : XdrvMailbox.payload); + } + Response_P(PSTR("{")); + MqttShowPWMState(); // Render the PWM status to MQTT + ResponseJsonEnd(); + } +} + +void GpioInitPwm(void) { + for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only + if (PinUsed(GPIO_PWM1, i)) { + pinMode(Pin(GPIO_PWM1, i), OUTPUT); + if (i < TasmotaGlobal.light_type) { + // force PWM GPIOs to low or high mode if belongs to the light (always <5), see #7165 + analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range : 0); + } else { + TasmotaGlobal.pwm_present = true; + if (i < MAX_PWMS_LEGACY) { + analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - Settings->pwm_value[i] : Settings->pwm_value[i]); + } else { + analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - Settings->pwm_value_ext[i] : Settings->pwm_value_ext[i]); + } + } + } + } +} + +/********************************************************************************************/ + +void ResetPwm(void) +{ + for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only + if (PinUsed(GPIO_PWM1, i)) { + analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range : 0); +// analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - Settings->pwm_value[i] : Settings->pwm_value[i]); + } + } +} + +#endif // ESP8266 + +void CmndPwmfrequency(void) +{ + if ((1 == XdrvMailbox.payload) || ((XdrvMailbox.payload >= PWM_MIN) && (XdrvMailbox.payload <= PWM_MAX))) { + Settings->pwm_frequency = (1 == XdrvMailbox.payload) ? PWM_FREQ : XdrvMailbox.payload; + analogWriteFreq(Settings->pwm_frequency); // Default is 1000 (core_esp8266_wiring_pwm.c) +#ifdef USE_LIGHT + LightReapplyColor(); + LightAnimate(); +#endif // USE_LIGHT + } + ResponseCmndNumber(Settings->pwm_frequency); +} + +void CmndPwmrange(void) { + // Support only 8 (=255), 9 (=511) and 10 (=1023) bits resolution + if ((1 == XdrvMailbox.payload) || ((XdrvMailbox.payload > 254) && (XdrvMailbox.payload < 1024))) { + uint32_t pwm_range = XdrvMailbox.payload; + uint32_t pwm_resolution = 0; + while (pwm_range) { + pwm_resolution++; + pwm_range >>= 1; + } + pwm_range = (1 << pwm_resolution) - 1; + uint32_t old_pwm_range = Settings->pwm_range; + Settings->pwm_range = (1 == XdrvMailbox.payload) ? PWM_RANGE : pwm_range; + for (uint32_t i = 0; i < MAX_PWMS; i++) { + if (i < MAX_PWMS_LEGACY) { + if (Settings->pwm_value[i] > Settings->pwm_range) { + Settings->pwm_value[i] = Settings->pwm_range; + } + } else { + if (Settings->pwm_value_ext[i - MAX_PWMS_LEGACY] > Settings->pwm_range) { + Settings->pwm_value_ext[i - MAX_PWMS_LEGACY] = Settings->pwm_range; + } + } + } + if (Settings->pwm_range != old_pwm_range) { // On ESP32 this prevents loss of duty state + analogWriteRange(Settings->pwm_range); // Default is 1023 (Arduino.h) + } + } + ResponseCmndNumber(Settings->pwm_range); +} + +void MqttShowPWMState(void) +{ + ResponseAppend_P(PSTR("\"" D_CMND_PWM "\":{")); + bool first = true; + for (uint32_t i = 0; i < MAX_PWMS; i++) { // TODO + if (PinUsed(GPIO_PWM1, i)) { + uint32_t pwm_val = (i < MAX_PWMS_LEGACY) ? Settings->pwm_value[i] : Settings->pwm_value_ext[i - MAX_PWMS_LEGACY]; + ResponseAppend_P(PSTR("%s\"" D_CMND_PWM "%d\":%d"), first ? "" : ",", i+1, pwm_val); + first = false; + } + } + ResponseJsonEnd(); +} diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index 5cfc2ad4f..78553c201 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -444,7 +444,7 @@ void SetLedPowerIdx(uint32_t led, uint32_t state) pwm = changeUIntScale((uint16_t)(state ? Settings->ledpwm_on : Settings->ledpwm_off), 0, 255, 0, Settings->pwm_range); // linear #endif //USE_LIGHT #ifdef ESP32 - if (analogAttach(Pin(GPIO_LED1, led))) + if (analogAttach(Pin(GPIO_LED1, led)) >= 0) #endif analogWrite(Pin(GPIO_LED1, led), bitRead(TasmotaGlobal.led_inverted, led) ? Settings->pwm_range - pwm : pwm); } else { @@ -735,19 +735,6 @@ void StopAllPowerBlink(void) } } -void MqttShowPWMState(void) -{ - ResponseAppend_P(PSTR("\"" D_CMND_PWM "\":{")); - bool first = true; - for (uint32_t i = 0; i < MAX_PWMS; i++) { - if (PinUsed(GPIO_PWM1, i)) { - ResponseAppend_P(PSTR("%s\"" D_CMND_PWM "%d\":%d"), first ? "" : ",", i+1, Settings->pwm_value[i]); - first = false; - } - } - ResponseJsonEnd(); -} - void MqttShowState(void) { char stemp1[TOPSZ]; @@ -1670,17 +1657,6 @@ void SerialInput(void) } } -/********************************************************************************************/ - -void ResetPwm(void) -{ - for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only - if (PinUsed(GPIO_PWM1, i)) { - analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range : 0); -// analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - Settings->pwm_value[i] : Settings->pwm_value[i]); - } - } -} /********************************************************************************************/ @@ -1825,7 +1801,7 @@ void GpioInit(void) mpin -= (AGPIO(GPIO_HEARTBEAT_INV) - AGPIO(GPIO_HEARTBEAT)); } else if ((mpin >= AGPIO(GPIO_PWM1_INV)) && (mpin < (AGPIO(GPIO_PWM1_INV) + MAX_PWMS))) { - bitSet(TasmotaGlobal.pwm_inverted, mpin - AGPIO(GPIO_PWM1_INV)); + bitSet(TasmotaGlobal.pwm_inverted, mpin - AGPIO(GPIO_PWM1_INV)); // PWMi are later converted to PMW, but marked as inverted in TasmotaGlobal.pwm_inverted mpin -= (AGPIO(GPIO_PWM1_INV) - AGPIO(GPIO_PWM1)); } else if (XdrvCall(FUNC_PIN_STATE)) { @@ -2002,23 +1978,7 @@ void GpioInit(void) #endif // USE_SONOFF_SC #endif // ESP8266 - for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only - if (PinUsed(GPIO_PWM1, i)) { -#ifdef ESP8266 - pinMode(Pin(GPIO_PWM1, i), OUTPUT); -#endif // ESP8266 -#ifdef ESP32 - analogAttach(Pin(GPIO_PWM1, i)); -#endif // ESP32 - if (TasmotaGlobal.light_type) { - // force PWM GPIOs to low or high mode, see #7165 - analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range : 0); - } else { - TasmotaGlobal.pwm_present = true; - analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - Settings->pwm_value[i] : Settings->pwm_value[i]); - } - } - } + GpioInitPwm(); for (uint32_t i = 0; i < MAX_RELAYS; i++) { if (PinUsed(GPIO_REL1, i)) { diff --git a/tasmota/tasmota.h b/tasmota/tasmota.h index 150c6c729..3784e21d5 100644 --- a/tasmota/tasmota.h +++ b/tasmota/tasmota.h @@ -60,7 +60,21 @@ const uint8_t MAX_KEYS = 8; // Max number of keys or buttons (up const uint8_t MAX_INTERLOCKS_SET = 14; // Max number of interlock groups (MAX_RELAYS / 2) const uint8_t MAX_SWITCHES_SET = 28; // Max number of switches const uint8_t MAX_LEDS = 4; // Max number of leds -const uint8_t MAX_PWMS = 5; // Max number of PWM channels +const uint8_t MAX_PWMS_LEGACY = 5; // Max number of PWM channels in first settings block - Legacy limit for ESP8266, but extended for ESP32 (see below) +#ifdef ESP32 + // Max number of PWM channels (total including extended) - ESP32 only + #if defined(CONFIG_IDF_TARGET_ESP32) + const uint8_t MAX_PWMS = 16; // ESP32: 16 ledc PWM channels in total - TODO for now + #elif defined(CONFIG_IDF_TARGET_ESP32S2) + const uint8_t MAX_PWMS = 8; // ESP32S2: 8 ledc PWM channels in total + #elif defined(CONFIG_IDF_TARGET_ESP32C3) + const uint8_t MAX_PWMS = 6; // ESP32C3: 6 ledc PWM channels in total + #else + const uint8_t MAX_PWMS = 5; // Unknown - revert to 5 PWM max + #endif +#else + const uint8_t MAX_PWMS = 5; // (not used on ESP8266) +#endif const uint8_t MAX_COUNTERS = 4; // Max number of counter sensors const uint8_t MAX_TIMERS = 16; // Max number of Timers const uint8_t MAX_PULSETIMERS = 8; // Max number of supported pulse timers diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index a208a44bc..d46e3cf4e 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -154,6 +154,13 @@ struct TasmotaGlobal_t { bool enable_logging; // Enable logging StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits) + uint16_t pwm_inverted; // PWM inverted flag (1 = inverted) - extended to 16 bits for ESP32 +#ifdef ESP32 + int16_t pwm_cur_value[MAX_PWMS]; // Current effective values of PWMs as applied to GPIOs + int16_t pwm_cur_phase[MAX_PWMS]; // Current phase values of PWMs as applied to GPIOs + int16_t pwm_value[MAX_PWMS]; // Wanted values of PWMs after update - -1 means no change + int16_t pwm_phase[MAX_PWMS]; // Wanted phase of PWMs after update - -1 means no change +#endif // ESP32 uint8_t init_state; // Tasmota init state uint8_t heartbeat_inverted; // Heartbeat pulse inverted flag uint8_t spi_enabled; // SPI configured @@ -172,7 +179,7 @@ struct TasmotaGlobal_t { uint8_t led_inverted; // LED inverted flag (1 = (0 = On, 1 = Off)) uint8_t led_power; // LED power state uint8_t ledlnk_inverted; // Link LED inverted flag (1 = (0 = On, 1 = Off)) - uint8_t pwm_inverted; // PWM inverted flag (1 = inverted) + // uint8_t pwm_inverted; // PWM inverted flag (1 = inverted) -- TODO uint8_t energy_driver; // Energy monitor configured uint8_t light_driver; // Light module configured uint8_t light_type; // Light types diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index 86efb5c41..5ccb040d3 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -448,8 +448,8 @@ const uint16_t kGpioNiceList[] PROGMEM = { AGPIO(GPIO_CNTR1) + MAX_COUNTERS, // Counters AGPIO(GPIO_CNTR1_NP) + MAX_COUNTERS, #endif - AGPIO(GPIO_PWM1) + MAX_PWMS, // RGB Red or C Cold White - AGPIO(GPIO_PWM1_INV) + MAX_PWMS, + AGPIO(GPIO_PWM1) + MAX_PWMS, // RGB Red or C Cold White + AGPIO(GPIO_PWM1_INV) + MAX_PWMS, // or extended PWM for ESP32 #ifdef USE_BUZZER AGPIO(GPIO_BUZZER), // Buzzer AGPIO(GPIO_BUZZER_INV), // Inverted buzzer diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 09181bfbb..f7448dc77 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -227,7 +227,7 @@ struct LIGHT { uint8_t old_power = 1; uint8_t wakeup_active = 0; // 0=inctive, 1=on-going, 2=about to start, 3=will be triggered next cycle uint8_t fixed_color_index = 1; - uint8_t pwm_offset = 0; // Offset in color buffer + uint8_t pwm_offset = 0; // Offset in color buffer, used by sm16716 to drive itself RGB, and PWM for CCT (value is 0 or 3) uint8_t max_scheme = LS_MAX -1; uint32_t wakeup_start_time = 0; @@ -1030,7 +1030,7 @@ bool LightModuleInit(void) TasmotaGlobal.light_type = LT_BASIC; // Use basic PWM control if SetOption15 = 0 if (Settings->flag.pwm_control) { // SetOption15 - Switch between commands PWM or COLOR/DIMMER/CT/CHANNEL - for (uint32_t i = 0; i < MAX_PWMS; i++) { + for (uint32_t i = 0; i < LST_MAX; i++) { if (PinUsed(GPIO_PWM1, i)) { TasmotaGlobal.light_type++; } // Use Dimmer/Color control for all PWM as SetOption15 = 1 } } @@ -1164,9 +1164,7 @@ void LightInit(void) #ifdef ESP8266 pinMode(Pin(GPIO_PWM1, i), OUTPUT); #endif // ESP8266 -#ifdef ESP32 - analogAttach(Pin(GPIO_PWM1, i)); -#endif // ESP32 + // For ESP32, the PWM are already attached by GpioInit() - GpioInitPwm() } } if (PinUsed(GPIO_ARIRFRCV)) { @@ -2087,10 +2085,6 @@ void LightApplyPower(uint8_t new_color[LST_MAX], power_t power) { void LightSetOutputs(const uint16_t *cur_col_10) { // now apply the actual PWM values, adjusted and remapped 10-bits range if (TasmotaGlobal.light_type < LT_PWM6) { // only for direct PWM lights, not for Tuya, Armtronix... -#ifdef ESP32 - uint32_t pwm_phase = 0; // dephase each PWM channel with the value of the previous - uint32_t pwm_modulus = (1 << _pwm_bit_num) - 1; // 1023 -#endif // ESP32 #ifdef USE_PWM_DIMMER uint16_t max_col = 0; @@ -2116,17 +2110,18 @@ void LightSetOutputs(const uint16_t *cur_col_10) { cur_col = cur_col > 0 ? changeUIntScale(cur_col, 0, Settings->pwm_range, Light.pwm_min, Light.pwm_max) : 0; // shrink to the range of pwm_min..pwm_max } if (!Settings->flag4.zerocross_dimmer) { - uint32_t pwm_val = bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - cur_col : cur_col; #ifdef ESP32 - uint32_t pwm_phase_invert = bitRead(TasmotaGlobal.pwm_inverted, i) ? cur_col : 0; // move phase if inverted - analogWritePhase(Pin(GPIO_PWM1, i), pwm_val, Settings->flag5.pwm_force_same_phase ? 0 : (pwm_phase + pwm_phase_invert) & pwm_modulus); - pwm_phase = (pwm_phase + cur_col) & pwm_modulus; + TasmotaGlobal.pwm_value[i] = cur_col; // mark the new expected value #else // ESP32 - analogWrite(Pin(GPIO_PWM1, i), pwm_val); + analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - cur_col : cur_col); #endif // ESP32 } } } +#ifdef ESP32 + PwmApplyGPIO(); +#endif // ESP32 + #ifdef USE_PWM_DIMMER // Animate brightness LEDs to follow PWM dimmer brightness if (PWM_DIMMER == TasmotaGlobal.module_type) PWMDimmerSetBrightnessLeds(change10to8(max_col)); diff --git a/tasmota/xdrv_13_display.ino b/tasmota/xdrv_13_display.ino index ffded1fde..2b60c7e4d 100755 --- a/tasmota/xdrv_13_display.ino +++ b/tasmota/xdrv_13_display.ino @@ -1989,7 +1989,7 @@ void CmndDisplayMode(void) { // Apply the current display dimmer void ApplyDisplayDimmer(void) { uint8_t dimmer8 = changeUIntScale(GetDisplayDimmer(), 0, 100, 0, 255); - uint8_t dimmer8_gamma = ledGamma(dimmer8); + uint16_t dimmer10_gamma = ledGamma10(dimmer8); if (dimmer8 && !(disp_power)) { ExecuteCommandPower(disp_device, POWER_ON, SRC_DISPLAY); } @@ -1997,7 +1997,7 @@ void ApplyDisplayDimmer(void) { ExecuteCommandPower(disp_device, POWER_OFF, SRC_DISPLAY); } if (renderer) { - renderer->dim8(dimmer8, dimmer8_gamma); // provide 8 bits and gamma corrected dimmer in 8 bits + renderer->dim10(dimmer8, dimmer10_gamma); // provide 8 bits and gamma corrected dimmer in 8 bits #ifdef USE_BERRY // still call Berry virtual display in case it is not managed entirely by renderer Xdsp18(FUNC_DISPLAY_DIM); diff --git a/tasmota/xdrv_24_buzzer.ino b/tasmota/xdrv_24_buzzer.ino index d7b8ef0f3..3921589f3 100644 --- a/tasmota/xdrv_24_buzzer.ino +++ b/tasmota/xdrv_24_buzzer.ino @@ -50,12 +50,9 @@ void BuzzerSet(uint32_t state) { if (Settings->flag4.buzzer_freq_mode) { // SetOption111 - Enable frequency output mode for buzzer static uint8_t last_state = 0; if (last_state != state) { -#ifdef ESP32 - if (analogAttach(Pin(GPIO_BUZZER))) -#endif // ESP32 - // Set 50% duty cycle for frequency output - // Set 0% (or 100% for inverted PWM) duty cycle which turns off frequency output either way - analogWrite(Pin(GPIO_BUZZER), (state) ? Settings->pwm_range / 2 : 0); // set duty cycle for frequency output + // Set 50% duty cycle for frequency output + // Set 0% (or 100% for inverted PWM) duty cycle which turns off frequency output either way + analogWrite(Pin(GPIO_BUZZER), (state) ? Settings->pwm_range / 2 : 0); // set duty cycle for frequency output last_state = state; } } else { diff --git a/tasmota/xdrv_52_3_berry_webclient.ino b/tasmota/xdrv_52_3_berry_webclient.ino index 625c54622..71b0aaab4 100644 --- a/tasmota/xdrv_52_3_berry_webclient.ino +++ b/tasmota/xdrv_52_3_berry_webclient.ino @@ -325,10 +325,17 @@ extern "C" { int32_t wc_tcp_read(struct bvm *vm); int32_t wc_tcp_read(struct bvm *vm) { WiFiClient * tcp = wc_getwificlient(vm); + int32_t max_read = -1; // by default read as much as we can + if (be_top(vm) >= 2 && be_isint(vm, 2)) { + max_read = be_toint(vm, 2); + } int32_t btr = tcp->available(); if (btr <= 0) { be_pushstring(vm, ""); } else { + if ((max_read >= 0) && (btr > max_read)) { + btr = max_read; + } char * buf = (char*) be_pushbuffer(vm, btr); int32_t btr2 = tcp->read((uint8_t*) buf, btr); be_pushnstring(vm, buf, btr2); @@ -340,10 +347,17 @@ extern "C" { int32_t wc_tcp_readbytes(struct bvm *vm); int32_t wc_tcp_readbytes(struct bvm *vm) { WiFiClient * tcp = wc_getwificlient(vm); + int32_t max_read = -1; // by default read as much as we can + if (be_top(vm) >= 2 && be_isint(vm, 2)) { + max_read = be_toint(vm, 2); + } int32_t btr = tcp->available(); if (btr <= 0) { be_pushbytes(vm, nullptr, 0); } else { + if ((max_read >= 0) && (btr > max_read)) { + btr = max_read; + } uint8_t * buf = (uint8_t*) be_pushbuffer(vm, btr); int32_t btr2 = tcp->read(buf, btr); be_pushbytes(vm, buf, btr2); diff --git a/tasmota/xdrv_81_esp32_webcam.ino b/tasmota/xdrv_81_esp32_webcam.ino index b89bc7930..b89bde902 100644 --- a/tasmota/xdrv_81_esp32_webcam.ino +++ b/tasmota/xdrv_81_esp32_webcam.ino @@ -219,12 +219,6 @@ uint32_t WcSetup(int32_t fsiz) { //esp_log_level_set("*", ESP_LOG_VERBOSE); camera_config_t config; - config.ledc_channel = LEDC_CHANNEL_0; - config.ledc_timer = LEDC_TIMER_0; - config.xclk_freq_hz = 20000000; - config.pixel_format = PIXFORMAT_JPEG; -// config.pixel_format = PIXFORMAT_GRAYSCALE; -// config.pixel_format = PIXFORMAT_RGB565; if (WcPinUsed()) { config.pin_d0 = Pin(GPIO_WEBCAM_DATA); // Y2_GPIO_NUM; @@ -265,8 +259,17 @@ uint32_t WcSetup(int32_t fsiz) { config.pin_reset = RESET_GPIO_NUM; AddLog(LOG_LEVEL_DEBUG, PSTR("CAM: Default template")); } + + int32_t ledc_channel = analogAttach(config.pin_xclk); + if (ledc_channel < 0) { + AddLog(LOG_LEVEL_ERROR, "CAM: cannot allocated ledc cahnnel, remove a PWM GPIO"); + } + config.ledc_channel = (ledc_channel_t) ledc_channel; + AddLog(LOG_LEVEL_DEBUG_MORE, "CAM: XCLK on GPIO %i using ledc channel %i", config.pin_xclk, config.ledc_channel); + config.ledc_timer = LEDC_TIMER_0; + config.xclk_freq_hz = 20000000; + config.pixel_format = PIXFORMAT_JPEG; - //ESP.getPsramSize() //esp_log_level_set("*", ESP_LOG_INFO); From 13280c985d0d580088b75a9a29551562e2805784 Mon Sep 17 00:00:00 2001 From: stefanbode Date: Fri, 28 Jan 2022 08:39:41 +0100 Subject: [PATCH 09/39] Added WIFI check to avoid extensive battery usage The device is send to an additional deepsleep cycle if there could not establish a WIFI connection with IP in the first 15 seconds after startup. Normal connection time is 6-7 seconds. Address #14483 --- tasmota/xdrv_29_deepsleep.ino | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index f93506410..ac78357bd 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -154,9 +154,13 @@ void DeepSleepStart(void) } void DeepSleepEverySecond(void) -{ +{ + //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("Wifi Info: up %d, wifidown %d, wifistatus %d, flag %d"),TasmotaGlobal.uptime, TasmotaGlobal.global_state.wifi_down, Wifi.status , deepsleep_flag); + if (TasmotaGlobal.uptime > 15 && Wifi.status != WL_CONNECTED && !deepsleep_flag && DeepSleepEnabled()) { + AddLog(LOG_LEVEL_ERROR, PSTR("Error Wifi could not connect 15 seconds. Deepsleep") ); + deepsleep_flag = DEEPSLEEP_START_COUNTDOWN; // Start deepsleep in 4 seconds + } if (!deepsleep_flag) { return; } - if (DeepSleepEnabled()) { if (DEEPSLEEP_START_COUNTDOWN == deepsleep_flag) { // Allow 4 seconds to update web console before deepsleep SettingsSaveAll(); From d922aa7beb387e9cb6ff8acc8e44c68c9b04dee4 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Fri, 28 Jan 2022 08:56:00 +0100 Subject: [PATCH 10/39] LVGL log TS when released --- tasmota/xdrv_55_touch.ino | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasmota/xdrv_55_touch.ino b/tasmota/xdrv_55_touch.ino index d553f419c..77850acf9 100644 --- a/tasmota/xdrv_55_touch.ino +++ b/tasmota/xdrv_55_touch.ino @@ -130,6 +130,7 @@ int16_t XPT2046_y() { void Touch_Check(void(*rotconvert)(int16_t *x, int16_t *y)) { + static bool was_touched = false; // flag used to log the data sent when the screen was just released #ifdef USE_FT5206 if (FT5206_found) { @@ -154,6 +155,7 @@ void Touch_Check(void(*rotconvert)(int16_t *x, int16_t *y)) { raw_touch_xp = touch_xp; raw_touch_yp = touch_yp; if (touched) { + was_touched = true; #ifdef USE_TOUCH_BUTTONS #ifdef USE_M5STACK_CORE2 // handle 3 built in touch buttons @@ -183,6 +185,10 @@ void Touch_Check(void(*rotconvert)(int16_t *x, int16_t *y)) { #endif // USE_TOUCH_BUTTONS } else { + if (was_touched) { + AddLog(LOG_LEVEL_DEBUG_MORE, "TS : released x=%i y=%i (raw x=%i y=%i)", touch_xp, touch_yp, raw_touch_xp, raw_touch_yp); + was_touched = false; + } #ifdef USE_M5STACK_CORE2 for (uint32_t tbut = 0; tbut < 3; tbut++) { if (tbstate[tbut] & 1) { From 061b8676198f619aa9154d155e629f64bde9e5b7 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 28 Jan 2022 11:25:55 +0300 Subject: [PATCH 11/39] Update tasmota_template_legacy.h Removed unexpected changes --- tasmota/tasmota_template_legacy.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tasmota/tasmota_template_legacy.h b/tasmota/tasmota_template_legacy.h index 31982e511..4583a9783 100644 --- a/tasmota/tasmota_template_legacy.h +++ b/tasmota/tasmota_template_legacy.h @@ -87,8 +87,6 @@ enum LegacyUserSelectablePins { GPI8_LED4_INV, GPI8_MHZ_TXD, // MH-Z19 Serial interface GPI8_MHZ_RXD, // MH-Z19 Serial interface - GPI8_CM11_TXD, // CM110x Serial interface - GPI8_CM11_RXD, // CM110x Serial interface GPI8_PZEM0XX_TX, // PZEM0XX Serial interface GPI8_PZEM004_RX, // PZEM004T Serial interface GPI8_SAIR_TX, // SenseAir Serial interface @@ -319,8 +317,6 @@ const uint16_t kGpioConvert[] PROGMEM = { AGPIO(GPIO_LED1_INV) +3, AGPIO(GPIO_MHZ_TXD), // MH-Z19 Serial interface AGPIO(GPIO_MHZ_RXD), - AGPIO(GPIO_CM11_TXD), // CM110x Serial interface - AGPIO(GPIO_CM11_RXD), AGPIO(GPIO_PZEM0XX_TX), // PZEM0XX Serial interface AGPIO(GPIO_PZEM004_RX), // PZEM004T Serial interface AGPIO(GPIO_SAIR_TX), // SenseAir Serial interface From 11284bbd4930b6f60dc850a6e8669d0ea64614d3 Mon Sep 17 00:00:00 2001 From: stefanbode Date: Fri, 28 Jan 2022 12:06:59 +0100 Subject: [PATCH 12/39] Introduce DEEPSLEEP_NETWORK_TIMEOUT = 15 Network timeout can be configured in seconds or totally disabled by = 0 --- tasmota/xdrv_29_deepsleep.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index ac78357bd..17ef2d896 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -32,6 +32,7 @@ #define D_PRFX_DEEPSLEEP "DeepSleep" #define D_CMND_DEEPSLEEP_TIME "Time" +#define DEEPSLEEP_NETWORK_TIMEOUT 15 const uint32_t DEEPSLEEP_MAX = 10 * 366 * 24 * 60 * 60; // Allow max 10 years sleep const uint32_t DEEPSLEEP_MAX_CYCLE = 60 * 60; // Maximum time for a deepsleep as defined by chip hardware @@ -137,8 +138,6 @@ void DeepSleepPrepare(void) void DeepSleepStart(void) { - AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "Sleeping")); // Won't show in GUI - WifiShutdown(); RtcSettings.ultradeepsleep = RtcSettings.nextwakeup - LocalTime(); RtcSettingsSave(); @@ -154,13 +153,14 @@ void DeepSleepStart(void) } void DeepSleepEverySecond(void) -{ +{ //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("Wifi Info: up %d, wifidown %d, wifistatus %d, flag %d"),TasmotaGlobal.uptime, TasmotaGlobal.global_state.wifi_down, Wifi.status , deepsleep_flag); - if (TasmotaGlobal.uptime > 15 && Wifi.status != WL_CONNECTED && !deepsleep_flag && DeepSleepEnabled()) { + if (DEEPSLEEP_NETWORK_TIMEOUT && TasmotaGlobal.uptime > DEEPSLEEP_NETWORK_TIMEOUT && Wifi.status != WL_CONNECTED && !deepsleep_flag && DeepSleepEnabled()) { AddLog(LOG_LEVEL_ERROR, PSTR("Error Wifi could not connect 15 seconds. Deepsleep") ); deepsleep_flag = DEEPSLEEP_START_COUNTDOWN; // Start deepsleep in 4 seconds } if (!deepsleep_flag) { return; } + if (DeepSleepEnabled()) { if (DEEPSLEEP_START_COUNTDOWN == deepsleep_flag) { // Allow 4 seconds to update web console before deepsleep SettingsSaveAll(); From bbcc8f5b52302ec7a2897c984e5168452565e370 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 28 Jan 2022 14:26:52 +0300 Subject: [PATCH 13/39] Last logic update and fixes 1. Logic update/sync according esp32 code 2. Fixed some errors for MiScaleV1 (but still tested only with V2) - just code reviewed :) --- tasmota/my_user_config.h | 2 +- tasmota/xsns_62_MI_HM10.ino | 184 +++++++++++++++++++++++------------- 2 files changed, 119 insertions(+), 67 deletions(-) diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 6a4f6df4d..ef5d042cc 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -747,7 +747,7 @@ //#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) -//#define USE_HM10 // (ESP8266 only) Add support for HM-10 as a BLE-bridge (+9k3 code) +//#define USE_HM10 // (ESP8266 only) Add support for HM-10 as a BLE-bridge (+17k code) //#define USE_HRXL // Add support for MaxBotix HRXL-MaxSonar ultrasonic range finders (+0k7) //#define USE_TASMOTA_CLIENT // Add support for Arduino Uno/Pro Mini via serial interface including flashing (+2k6 code, 64 mem) #define USE_TASMOTA_CLIENT_FLASH_SPEED 57600 // Usually 57600 for 3.3V variants and 115200 for 5V variants diff --git a/tasmota/xsns_62_MI_HM10.ino b/tasmota/xsns_62_MI_HM10.ino index a083426b2..061a0476b 100644 --- a/tasmota/xsns_62_MI_HM10.ino +++ b/tasmota/xsns_62_MI_HM10.ino @@ -662,9 +662,11 @@ uint32_t MIBLEgetSensorSlot(uint8_t (&_MAC)[6], uint16_t _type, int _rssi){ _newSensor.feature.Btn=1; break; case MI_SCALE_V1: + _newSensor.weight=NAN; _newSensor.feature.scale=1; break; case MI_SCALE_V2: + _newSensor.weight=NAN; _newSensor.feature.scale=1; _newSensor.feature.impedance=1; break; @@ -875,95 +877,145 @@ void HM10parseCGD1Packet(char * _buf, uint32_t _slot){ // no MiBeacon void HM10ParseMiScalePacket(char * _buf, uint32_t _slot, uint16_t _type){ //void MI32ParseMiScalePacket(const uint8_t * _buf, uint32_t length, const uint8_t *addr, int RSSI, int UUID){ - MiScaleV1Packet_t *_packetV1 = (MiScaleV1Packet_t*)_buf; - MiScaleV2Packet_t *_packetV2 = (MiScaleV2Packet_t*)_buf; + + uint8_t impedance_stabilized = 0; + uint8_t weight_stabilized = 0; + uint8_t weight_removed = 0; + + if (isnan(MIBLEsensors[_slot].weight)) + { + //First recieved packet, need to set default values to prevent memory garbage display + // For other packets only stable values will be displayed (or bridgeMode will send all packets) + MIBLEsensors[_slot].eventType.scale = 1; + MIBLEsensors[_slot].has_impedance = 0; + MIBLEsensors[_slot].weight_stabilized = 0; + MIBLEsensors[_slot].impedance_stabilized = 0; + MIBLEsensors[_slot].weight_removed = 0; + MIBLEsensors[_slot].weight = 0.0f; + MIBLEsensors[_slot].impedance = 0; + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("kg")); + } // Mi Scale V1 if (_type == 0x181d){ // 14-1-1-2 - + MiScaleV1Packet_t *_packetV1 = (MiScaleV1Packet_t*)_buf; if ((_slot >= 0) && (_slot < MIBLEsensors.size())){ DEBUG_SENSOR_LOG(PSTR("HM10: %s: at slot %u"), kHM10DeviceType[MIBLEsensors[_slot].type-1],_slot); MIBLEsensors[_slot].eventType.scale = 1; - MIBLEsensors[_slot].weight_stabilized = (_packetV1->status & (1 << 5)) ? 1 : 0; - MIBLEsensors[_slot].weight_removed = (_packetV1->status & (1 << 7)) ? 1 : 0; + weight_stabilized = (_packetV1->status & (1 << 5)) ? 1 : 0; + weight_removed = (_packetV1->status & (1 << 7)) ? 1 : 0; + + // Set sensor values for every packet in BridgedMode and for every packet with stable weight + if (HM10.option.directBridgeMode || (weight_stabilized && !weight_removed)) + { + MIBLEsensors[_slot].weight_stabilized = weight_stabilized; + MIBLEsensors[_slot].weight_removed = weight_removed; - if (_packetV1->status & (1 << 0)) { - strcpy(MIBLEsensors[_slot].weight_unit, PSTR("lbs")); - MIBLEsensors[_slot].weight = (float)_packetV1->weight / 100.0f; - } else if(_packetV1->status & (1 << 4)) { - strcpy(MIBLEsensors[_slot].weight_unit, PSTR("jin")); - MIBLEsensors[_slot].weight = (float)_packetV1->weight / 100.0f; - } else { - strcpy(MIBLEsensors[_slot].weight_unit, PSTR("kg")); - MIBLEsensors[_slot].weight = (float)_packetV1->weight / 200.0f; + if (_packetV1->status & (1 << 0)) + { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("lbs")); + MIBLEsensors[_slot].weight = (float)_packetV1->weight / 100.0f; + } + else if (_packetV1->status & (1 << 4)) + { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("jin")); + MIBLEsensors[_slot].weight = (float)_packetV1->weight / 100.0f; + } + else + { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("kg")); + MIBLEsensors[_slot].weight = (float)_packetV1->weight / 200.0f; + } + + if (MIBLEsensors[_slot].weight_removed) + { + MIBLEsensors[_slot].weight = 0.0f; + } + // Can be changed to memcpy or smthng else ? + MIBLEsensors[_slot].datetime.year = _packetV1->year; + MIBLEsensors[_slot].datetime.month = _packetV1->month; + MIBLEsensors[_slot].datetime.day = _packetV1->day; + MIBLEsensors[_slot].datetime.hour = _packetV1->hour; + MIBLEsensors[_slot].datetime.minute = _packetV1->minute; + MIBLEsensors[_slot].datetime.second = _packetV1->second; + + MIBLEsensors[_slot].shallSendMQTT = 1; + + HM10.mode.shallTriggerTele = 1; } - - if (MIBLEsensors[_slot].weight_removed) { - MIBLEsensors[_slot].weight = 0.0f; - } - // Can be changed to memcpy or smthng else ? - MIBLEsensors[_slot].datetime.year = _packetV2->year; - MIBLEsensors[_slot].datetime.month = _packetV2->month; - MIBLEsensors[_slot].datetime.day = _packetV2->day; - MIBLEsensors[_slot].datetime.hour = _packetV2->hour; - MIBLEsensors[_slot].datetime.minute = _packetV2->minute; - MIBLEsensors[_slot].datetime.second = _packetV2->second; - - MIBLEsensors[_slot].shallSendMQTT = 1; - bool triggerTele = MIBLEsensors[_slot].weight_stabilized && ! MIBLEsensors[_slot].weight_removed && MIBLEsensors[_slot].weight > 0; - - if(HM10.option.directBridgeMode || triggerTele) HM10.mode.shallTriggerTele = 1; } } // Mi Scale V2 - else if (_type == 0x181b){ // 17-1-1-2 + // Scales measure weight at first step, after weight is stable - measure impedance. + // So measurement (packet) can contain 'weight' or 'weight + impedance' + else if (_type == 0x181b){ // 17-1-1-2 + MiScaleV2Packet_t *_packetV2 = (MiScaleV2Packet_t*)_buf; if ((_slot >= 0) && (_slot < MIBLEsensors.size())){ DEBUG_SENSOR_LOG(PSTR("HM10: %s: at slot %u"), kHM10DeviceType[MIBLEsensors[_slot].type-1],_slot); - MIBLEsensors[_slot].eventType.scale = 1; + weight_stabilized = (_packetV2->status & (1 << 5)) ? 1 : 0; + weight_removed = (_packetV2->status & (1 << 7)) ? 1 : 0; + impedance_stabilized = (_packetV2->status & (1 << 1)) ? 1 : 0; - MIBLEsensors[_slot].has_impedance = (_packetV2->status & (1 << 1)) ? 1 : 0; - MIBLEsensors[_slot].weight_stabilized = (_packetV2->status & (1 << 5)) ? 1 : 0; - MIBLEsensors[_slot].impedance_stabilized = (_packetV2->status & (1 << 1)) ? 1 : 0; - MIBLEsensors[_slot].weight_removed = (_packetV2->status & (1 << 7)) ? 1 : 0; + //AddLog(LOG_LEVEL_DEBUG, PSTR("%s: MSCALE: WS %u, WR: %u, IS: %u "),D_CMND_HM10,weight_stabilized,weight_removed,impedance_stabilized); - if (_packetV2->weight_unit & (1 << 4)) { - strcpy(MIBLEsensors[_slot].weight_unit, PSTR("jin")); - MIBLEsensors[_slot].weight = (float)_packetV2->weight / 100.0f; - } else if(_packetV2->weight_unit == 3) { - strcpy(MIBLEsensors[_slot].weight_unit, PSTR("lbs")); - MIBLEsensors[_slot].weight = (float)_packetV2->weight / 100.0f; - } else if(_packetV2->weight_unit == 2) { - strcpy(MIBLEsensors[_slot].weight_unit, PSTR("kg")); - MIBLEsensors[_slot].weight = (float)_packetV2->weight / 200.0f; - } else { - strcpy(MIBLEsensors[_slot].weight_unit, PSTR("")); - MIBLEsensors[_slot].weight = (float)_packetV2->weight / 100.0f; - } + // Set sensor values for every packet in BridgedMode and for every packet with stable weight + if (HM10.option.directBridgeMode || (weight_stabilized && !weight_removed)) + { + MIBLEsensors[_slot].has_impedance = (_packetV2->status & (1 << 1)) ? 1 : 0; + MIBLEsensors[_slot].weight_stabilized = weight_stabilized; + MIBLEsensors[_slot].impedance_stabilized = impedance_stabilized; + MIBLEsensors[_slot].weight_removed = weight_removed; + if (_packetV2->weight_unit & (1 << 4)) + { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("jin")); + MIBLEsensors[_slot].weight = (float)_packetV2->weight / 100.0f; + } + else if (_packetV2->weight_unit == 3) + { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("lbs")); + MIBLEsensors[_slot].weight = (float)_packetV2->weight / 100.0f; + } + else if (_packetV2->weight_unit == 2) + { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("kg")); + MIBLEsensors[_slot].weight = (float)_packetV2->weight / 200.0f; + } + else + { + strcpy(MIBLEsensors[_slot].weight_unit, PSTR("")); + MIBLEsensors[_slot].weight = (float)_packetV2->weight / 100.0f; + } - if (MIBLEsensors[_slot].weight_removed) { - MIBLEsensors[_slot].weight = 0.0f; + if (MIBLEsensors[_slot].weight_removed) + { + MIBLEsensors[_slot].weight = 0.0f; + + } + //Set impedance to zero after every stable weight measurement MIBLEsensors[_slot].impedance = 0; - } - else if (MIBLEsensors[_slot].has_impedance) { - MIBLEsensors[_slot].impedance = _packetV2->impedance; - } - // Can be changed to memcpy or smthng else ? - MIBLEsensors[_slot].datetime.year = _packetV2->year; - MIBLEsensors[_slot].datetime.month = _packetV2->month; - MIBLEsensors[_slot].datetime.day = _packetV2->day; - MIBLEsensors[_slot].datetime.hour = _packetV2->hour; - MIBLEsensors[_slot].datetime.minute = _packetV2->minute; - MIBLEsensors[_slot].datetime.second = _packetV2->second; + // If impedance stable or BridgeMode - set value + if (HM10.option.directBridgeMode || impedance_stabilized) + { + MIBLEsensors[_slot].impedance = MIBLEsensors[_slot].has_impedance ? _packetV2->impedance: 0; + } + // Can be changed to memcpy or smthng else ? + MIBLEsensors[_slot].datetime.year = _packetV2->year; + MIBLEsensors[_slot].datetime.month = _packetV2->month; + MIBLEsensors[_slot].datetime.day = _packetV2->day; + MIBLEsensors[_slot].datetime.hour = _packetV2->hour; + MIBLEsensors[_slot].datetime.minute = _packetV2->minute; + MIBLEsensors[_slot].datetime.second = _packetV2->second; - MIBLEsensors[_slot].shallSendMQTT = 1; + MIBLEsensors[_slot].shallSendMQTT = 1; + //Trigger in all cases - BridgeMode or weight_stabilized + HM10.mode.shallTriggerTele = 1; + } - bool triggerTele = MIBLEsensors[_slot].weight_stabilized && ! MIBLEsensors[_slot].weight_removed && MIBLEsensors[_slot].weight > 0; - if(HM10.option.directBridgeMode || triggerTele) HM10.mode.shallTriggerTele = 1; } } } @@ -1341,7 +1393,7 @@ bool HM10SerialHandleFeedback(){ // every 50 milliseconds if(_slot!=0xff){ if (_type==0xa1c) HM10parseATC((char*)HM10.rxAdvertisement.svcData+2,_slot); else if (_type==0x0576) HM10parseCGD1Packet((char*)HM10.rxAdvertisement.svcData+2,_slot); - else if (_type==0x181b) HM10ParseMiScalePacket((char*)HM10.rxAdvertisement.svcData+2,_slot, _type); + else if (_type==0x181b) HM10ParseMiScalePacket((char*)HM10.rxAdvertisement.svcData+2,_slot, HM10.rxAdvertisement.SVC); else HM10parseMiBeacon((char*)HM10.rxAdvertisement.svcData+2,_slot); } else{ From 6df1f0bb26c287b76f60d4decc4b8ca994caa8bc Mon Sep 17 00:00:00 2001 From: stefanbode Date: Fri, 28 Jan 2022 16:15:48 +0100 Subject: [PATCH 14/39] added compiler option: #ifdef DEEPSLEEP_NETWORK_TIMEOUT additional code optional compiled --- tasmota/xdrv_29_deepsleep.ino | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index 17ef2d896..9db9c8ba6 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -1,7 +1,7 @@ /* xdrv_29_deepsleep.ino - DeepSleep support for Tasmota - Copyright (C) 2021 Stefan Bode + Copyright (C) 2022 Stefan Bode This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -154,11 +154,14 @@ void DeepSleepStart(void) void DeepSleepEverySecond(void) { +#ifdef DEEPSLEEP_NETWORK_TIMEOUT //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("Wifi Info: up %d, wifidown %d, wifistatus %d, flag %d"),TasmotaGlobal.uptime, TasmotaGlobal.global_state.wifi_down, Wifi.status , deepsleep_flag); if (DEEPSLEEP_NETWORK_TIMEOUT && TasmotaGlobal.uptime > DEEPSLEEP_NETWORK_TIMEOUT && Wifi.status != WL_CONNECTED && !deepsleep_flag && DeepSleepEnabled()) { AddLog(LOG_LEVEL_ERROR, PSTR("Error Wifi could not connect 15 seconds. Deepsleep") ); deepsleep_flag = DEEPSLEEP_START_COUNTDOWN; // Start deepsleep in 4 seconds } +#endif // DEEPSLEEP_NETWORK_TIMEOUT + if (!deepsleep_flag) { return; } if (DeepSleepEnabled()) { From 9388c706897383f214b1693756b6ac3763a75d19 Mon Sep 17 00:00:00 2001 From: stefanbode Date: Fri, 28 Jan 2022 16:36:46 +0100 Subject: [PATCH 15/39] Update xdrv_29_deepsleep.ino --- tasmota/xdrv_29_deepsleep.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index 9db9c8ba6..ca19428b0 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -32,7 +32,9 @@ #define D_PRFX_DEEPSLEEP "DeepSleep" #define D_CMND_DEEPSLEEP_TIME "Time" -#define DEEPSLEEP_NETWORK_TIMEOUT 15 +#ifndef DEEPSLEEP_NETWORK_TIMEOUT + #define DEEPSLEEP_NETWORK_TIMEOUT 15 +#endif const uint32_t DEEPSLEEP_MAX = 10 * 366 * 24 * 60 * 60; // Allow max 10 years sleep const uint32_t DEEPSLEEP_MAX_CYCLE = 60 * 60; // Maximum time for a deepsleep as defined by chip hardware @@ -154,13 +156,11 @@ void DeepSleepStart(void) void DeepSleepEverySecond(void) { -#ifdef DEEPSLEEP_NETWORK_TIMEOUT //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("Wifi Info: up %d, wifidown %d, wifistatus %d, flag %d"),TasmotaGlobal.uptime, TasmotaGlobal.global_state.wifi_down, Wifi.status , deepsleep_flag); if (DEEPSLEEP_NETWORK_TIMEOUT && TasmotaGlobal.uptime > DEEPSLEEP_NETWORK_TIMEOUT && Wifi.status != WL_CONNECTED && !deepsleep_flag && DeepSleepEnabled()) { AddLog(LOG_LEVEL_ERROR, PSTR("Error Wifi could not connect 15 seconds. Deepsleep") ); deepsleep_flag = DEEPSLEEP_START_COUNTDOWN; // Start deepsleep in 4 seconds } -#endif // DEEPSLEEP_NETWORK_TIMEOUT if (!deepsleep_flag) { return; } From 3b8b473bd4b2d2df886cb508eb864702c871b84a Mon Sep 17 00:00:00 2001 From: stefanbode Date: Fri, 28 Jan 2022 16:50:11 +0100 Subject: [PATCH 16/39] fix logging --- tasmota/xdrv_29_deepsleep.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index ca19428b0..43ef64fc0 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -158,7 +158,7 @@ void DeepSleepEverySecond(void) { //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("Wifi Info: up %d, wifidown %d, wifistatus %d, flag %d"),TasmotaGlobal.uptime, TasmotaGlobal.global_state.wifi_down, Wifi.status , deepsleep_flag); if (DEEPSLEEP_NETWORK_TIMEOUT && TasmotaGlobal.uptime > DEEPSLEEP_NETWORK_TIMEOUT && Wifi.status != WL_CONNECTED && !deepsleep_flag && DeepSleepEnabled()) { - AddLog(LOG_LEVEL_ERROR, PSTR("Error Wifi could not connect 15 seconds. Deepsleep") ); + AddLog(LOG_LEVEL_ERROR, PSTR("Error Wifi could not connect %s seconds. Deepsleep"), DEEPSLEEP_NETWORK_TIMEOUT); deepsleep_flag = DEEPSLEEP_START_COUNTDOWN; // Start deepsleep in 4 seconds } From d49410c17e95854f398e488cf4528cd7d4d59b42 Mon Sep 17 00:00:00 2001 From: stefanbode Date: Fri, 28 Jan 2022 16:52:00 +0100 Subject: [PATCH 17/39] Update xdrv_29_deepsleep.ino --- tasmota/xdrv_29_deepsleep.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index 43ef64fc0..0fec046cf 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -158,7 +158,7 @@ void DeepSleepEverySecond(void) { //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("Wifi Info: up %d, wifidown %d, wifistatus %d, flag %d"),TasmotaGlobal.uptime, TasmotaGlobal.global_state.wifi_down, Wifi.status , deepsleep_flag); if (DEEPSLEEP_NETWORK_TIMEOUT && TasmotaGlobal.uptime > DEEPSLEEP_NETWORK_TIMEOUT && Wifi.status != WL_CONNECTED && !deepsleep_flag && DeepSleepEnabled()) { - AddLog(LOG_LEVEL_ERROR, PSTR("Error Wifi could not connect %s seconds. Deepsleep"), DEEPSLEEP_NETWORK_TIMEOUT); + AddLog(LOG_LEVEL_ERROR, PSTR("Error Wifi could not connect %d seconds. Deepsleep"), DEEPSLEEP_NETWORK_TIMEOUT); deepsleep_flag = DEEPSLEEP_START_COUNTDOWN; // Start deepsleep in 4 seconds } From 0ef94e2429c65f2b1f0900ead65e07bfadc9d25a Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Fri, 28 Jan 2022 19:17:03 +0100 Subject: [PATCH 18/39] AXP192 add `set_exten` --- lib/libesp32/berry/generate/be_const_strtab.h | 1 + .../berry/generate/be_const_strtab_def.h | 5 +- .../berry_tasmota/src/be_i2c_axp192_lib.c | 1224 +++++++++-------- .../berry_tasmota/src/embedded/i2c_axp192.be | 5 + tasmota/berry/drivers/i2c_axp192_M5StickC.be | 3 + 5 files changed, 640 insertions(+), 598 deletions(-) diff --git a/lib/libesp32/berry/generate/be_const_strtab.h b/lib/libesp32/berry/generate/be_const_strtab.h index 6bedac03a..32a228e21 100644 --- a/lib/libesp32/berry/generate/be_const_strtab.h +++ b/lib/libesp32/berry/generate/be_const_strtab.h @@ -652,6 +652,7 @@ extern const bcstring be_const_str_set_channels; extern const bcstring be_const_str_set_chg_current; extern const bcstring be_const_str_set_dc_voltage; extern const bcstring be_const_str_set_dcdc_enable; +extern const bcstring be_const_str_set_exten; extern const bcstring be_const_str_set_first_time; extern const bcstring be_const_str_set_gain; extern const bcstring be_const_str_set_height; diff --git a/lib/libesp32/berry/generate/be_const_strtab_def.h b/lib/libesp32/berry/generate/be_const_strtab_def.h index a67a809c1..381c2cc43 100644 --- a/lib/libesp32/berry/generate/be_const_strtab_def.h +++ b/lib/libesp32/berry/generate/be_const_strtab_def.h @@ -262,7 +262,7 @@ be_define_const_str(check_not_method, "check_not_method", 2597324607u, 0, 16, &b be_define_const_str(check_privileged_access, "check_privileged_access", 3692933968u, 0, 23, NULL); be_define_const_str(class, "class", 2872970239u, 57, 5, NULL); be_define_const_str(class_init_obj, "class_init_obj", 178410604u, 0, 14, &be_const_str_set_useragent); -be_define_const_str(classname, "classname", 1998589948u, 0, 9, NULL); +be_define_const_str(classname, "classname", 1998589948u, 0, 9, &be_const_str_set_exten); be_define_const_str(classof, "classof", 1796577762u, 0, 7, &be_const_str_kv); be_define_const_str(clear, "clear", 1550717474u, 0, 5, &be_const_str_scale_uint); be_define_const_str(clear_first_time, "clear_first_time", 632769909u, 0, 16, &be_const_str_width_def); @@ -644,6 +644,7 @@ be_define_const_str(set_channels, "set_channels", 1370190620u, 0, 12, NULL); be_define_const_str(set_chg_current, "set_chg_current", 336304386u, 0, 15, NULL); be_define_const_str(set_dc_voltage, "set_dc_voltage", 2181981936u, 0, 14, NULL); be_define_const_str(set_dcdc_enable, "set_dcdc_enable", 1594690786u, 0, 15, &be_const_str_widget_event); +be_define_const_str(set_exten, "set_exten", 1721782768u, 0, 9, NULL); be_define_const_str(set_first_time, "set_first_time", 3111247550u, 0, 14, &be_const_str__X7D); be_define_const_str(set_gain, "set_gain", 3847781975u, 0, 8, &be_const_str_set_text); be_define_const_str(set_height, "set_height", 1080207399u, 0, 10, NULL); @@ -1197,6 +1198,6 @@ static const bstring* const m_string_table[] = { static const struct bconststrtab m_const_string_table = { .size = 390, - .count = 803, + .count = 804, .table = m_string_table }; diff --git a/lib/libesp32/berry_tasmota/src/be_i2c_axp192_lib.c b/lib/libesp32/berry_tasmota/src/be_i2c_axp192_lib.c index 298e7b3a2..caf180e84 100644 --- a/lib/libesp32/berry_tasmota/src/be_i2c_axp192_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_i2c_axp192_lib.c @@ -3,6 +3,36 @@ *******************************************************************/ #include "be_constobj.h" +/******************************************************************** +** Solidified function: json_append +********************************************************************/ +be_local_closure(AXP192_json_append, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(wire), + }), + &be_const_str_json_append, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x74060001, // 0001 JMPT R1 #0004 + 0x4C040000, // 0002 LDNIL R1 + 0x80040200, // 0003 RET 1 R1 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: get_warning_level ********************************************************************/ @@ -10,7 +40,7 @@ be_local_closure(AXP192_get_warning_level, /* name */ be_nested_proto( 4, /* nstack */ 1, /* argc */ - 0, /* varg */ + 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ @@ -34,536 +64,6 @@ be_local_closure(AXP192_get_warning_level, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: get_vbus_current -********************************************************************/ -be_local_closure(AXP192_get_vbus_current, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(read12), - /* K1 */ be_const_real_hex(0x3EC00000), - }), - &be_const_str_get_vbus_current, - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E005B, // 0001 LDINT R3 92 - 0x7C040400, // 0002 CALL R1 2 - 0x08040301, // 0003 MUL R1 R1 K1 - 0x80040200, // 0004 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_chg_current -********************************************************************/ -be_local_closure(AXP192_set_chg_current, /* name */ - be_nested_proto( - 8, /* nstack */ - 2, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(write8), - /* K1 */ be_nested_str(read8), - }), - &be_const_str_set_chg_current, - &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x54120032, // 0001 LDINT R4 51 - 0x8C140101, // 0002 GETMET R5 R0 K1 - 0x541E0032, // 0003 LDINT R7 51 - 0x7C140400, // 0004 CALL R5 2 - 0x541A00EF, // 0005 LDINT R6 240 - 0x2C140A06, // 0006 AND R5 R5 R6 - 0x541A000E, // 0007 LDINT R6 15 - 0x2C180206, // 0008 AND R6 R1 R6 - 0x30140A06, // 0009 OR R5 R5 R6 - 0x7C080600, // 000A CALL R2 3 - 0x80000000, // 000B RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_bat_current -********************************************************************/ -be_local_closure(AXP192_get_bat_current, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(read13), - /* K1 */ be_const_real_hex(0x3F000000), - }), - &be_const_str_get_bat_current, - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0079, // 0001 LDINT R3 122 - 0x7C040400, // 0002 CALL R1 2 - 0x8C080100, // 0003 GETMET R2 R0 K0 - 0x5412007B, // 0004 LDINT R4 124 - 0x7C080400, // 0005 CALL R2 2 - 0x04040202, // 0006 SUB R1 R1 R2 - 0x08040301, // 0007 MUL R1 R1 K1 - 0x80040200, // 0008 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_bat_power -********************************************************************/ -be_local_closure(AXP192_get_bat_power, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(read24), - /* K1 */ be_const_real_hex(0x3A102DE1), - }), - &be_const_str_get_bat_power, - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E006F, // 0001 LDINT R3 112 - 0x7C040400, // 0002 CALL R1 2 - 0x08040301, // 0003 MUL R1 R1 K1 - 0x80040200, // 0004 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: json_append -********************************************************************/ -be_local_closure(AXP192_json_append, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(wire), - }), - &be_const_str_json_append, - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x74060001, // 0001 JMPT R1 #0004 - 0x4C040000, // 0002 LDNIL R1 - 0x80040200, // 0003 RET 1 R1 - 0x80000000, // 0004 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_vbus_voltage -********************************************************************/ -be_local_closure(AXP192_get_vbus_voltage, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(read12), - /* K1 */ be_const_real_hex(0x3ADED28A), - }), - &be_const_str_get_vbus_voltage, - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0059, // 0001 LDINT R3 90 - 0x7C040400, // 0002 CALL R1 2 - 0x08040301, // 0003 MUL R1 R1 K1 - 0x80040200, // 0004 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_temp -********************************************************************/ -be_local_closure(AXP192_get_temp, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(read12), - /* K1 */ be_const_real_hex(0x3DCCCCCD), - /* K2 */ be_const_real_hex(0x4310B333), - }), - &be_const_str_get_temp, - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E005D, // 0001 LDINT R3 94 - 0x7C040400, // 0002 CALL R1 2 - 0x08040301, // 0003 MUL R1 R1 K1 - 0x04040302, // 0004 SUB R1 R1 K2 - 0x80040200, // 0005 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: battery_present -********************************************************************/ -be_local_closure(AXP192_battery_present, /* name */ - be_nested_proto( - 6, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str(wire), - /* K1 */ be_nested_str(read), - /* K2 */ be_nested_str(addr), - /* K3 */ be_const_int(1), - }), - &be_const_str_battery_present, - &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x880C0102, // 0002 GETMBR R3 R0 K2 - 0x58100003, // 0003 LDCONST R4 K3 - 0x58140003, // 0004 LDCONST R5 K3 - 0x7C040800, // 0005 CALL R1 4 - 0x540A001F, // 0006 LDINT R2 32 - 0x2C040202, // 0007 AND R1 R1 R2 - 0x78060002, // 0008 JMPF R1 #000C - 0x50040200, // 0009 LDBOOL R1 1 0 - 0x80040200, // 000A RET 1 R1 - 0x70020001, // 000B JMP #000E - 0x50040000, // 000C LDBOOL R1 0 0 - 0x80040200, // 000D RET 1 R1 - 0x80000000, // 000E RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_aps_voltage -********************************************************************/ -be_local_closure(AXP192_get_aps_voltage, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(read12), - /* K1 */ be_const_real_hex(0x3AB78035), - }), - &be_const_str_get_aps_voltage, - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E007D, // 0001 LDINT R3 126 - 0x7C040400, // 0002 CALL R1 2 - 0x08040301, // 0003 MUL R1 R1 K1 - 0x80040200, // 0004 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_dcdc_enable -********************************************************************/ -be_local_closure(AXP192_set_dcdc_enable, /* name */ - be_nested_proto( - 8, /* nstack */ - 3, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_const_int(1), - /* K1 */ be_nested_str(write_bit), - /* K2 */ be_const_int(0), - /* K3 */ be_const_int(2), - /* K4 */ be_const_int(3), - }), - &be_const_str_set_dcdc_enable, - &be_const_str_solidified, - ( &(const binstruction[22]) { /* code */ - 0x1C0C0300, // 0000 EQ R3 R1 K0 - 0x780E0004, // 0001 JMPF R3 #0007 - 0x8C0C0101, // 0002 GETMET R3 R0 K1 - 0x54160011, // 0003 LDINT R5 18 - 0x58180002, // 0004 LDCONST R6 K2 - 0x5C1C0400, // 0005 MOVE R7 R2 - 0x7C0C0800, // 0006 CALL R3 4 - 0x1C0C0303, // 0007 EQ R3 R1 K3 - 0x780E0004, // 0008 JMPF R3 #000E - 0x8C0C0101, // 0009 GETMET R3 R0 K1 - 0x54160011, // 000A LDINT R5 18 - 0x541A0003, // 000B LDINT R6 4 - 0x5C1C0400, // 000C MOVE R7 R2 - 0x7C0C0800, // 000D CALL R3 4 - 0x1C0C0304, // 000E EQ R3 R1 K4 - 0x780E0004, // 000F JMPF R3 #0015 - 0x8C0C0101, // 0010 GETMET R3 R0 K1 - 0x54160011, // 0011 LDINT R5 18 - 0x58180000, // 0012 LDCONST R6 K0 - 0x5C1C0400, // 0013 MOVE R7 R2 - 0x7C0C0800, // 0014 CALL R3 4 - 0x80000000, // 0015 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_ldo_voltage -********************************************************************/ -be_local_closure(AXP192_set_ldo_voltage, /* name */ - be_nested_proto( - 9, /* nstack */ - 3, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_const_int(2), - /* K1 */ be_nested_str(write8), - /* K2 */ be_nested_str(read8), - /* K3 */ be_const_int(3), - }), - &be_const_str_set_ldo_voltage, - &be_const_str_solidified, - ( &(const binstruction[39]) { /* code */ - 0x540E0CE3, // 0000 LDINT R3 3300 - 0x240C0403, // 0001 GT R3 R2 R3 - 0x780E0001, // 0002 JMPF R3 #0005 - 0x540A000E, // 0003 LDINT R2 15 - 0x70020004, // 0004 JMP #000A - 0x540E0063, // 0005 LDINT R3 100 - 0x0C0C0403, // 0006 DIV R3 R2 R3 - 0x54120011, // 0007 LDINT R4 18 - 0x040C0604, // 0008 SUB R3 R3 R4 - 0x5C080600, // 0009 MOVE R2 R3 - 0x1C0C0300, // 000A EQ R3 R1 K0 - 0x780E000C, // 000B JMPF R3 #0019 - 0x8C0C0101, // 000C GETMET R3 R0 K1 - 0x54160027, // 000D LDINT R5 40 - 0x8C180102, // 000E GETMET R6 R0 K2 - 0x54220027, // 000F LDINT R8 40 - 0x7C180400, // 0010 CALL R6 2 - 0x541E000E, // 0011 LDINT R7 15 - 0x2C180C07, // 0012 AND R6 R6 R7 - 0x541E000E, // 0013 LDINT R7 15 - 0x2C1C0407, // 0014 AND R7 R2 R7 - 0x54220003, // 0015 LDINT R8 4 - 0x381C0E08, // 0016 SHL R7 R7 R8 - 0x30180C07, // 0017 OR R6 R6 R7 - 0x7C0C0600, // 0018 CALL R3 3 - 0x1C0C0303, // 0019 EQ R3 R1 K3 - 0x780E000A, // 001A JMPF R3 #0026 - 0x8C0C0101, // 001B GETMET R3 R0 K1 - 0x54160027, // 001C LDINT R5 40 - 0x8C180102, // 001D GETMET R6 R0 K2 - 0x54220027, // 001E LDINT R8 40 - 0x7C180400, // 001F CALL R6 2 - 0x541E00EF, // 0020 LDINT R7 240 - 0x2C180C07, // 0021 AND R6 R6 R7 - 0x541E000E, // 0022 LDINT R7 15 - 0x2C1C0407, // 0023 AND R7 R2 R7 - 0x30180C07, // 0024 OR R6 R6 R7 - 0x7C0C0600, // 0025 CALL R3 3 - 0x80000000, // 0026 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(AXP192_init, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(I2C_Driver), - /* K1 */ be_nested_str(init), - /* K2 */ be_nested_str(AXP192), - }), - &be_const_str_init, - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x60040003, // 0000 GETGBL R1 G3 - 0x5C080000, // 0001 MOVE R2 R0 - 0xB80E0000, // 0002 GETNGBL R3 K0 - 0x7C040400, // 0003 CALL R1 2 - 0x8C040301, // 0004 GETMET R1 R1 K1 - 0x580C0002, // 0005 LDCONST R3 K2 - 0x54120033, // 0006 LDINT R4 52 - 0x7C040600, // 0007 CALL R1 3 - 0x80000000, // 0008 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_bat_voltage -********************************************************************/ -be_local_closure(AXP192_get_bat_voltage, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(read12), - /* K1 */ be_const_real_hex(0x3A902DE0), - }), - &be_const_str_get_bat_voltage, - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0077, // 0001 LDINT R3 120 - 0x7C040400, // 0002 CALL R1 2 - 0x08040301, // 0003 MUL R1 R1 K1 - 0x80040200, // 0004 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_ldo_enable -********************************************************************/ -be_local_closure(AXP192_set_ldo_enable, /* name */ - be_nested_proto( - 8, /* nstack */ - 3, /* argc */ - 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_const_int(2), - /* K1 */ be_nested_str(write_bit), - /* K2 */ be_const_int(3), - }), - &be_const_str_set_ldo_enable, - &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0x1C0C0300, // 0000 EQ R3 R1 K0 - 0x780E0004, // 0001 JMPF R3 #0007 - 0x8C0C0101, // 0002 GETMET R3 R0 K1 - 0x54160011, // 0003 LDINT R5 18 - 0x58180000, // 0004 LDCONST R6 K0 - 0x5C1C0400, // 0005 MOVE R7 R2 - 0x7C0C0800, // 0006 CALL R3 4 - 0x1C0C0302, // 0007 EQ R3 R1 K2 - 0x780E0004, // 0008 JMPF R3 #000E - 0x8C0C0101, // 0009 GETMET R3 R0 K1 - 0x54160011, // 000A LDINT R5 18 - 0x58180002, // 000B LDCONST R6 K2 - 0x5C1C0400, // 000C MOVE R7 R2 - 0x7C0C0800, // 000D CALL R3 4 - 0x80000000, // 000E RET 0 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: set_dc_voltage ********************************************************************/ @@ -571,7 +71,7 @@ be_local_closure(AXP192_set_dc_voltage, /* name */ be_nested_proto( 11, /* nstack */ 3, /* argc */ - 0, /* varg */ + 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ @@ -642,6 +142,111 @@ be_local_closure(AXP192_set_dc_voltage, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: get_vbus_current +********************************************************************/ +be_local_closure(AXP192_get_vbus_current, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read12), + /* K1 */ be_const_real_hex(0x3EC00000), + }), + &be_const_str_get_vbus_current, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E005B, // 0001 LDINT R3 92 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: battery_present +********************************************************************/ +be_local_closure(AXP192_battery_present, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(1), + }), + &be_const_str_battery_present, + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x880C0102, // 0002 GETMBR R3 R0 K2 + 0x58100003, // 0003 LDCONST R4 K3 + 0x58140003, // 0004 LDCONST R5 K3 + 0x7C040800, // 0005 CALL R1 4 + 0x540A001F, // 0006 LDINT R2 32 + 0x2C040202, // 0007 AND R1 R1 R2 + 0x78060002, // 0008 JMPF R1 #000C + 0x50040200, // 0009 LDBOOL R1 1 0 + 0x80040200, // 000A RET 1 R1 + 0x70020001, // 000B JMP #000E + 0x50040000, // 000C LDBOOL R1 0 0 + 0x80040200, // 000D RET 1 R1 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_bat_voltage +********************************************************************/ +be_local_closure(AXP192_get_bat_voltage, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read12), + /* K1 */ be_const_real_hex(0x3A902DE0), + }), + &be_const_str_get_bat_voltage, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0077, // 0001 LDINT R3 120 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: write_gpio ********************************************************************/ @@ -649,7 +254,7 @@ be_local_closure(AXP192_write_gpio, /* name */ be_nested_proto( 8, /* nstack */ 3, /* argc */ - 0, /* varg */ + 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ @@ -691,6 +296,255 @@ be_local_closure(AXP192_write_gpio, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: get_input_power_status +********************************************************************/ +be_local_closure(AXP192_get_input_power_status, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(0), + /* K4 */ be_const_int(1), + }), + &be_const_str_get_input_power_status, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x880C0102, // 0002 GETMBR R3 R0 K2 + 0x58100003, // 0003 LDCONST R4 K3 + 0x58140004, // 0004 LDCONST R5 K4 + 0x7C040800, // 0005 CALL R1 4 + 0x80040200, // 0006 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_bat_charge_current +********************************************************************/ +be_local_closure(AXP192_get_bat_charge_current, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read13), + /* K1 */ be_const_real_hex(0x3F000000), + }), + &be_const_str_get_bat_charge_current, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0079, // 0001 LDINT R3 122 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(AXP192_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(I2C_Driver), + /* K1 */ be_nested_str(init), + /* K2 */ be_nested_str(AXP192), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x60040003, // 0000 GETGBL R1 G3 + 0x5C080000, // 0001 MOVE R2 R0 + 0xB80E0000, // 0002 GETNGBL R3 K0 + 0x7C040400, // 0003 CALL R1 2 + 0x8C040301, // 0004 GETMET R1 R1 K1 + 0x580C0002, // 0005 LDCONST R3 K2 + 0x54120033, // 0006 LDINT R4 52 + 0x7C040600, // 0007 CALL R1 3 + 0x80000000, // 0008 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_chg_current +********************************************************************/ +be_local_closure(AXP192_set_chg_current, /* name */ + be_nested_proto( + 8, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(write8), + /* K1 */ be_nested_str(read8), + }), + &be_const_str_set_chg_current, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x54120032, // 0001 LDINT R4 51 + 0x8C140101, // 0002 GETMET R5 R0 K1 + 0x541E0032, // 0003 LDINT R7 51 + 0x7C140400, // 0004 CALL R5 2 + 0x541A00EF, // 0005 LDINT R6 240 + 0x2C140A06, // 0006 AND R5 R5 R6 + 0x541A000E, // 0007 LDINT R6 15 + 0x2C180206, // 0008 AND R6 R1 R6 + 0x30140A06, // 0009 OR R5 R5 R6 + 0x7C080600, // 000A CALL R2 3 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_battery_chargin_status +********************************************************************/ +be_local_closure(AXP192_get_battery_chargin_status, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(1), + }), + &be_const_str_get_battery_chargin_status, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x880C0102, // 0002 GETMBR R3 R0 K2 + 0x58100003, // 0003 LDCONST R4 K3 + 0x58140003, // 0004 LDCONST R5 K3 + 0x7C040800, // 0005 CALL R1 4 + 0x80040200, // 0006 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_exten +********************************************************************/ +be_local_closure(AXP192_set_exten, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(write_bit), + }), + &be_const_str_set_exten, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x54120011, // 0001 LDINT R4 18 + 0x54160005, // 0002 LDINT R5 6 + 0x5C180200, // 0003 MOVE R6 R1 + 0x7C080800, // 0004 CALL R2 4 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_ldo_enable +********************************************************************/ +be_local_closure(AXP192_set_ldo_enable, /* name */ + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_const_int(2), + /* K1 */ be_nested_str(write_bit), + /* K2 */ be_const_int(3), + }), + &be_const_str_set_ldo_enable, + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x1C0C0300, // 0000 EQ R3 R1 K0 + 0x780E0004, // 0001 JMPF R3 #0007 + 0x8C0C0101, // 0002 GETMET R3 R0 K1 + 0x54160011, // 0003 LDINT R5 18 + 0x58180000, // 0004 LDCONST R6 K0 + 0x5C1C0400, // 0005 MOVE R7 R2 + 0x7C0C0800, // 0006 CALL R3 4 + 0x1C0C0302, // 0007 EQ R3 R1 K2 + 0x780E0004, // 0008 JMPF R3 #000E + 0x8C0C0101, // 0009 GETMET R3 R0 K1 + 0x54160011, // 000A LDINT R5 18 + 0x58180002, // 000B LDCONST R6 K2 + 0x5C1C0400, // 000C MOVE R7 R2 + 0x7C0C0800, // 000D CALL R3 4 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: web_sensor ********************************************************************/ @@ -698,7 +552,7 @@ be_local_closure(AXP192_web_sensor, /* name */ be_nested_proto( 11, /* nstack */ 1, /* argc */ - 0, /* varg */ + 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ @@ -756,27 +610,27 @@ be_local_closure(AXP192_web_sensor, /* name */ /******************************************************************** -** Solidified function: get_bat_charge_current +** Solidified function: get_vbus_voltage ********************************************************************/ -be_local_closure(AXP192_get_bat_charge_current, /* name */ +be_local_closure(AXP192_get_vbus_voltage, /* name */ be_nested_proto( 4, /* nstack */ 1, /* argc */ - 0, /* varg */ + 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(read13), - /* K1 */ be_const_real_hex(0x3F000000), + /* K0 */ be_nested_str(read12), + /* K1 */ be_const_real_hex(0x3ADED28A), }), - &be_const_str_get_bat_charge_current, + &be_const_str_get_vbus_voltage, &be_const_str_solidified, ( &(const binstruction[ 5]) { /* code */ 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0079, // 0001 LDINT R3 122 + 0x540E0059, // 0001 LDINT R3 90 0x7C040400, // 0002 CALL R1 2 0x08040301, // 0003 MUL R1 R1 K1 0x80040200, // 0004 RET 1 R1 @@ -787,34 +641,32 @@ be_local_closure(AXP192_get_bat_charge_current, /* name */ /******************************************************************** -** Solidified function: get_battery_chargin_status +** Solidified function: get_temp ********************************************************************/ -be_local_closure(AXP192_get_battery_chargin_status, /* name */ +be_local_closure(AXP192_get_temp, /* name */ be_nested_proto( - 6, /* nstack */ + 4, /* nstack */ 1, /* argc */ - 0, /* varg */ + 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str(wire), - /* K1 */ be_nested_str(read), - /* K2 */ be_nested_str(addr), - /* K3 */ be_const_int(1), + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(read12), + /* K1 */ be_const_real_hex(0x3DCCCCCD), + /* K2 */ be_const_real_hex(0x4310B333), }), - &be_const_str_get_battery_chargin_status, + &be_const_str_get_temp, &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x880C0102, // 0002 GETMBR R3 R0 K2 - 0x58100003, // 0003 LDCONST R4 K3 - 0x58140003, // 0004 LDCONST R5 K3 - 0x7C040800, // 0005 CALL R1 4 - 0x80040200, // 0006 RET 1 R1 + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E005D, // 0001 LDINT R3 94 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x04040302, // 0004 SUB R1 R1 K2 + 0x80040200, // 0005 RET 1 R1 }) ) ); @@ -822,35 +674,214 @@ be_local_closure(AXP192_get_battery_chargin_status, /* name */ /******************************************************************** -** Solidified function: get_input_power_status +** Solidified function: get_bat_power ********************************************************************/ -be_local_closure(AXP192_get_input_power_status, /* name */ +be_local_closure(AXP192_get_bat_power, /* name */ be_nested_proto( - 6, /* nstack */ + 4, /* nstack */ 1, /* argc */ - 0, /* varg */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read24), + /* K1 */ be_const_real_hex(0x3A102DE1), + }), + &be_const_str_get_bat_power, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E006F, // 0001 LDINT R3 112 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_dcdc_enable +********************************************************************/ +be_local_closure(AXP192_set_dcdc_enable, /* name */ + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str(wire), - /* K1 */ be_nested_str(read), - /* K2 */ be_nested_str(addr), - /* K3 */ be_const_int(0), - /* K4 */ be_const_int(1), + /* K0 */ be_const_int(1), + /* K1 */ be_nested_str(write_bit), + /* K2 */ be_const_int(0), + /* K3 */ be_const_int(2), + /* K4 */ be_const_int(3), }), - &be_const_str_get_input_power_status, + &be_const_str_set_dcdc_enable, &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x880C0102, // 0002 GETMBR R3 R0 K2 - 0x58100003, // 0003 LDCONST R4 K3 - 0x58140004, // 0004 LDCONST R5 K4 - 0x7C040800, // 0005 CALL R1 4 - 0x80040200, // 0006 RET 1 R1 + ( &(const binstruction[22]) { /* code */ + 0x1C0C0300, // 0000 EQ R3 R1 K0 + 0x780E0004, // 0001 JMPF R3 #0007 + 0x8C0C0101, // 0002 GETMET R3 R0 K1 + 0x54160011, // 0003 LDINT R5 18 + 0x58180002, // 0004 LDCONST R6 K2 + 0x5C1C0400, // 0005 MOVE R7 R2 + 0x7C0C0800, // 0006 CALL R3 4 + 0x1C0C0303, // 0007 EQ R3 R1 K3 + 0x780E0004, // 0008 JMPF R3 #000E + 0x8C0C0101, // 0009 GETMET R3 R0 K1 + 0x54160011, // 000A LDINT R5 18 + 0x541A0003, // 000B LDINT R6 4 + 0x5C1C0400, // 000C MOVE R7 R2 + 0x7C0C0800, // 000D CALL R3 4 + 0x1C0C0304, // 000E EQ R3 R1 K4 + 0x780E0004, // 000F JMPF R3 #0015 + 0x8C0C0101, // 0010 GETMET R3 R0 K1 + 0x54160011, // 0011 LDINT R5 18 + 0x58180000, // 0012 LDCONST R6 K0 + 0x5C1C0400, // 0013 MOVE R7 R2 + 0x7C0C0800, // 0014 CALL R3 4 + 0x80000000, // 0015 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_aps_voltage +********************************************************************/ +be_local_closure(AXP192_get_aps_voltage, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read12), + /* K1 */ be_const_real_hex(0x3AB78035), + }), + &be_const_str_get_aps_voltage, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E007D, // 0001 LDINT R3 126 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_ldo_voltage +********************************************************************/ +be_local_closure(AXP192_set_ldo_voltage, /* name */ + be_nested_proto( + 9, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_const_int(2), + /* K1 */ be_nested_str(write8), + /* K2 */ be_nested_str(read8), + /* K3 */ be_const_int(3), + }), + &be_const_str_set_ldo_voltage, + &be_const_str_solidified, + ( &(const binstruction[39]) { /* code */ + 0x540E0CE3, // 0000 LDINT R3 3300 + 0x240C0403, // 0001 GT R3 R2 R3 + 0x780E0001, // 0002 JMPF R3 #0005 + 0x540A000E, // 0003 LDINT R2 15 + 0x70020004, // 0004 JMP #000A + 0x540E0063, // 0005 LDINT R3 100 + 0x0C0C0403, // 0006 DIV R3 R2 R3 + 0x54120011, // 0007 LDINT R4 18 + 0x040C0604, // 0008 SUB R3 R3 R4 + 0x5C080600, // 0009 MOVE R2 R3 + 0x1C0C0300, // 000A EQ R3 R1 K0 + 0x780E000C, // 000B JMPF R3 #0019 + 0x8C0C0101, // 000C GETMET R3 R0 K1 + 0x54160027, // 000D LDINT R5 40 + 0x8C180102, // 000E GETMET R6 R0 K2 + 0x54220027, // 000F LDINT R8 40 + 0x7C180400, // 0010 CALL R6 2 + 0x541E000E, // 0011 LDINT R7 15 + 0x2C180C07, // 0012 AND R6 R6 R7 + 0x541E000E, // 0013 LDINT R7 15 + 0x2C1C0407, // 0014 AND R7 R2 R7 + 0x54220003, // 0015 LDINT R8 4 + 0x381C0E08, // 0016 SHL R7 R7 R8 + 0x30180C07, // 0017 OR R6 R6 R7 + 0x7C0C0600, // 0018 CALL R3 3 + 0x1C0C0303, // 0019 EQ R3 R1 K3 + 0x780E000A, // 001A JMPF R3 #0026 + 0x8C0C0101, // 001B GETMET R3 R0 K1 + 0x54160027, // 001C LDINT R5 40 + 0x8C180102, // 001D GETMET R6 R0 K2 + 0x54220027, // 001E LDINT R8 40 + 0x7C180400, // 001F CALL R6 2 + 0x541E00EF, // 0020 LDINT R7 240 + 0x2C180C07, // 0021 AND R6 R6 R7 + 0x541E000E, // 0022 LDINT R7 15 + 0x2C1C0407, // 0023 AND R7 R2 R7 + 0x30180C07, // 0024 OR R6 R6 R7 + 0x7C0C0600, // 0025 CALL R3 3 + 0x80000000, // 0026 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_bat_current +********************************************************************/ +be_local_closure(AXP192_get_bat_current, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read13), + /* K1 */ be_const_real_hex(0x3F000000), + }), + &be_const_str_get_bat_current, + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0079, // 0001 LDINT R3 122 + 0x7C040400, // 0002 CALL R1 2 + 0x8C080100, // 0003 GETMET R2 R0 K0 + 0x5412007B, // 0004 LDINT R4 124 + 0x7C080400, // 0005 CALL R2 2 + 0x04040202, // 0006 SUB R1 R1 R2 + 0x08040301, // 0007 MUL R1 R1 K1 + 0x80040200, // 0008 RET 1 R1 }) ) ); @@ -864,29 +895,30 @@ extern const bclass be_class_I2C_Driver; be_local_class(AXP192, 0, &be_class_I2C_Driver, - be_nested_map(21, + be_nested_map(22, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(get_warning_level, -1), be_const_closure(AXP192_get_warning_level_closure) }, - { be_const_key(get_vbus_current, -1), be_const_closure(AXP192_get_vbus_current_closure) }, - { be_const_key(get_aps_voltage, -1), be_const_closure(AXP192_get_aps_voltage_closure) }, + { be_const_key(json_append, 10), be_const_closure(AXP192_json_append_closure) }, { be_const_key(get_bat_current, -1), be_const_closure(AXP192_get_bat_current_closure) }, - { be_const_key(get_bat_power, 2), be_const_closure(AXP192_get_bat_power_closure) }, - { be_const_key(json_append, -1), be_const_closure(AXP192_json_append_closure) }, - { be_const_key(get_vbus_voltage, -1), be_const_closure(AXP192_get_vbus_voltage_closure) }, - { be_const_key(get_battery_chargin_status, 9), be_const_closure(AXP192_get_battery_chargin_status_closure) }, - { be_const_key(battery_present, -1), be_const_closure(AXP192_battery_present_closure) }, - { be_const_key(get_bat_charge_current, 14), be_const_closure(AXP192_get_bat_charge_current_closure) }, - { be_const_key(set_dcdc_enable, -1), be_const_closure(AXP192_set_dcdc_enable_closure) }, - { be_const_key(get_temp, 19), be_const_closure(AXP192_get_temp_closure) }, - { be_const_key(set_chg_current, 13), be_const_closure(AXP192_set_chg_current_closure) }, - { be_const_key(set_ldo_enable, 18), be_const_closure(AXP192_set_ldo_enable_closure) }, - { be_const_key(set_dc_voltage, -1), be_const_closure(AXP192_set_dc_voltage_closure) }, - { be_const_key(get_bat_voltage, 7), be_const_closure(AXP192_get_bat_voltage_closure) }, - { be_const_key(write_gpio, -1), be_const_closure(AXP192_write_gpio_closure) }, - { be_const_key(web_sensor, -1), be_const_closure(AXP192_web_sensor_closure) }, - { be_const_key(init, -1), be_const_closure(AXP192_init_closure) }, + { be_const_key(set_dc_voltage, 16), be_const_closure(AXP192_set_dc_voltage_closure) }, { be_const_key(set_ldo_voltage, -1), be_const_closure(AXP192_set_ldo_voltage_closure) }, + { be_const_key(battery_present, -1), be_const_closure(AXP192_battery_present_closure) }, + { be_const_key(write_gpio, -1), be_const_closure(AXP192_write_gpio_closure) }, + { be_const_key(set_dcdc_enable, 21), be_const_closure(AXP192_set_dcdc_enable_closure) }, { be_const_key(get_input_power_status, -1), be_const_closure(AXP192_get_input_power_status_closure) }, + { be_const_key(get_bat_power, -1), be_const_closure(AXP192_get_bat_power_closure) }, + { be_const_key(init, 1), be_const_closure(AXP192_init_closure) }, + { be_const_key(get_temp, 17), be_const_closure(AXP192_get_temp_closure) }, + { be_const_key(get_battery_chargin_status, -1), be_const_closure(AXP192_get_battery_chargin_status_closure) }, + { be_const_key(set_ldo_enable, -1), be_const_closure(AXP192_set_ldo_enable_closure) }, + { be_const_key(get_warning_level, 12), be_const_closure(AXP192_get_warning_level_closure) }, + { be_const_key(web_sensor, -1), be_const_closure(AXP192_web_sensor_closure) }, + { be_const_key(get_vbus_voltage, 8), be_const_closure(AXP192_get_vbus_voltage_closure) }, + { be_const_key(set_exten, -1), be_const_closure(AXP192_set_exten_closure) }, + { be_const_key(set_chg_current, 5), be_const_closure(AXP192_set_chg_current_closure) }, + { be_const_key(get_vbus_current, 6), be_const_closure(AXP192_get_vbus_current_closure) }, + { be_const_key(get_aps_voltage, -1), be_const_closure(AXP192_get_aps_voltage_closure) }, + { be_const_key(get_bat_charge_current, 3), be_const_closure(AXP192_get_bat_charge_current_closure) }, + { be_const_key(get_bat_voltage, -1), be_const_closure(AXP192_get_bat_voltage_closure) }, })), be_str_literal("AXP192") ); diff --git a/lib/libesp32/berry_tasmota/src/embedded/i2c_axp192.be b/lib/libesp32/berry_tasmota/src/embedded/i2c_axp192.be index d762b0363..5b8cae51f 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/i2c_axp192.be +++ b/lib/libesp32/berry_tasmota/src/embedded/i2c_axp192.be @@ -67,6 +67,11 @@ class AXP192 : I2C_Driver end end + # set EXTEN which enables external power on M5Stack, powering Hat with 5V + def set_exten(state) + self.write_bit(0x12, 6, state) + end + # set DCDC enable, 1/2/3 def set_dcdc_enable(dcdc, state) if dcdc == 1 self.write_bit(0x12, 0, state) end diff --git a/tasmota/berry/drivers/i2c_axp192_M5StickC.be b/tasmota/berry/drivers/i2c_axp192_M5StickC.be index 2d0c63d24..1d243feb6 100644 --- a/tasmota/berry/drivers/i2c_axp192_M5StickC.be +++ b/tasmota/berry/drivers/i2c_axp192_M5StickC.be @@ -41,6 +41,9 @@ class AXP192_M5StickC : AXP192 self.set_dcdc_enable(1, true) self.set_dcdc_enable(3, true) + # enable external power on HAT connector (5V) + self.set_exten(true) + # Set temperature protection self.write8(0x39, 0xFC) From 00eb68f9891604ae6c2e51277d8ab9d0baafb0b8 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Fri, 28 Jan 2022 22:31:00 +0100 Subject: [PATCH 19/39] Remove autoconf icon --- lib/libesp32/berry/generate/be_const_strtab.h | 2 +- lib/libesp32/berry/generate/be_const_strtab_def.h | 6 +++--- lib/libesp32/berry_tasmota/src/be_autoconf_lib.c | 2 +- lib/libesp32/berry_tasmota/src/embedded/autoconf.be | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libesp32/berry/generate/be_const_strtab.h b/lib/libesp32/berry/generate/be_const_strtab.h index 32a228e21..af7a52c45 100644 --- a/lib/libesp32/berry/generate/be_const_strtab.h +++ b/lib/libesp32/berry/generate/be_const_strtab.h @@ -149,7 +149,7 @@ extern const bcstring be_const_str__X3Coption_X20value_X3D_X27reset_X27_X3E_X26l extern const bcstring be_const_str__X3Cp_X20style_X3D_X27width_X3A340px_X3B_X27_X3E_X3Cb_X3EException_X3A_X3C_X2Fb_X3E_X3Cbr_X3E_X27_X25s_X27_X3Cbr_X3E_X25s_X3C_X2Fp_X3E; extern const bcstring be_const_str__X3Cp_X3ECurrent_X20configuration_X3A_X20_X3C_X2Fp_X3E_X3Cp_X3E_X3Cb_X3E_X25s_X3C_X2Fb_X3E_X3C_X2Fp_X3E; extern const bcstring be_const_str__X3Cp_X3E_X3C_X2Fp_X3E_X3C_X2Ffieldset_X3E_X3Cp_X3E_X3C_X2Fp_X3E; -extern const bcstring be_const_str__X3Cp_X3E_X3Cform_X20id_X3Dac_X20action_X3D_X27ac_X27_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20method_X3D_X27get_X27_X3E_X3Cbutton_X3E_X26_X23129668_X3B_X20Auto_X2Dconfiguration_X3C_X2Fbutton_X3E_X3C_X2Fform_X3E_X3C_X2Fp_X3E; +extern const bcstring be_const_str__X3Cp_X3E_X3Cform_X20id_X3Dac_X20action_X3D_X27ac_X27_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20method_X3D_X27get_X27_X3E_X3Cbutton_X3EAuto_X2Dconfiguration_X3C_X2Fbutton_X3E_X3C_X2Fform_X3E_X3C_X2Fp_X3E; extern const bcstring be_const_str__X3Cp_X3E_X3Cform_X20id_X3Dreapply_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20action_X3D_X27_X2Fac_X27_X20method_X3D_X27post_X27_X20; extern const bcstring be_const_str__X3Cp_X3E_X3Cform_X20id_X3Dzip_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20action_X3D_X27_X2Fac_X27_X20method_X3D_X27post_X27_X20; extern const bcstring be_const_str__X3Cp_X3E_X3Csmall_X3E_X26nbsp_X3B_X28This_X20feature_X20requires_X20an_X20internet_X20connection_X29_X3C_X2Fsmall_X3E_X3C_X2Fp_X3E; diff --git a/lib/libesp32/berry/generate/be_const_strtab_def.h b/lib/libesp32/berry/generate/be_const_strtab_def.h index 381c2cc43..499af46b5 100644 --- a/lib/libesp32/berry/generate/be_const_strtab_def.h +++ b/lib/libesp32/berry/generate/be_const_strtab_def.h @@ -51,7 +51,7 @@ be_define_const_str(_X3Coption_X20value_X3D_X27_X25s_X27_X3E_X25s_X3C_X2Foption_ be_define_const_str(_X3Coption_X20value_X3D_X27reset_X27_X3E_X26lt_X3BRemove_X20autoconf_X26gt_X3B_X3C_X2Foption_X3E, "", 3994619755u, 0, 54, &be_const_str_Leds); be_define_const_str(_X3Cp_X20style_X3D_X27width_X3A340px_X3B_X27_X3E_X3Cb_X3EException_X3A_X3C_X2Fb_X3E_X3Cbr_X3E_X27_X25s_X27_X3Cbr_X3E_X25s_X3C_X2Fp_X3E, "

Exception:
'%s'
%s

", 4252565082u, 0, 59, &be_const_str_AudioGenerator); be_define_const_str(_X3Cp_X3E_X3C_X2Fp_X3E_X3C_X2Ffieldset_X3E_X3Cp_X3E_X3C_X2Fp_X3E, "

", 2052843416u, 0, 25, NULL); -be_define_const_str(_X3Cp_X3E_X3Cform_X20id_X3Dac_X20action_X3D_X27ac_X27_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20method_X3D_X27get_X27_X3E_X3Cbutton_X3E_X26_X23129668_X3B_X20Auto_X2Dconfiguration_X3C_X2Fbutton_X3E_X3C_X2Fform_X3E_X3C_X2Fp_X3E, "

", 452285201u, 0, 120, &be_const_str_gc); +be_define_const_str(_X3Cp_X3E_X3Cform_X20id_X3Dac_X20action_X3D_X27ac_X27_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20method_X3D_X27get_X27_X3E_X3Cbutton_X3EAuto_X2Dconfiguration_X3C_X2Fbutton_X3E_X3C_X2Fform_X3E_X3C_X2Fp_X3E, "

", 2058443583u, 0, 110, &be_const_str_widget_height_def); be_define_const_str(_X3Cp_X3E_X3Cform_X20id_X3Dreapply_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20action_X3D_X27_X2Fac_X27_X20method_X3D_X27post_X27_X20, "

 (This feature requires an internet connection)

", 2719266486u, 0, 74, &be_const_str_get_style_pad_right); @@ -987,7 +987,7 @@ static const bstring* const m_string_table[] = { (const bstring *)&be_const_str__X3D, (const bstring *)&be_const_str__def, (const bstring *)&be_const_str_web_add_console_button, - (const bstring *)&be_const_str_widget_height_def, + (const bstring *)&be_const_str__X3Cp_X3E_X3Cform_X20id_X3Dac_X20action_X3D_X27ac_X27_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20method_X3D_X27get_X27_X3E_X3Cbutton_X3EAuto_X2Dconfiguration_X3C_X2Fbutton_X3E_X3C_X2Fform_X3E_X3C_X2Fp_X3E, (const bstring *)&be_const_str_montserrat_font, (const bstring *)&be_const_str_set_time, (const bstring *)&be_const_str_scan, @@ -1055,7 +1055,7 @@ static const bstring* const m_string_table[] = { (const bstring *)&be_const_str_Parameter_X20error, NULL, (const bstring *)&be_const_str_ismethod, - (const bstring *)&be_const_str__X3Cp_X3E_X3Cform_X20id_X3Dac_X20action_X3D_X27ac_X27_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20method_X3D_X27get_X27_X3E_X3Cbutton_X3E_X26_X23129668_X3B_X20Auto_X2Dconfiguration_X3C_X2Fbutton_X3E_X3C_X2Fform_X3E_X3C_X2Fp_X3E, + (const bstring *)&be_const_str_gc, (const bstring *)&be_const_str_classof, (const bstring *)&be_const_str_add_rule, (const bstring *)&be_const_str_SERIAL_7E2, diff --git a/lib/libesp32/berry_tasmota/src/be_autoconf_lib.c b/lib/libesp32/berry_tasmota/src/be_autoconf_lib.c index 6eafcc3a7..805bfb424 100644 --- a/lib/libesp32/berry_tasmota/src/be_autoconf_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_autoconf_lib.c @@ -897,7 +897,7 @@ be_local_closure(Autoconf_web_add_config_button, /* name */ ( &(const bvalue[ 3]) { /* constants */ /* K0 */ be_nested_str(webserver), /* K1 */ be_nested_str(content_send), - /* K2 */ be_nested_str(_X3Cp_X3E_X3Cform_X20id_X3Dac_X20action_X3D_X27ac_X27_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20method_X3D_X27get_X27_X3E_X3Cbutton_X3E_X26_X23129668_X3B_X20Auto_X2Dconfiguration_X3C_X2Fbutton_X3E_X3C_X2Fform_X3E_X3C_X2Fp_X3E), + /* K2 */ be_nested_str(_X3Cp_X3E_X3Cform_X20id_X3Dac_X20action_X3D_X27ac_X27_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20method_X3D_X27get_X27_X3E_X3Cbutton_X3EAuto_X2Dconfiguration_X3C_X2Fbutton_X3E_X3C_X2Fform_X3E_X3C_X2Fp_X3E), }), &be_const_str_web_add_config_button, &be_const_str_solidified, diff --git a/lib/libesp32/berry_tasmota/src/embedded/autoconf.be b/lib/libesp32/berry_tasmota/src/embedded/autoconf.be index f76fde271..18eb17015 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/autoconf.be +++ b/lib/libesp32/berry_tasmota/src/embedded/autoconf.be @@ -141,7 +141,7 @@ autoconf_module.init = def (m) # Displays a "Autocong" button on the configuration page def web_add_config_button() import webserver - webserver.content_send("

") + webserver.content_send("

") end From 9ee8d6a6af8db6c5e12e3df283e4d3d147dc86e3 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Fri, 28 Jan 2022 22:59:23 +0100 Subject: [PATCH 20/39] LVGL TS fix (again) --- .../Adafruit_LvGL_Glue-shadinger/Doxyfile | 2458 ----------------- .../examples/hello_changes/hello_changes.ino | 88 - .../examples/hello_clue/.clue.test.only | 0 .../examples/hello_clue/hello_clue.ino | 58 - .../hello_featherwing/.cpx_ada.test.skip | 0 .../hello_featherwing/hello_featherwing.ino | 74 - .../examples/hello_gizmo/.cpb.test.only | 0 .../examples/hello_gizmo/hello_gizmo.ino | 57 - .../hello_pyportal/.pyportal.test.only | 0 .../hello_pyportal/hello_pyportal.ino | 74 - .../examples/widgets_clue/.clue.test.only | 0 .../examples/widgets_clue/widgets_clue.ino | 203 -- .../widgets_featherwing/.cpx_ada.test.skip | 0 .../widgets_featherwing.ino | 261 -- .../examples/widgets_gizmo/.cpb.test.only | 0 .../examples/widgets_gizmo/widgets_gizmo.ino | 225 -- .../widgets_pyportal/.pyportal.test.only | 0 .../widgets_pyportal/widgets_pyportal.ino | 255 -- tasmota/xdrv_55_touch.ino | 20 +- 19 files changed, 10 insertions(+), 3763 deletions(-) delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/Doxyfile delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/hello_changes/hello_changes.ino delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/hello_clue/.clue.test.only delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/hello_clue/hello_clue.ino delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/hello_featherwing/.cpx_ada.test.skip delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/hello_featherwing/hello_featherwing.ino delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/hello_gizmo/.cpb.test.only delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/hello_gizmo/hello_gizmo.ino delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/hello_pyportal/.pyportal.test.only delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/hello_pyportal/hello_pyportal.ino delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/widgets_clue/.clue.test.only delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/widgets_clue/widgets_clue.ino delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/widgets_featherwing/.cpx_ada.test.skip delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/widgets_featherwing/widgets_featherwing.ino delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/widgets_gizmo/.cpb.test.only delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/widgets_gizmo/widgets_gizmo.ino delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/widgets_pyportal/.pyportal.test.only delete mode 100755 lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/examples/widgets_pyportal/widgets_pyportal.ino diff --git a/lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/Doxyfile b/lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/Doxyfile deleted file mode 100755 index 8f105aa52..000000000 --- a/lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/Doxyfile +++ /dev/null @@ -1,2458 +0,0 @@ -# Doxyfile 1.8.13 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "Adafruit lvgl Glue Library" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up -# to that level are automatically included in the table of contents, even if -# they do not have an id attribute. -# Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 0. -# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. - -TOC_INCLUDE_HEADINGS = 0 - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# If one adds a struct or class to a group and this option is enabled, then also -# any nested class or struct is added to the same group. By default this option -# is disabled and one has to add nested compounds explicitly via \ingroup. -# The default value is: NO. - -GROUP_NESTED_COMPOUNDS = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. If set to YES, local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO, only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = YES - -# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. -# The default value is: NO. - -WARN_AS_ERROR = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING -# Note: If this tag is empty the current directory is searched. - -INPUT = - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# read by doxygen. -# -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, -# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = lv_conf.h - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = *.md - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the -# cost of reduced performance. This can be particularly helpful with template -# rich C++ code for which doxygen's built-in parser lacks the necessary type -# information. -# Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse-libclang=ON option for CMake. -# The default value is: NO. - -CLANG_ASSISTED_PARSING = NO - -# If clang assisted parsing is enabled you can provide the compiler with command -# line options that you would normally use when invoking the compiler. Note that -# the include paths will already be set by doxygen for the files and directories -# specified with INPUT and INCLUDE_PATH. -# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. - -CLANG_OPTIONS = - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = NO - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /