mirror of https://github.com/arendst/Tasmota.git
commit
15b84df321
|
@ -85,13 +85,9 @@ char* IrUint64toHex(uint64_t value, char *str, uint16_t bits)
|
|||
memmove(str + fill, str, len +1);
|
||||
memset(str, '0', fill);
|
||||
}
|
||||
memmove(str + 2, str, strlen(str) +1);
|
||||
str[0] = '0';
|
||||
str[1] = 'x';
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_IR_RECEIVE
|
||||
/*********************************************************************************************\
|
||||
* IR Receive
|
||||
|
@ -132,10 +128,17 @@ void IrReceiveCheck(void)
|
|||
decode_results results;
|
||||
|
||||
if (irrecv->decode(&results)) {
|
||||
char hvalue[64];
|
||||
IrUint64toHex(results.value, hvalue, results.bits); // Get 64bit value as hex 0x00123456
|
||||
char hvalue[65]; // Max 256 bits
|
||||
if (results.bits > 64) {
|
||||
// This emulates IRutils resultToHexidecimal and may needs a larger IR_RCV_BUFFER_SIZE
|
||||
uint32_t digits2 = results.bits / 8;
|
||||
if (results.bits % 8) { digits2++; }
|
||||
ToHex_P((unsigned char*)results.state, digits2, hvalue, sizeof(hvalue)); // Get n-bit value as hex 56341200
|
||||
} else {
|
||||
IrUint64toHex(results.value, hvalue, results.bits); // Get 64bit value as hex 00123456
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_IRR "Echo %d, RawLen %d, Overflow %d, Bits %d, Value %s, Decode %d"),
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_IRR "Echo %d, RawLen %d, Overflow %d, Bits %d, Value 0x%s, Decode %d"),
|
||||
irsend_active, results.rawlen, results.overflow, results.bits, hvalue, results.decode_type);
|
||||
|
||||
unsigned long now = millis();
|
||||
|
@ -149,7 +152,7 @@ void IrReceiveCheck(void)
|
|||
if (Settings.flag.ir_receive_decimal) {
|
||||
ulltoa(results.value, svalue, 10);
|
||||
} else {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("\"%s\""), hvalue);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("\"0x%s\""), hvalue);
|
||||
}
|
||||
Response_P(PSTR("{\"" D_JSON_IRRECEIVED "\":{\"" D_JSON_IR_PROTOCOL "\":\"%s\",\"" D_JSON_IR_BITS "\":%d,\"" D_JSON_IR_DATA "\":%s"),
|
||||
GetTextIndexed(sirtype, sizeof(sirtype), iridx, kIrRemoteProtocols), results.bits, svalue);
|
||||
|
@ -921,8 +924,8 @@ uint32_t IrRemoteCmndIrSendJson(void)
|
|||
int protocol_code = GetCommandCode(protocol_text, sizeof(protocol_text), protocol, kIrRemoteProtocols);
|
||||
|
||||
char dvalue[64];
|
||||
char hvalue[64];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRS: protocol_text %s, protocol %s, bits %d, data %s (%s), repeat %d, protocol_code %d"),
|
||||
char hvalue[20];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRS: protocol_text %s, protocol %s, bits %d, data %s (0x%s), repeat %d, protocol_code %d"),
|
||||
protocol_text, protocol, bits, ulltoa(data, dvalue, 10), IrUint64toHex(data, hvalue, bits), repeat, protocol_code);
|
||||
|
||||
irsend_active = true;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
VER = '2.2.0031'
|
||||
VER = '2.3.0032'
|
||||
|
||||
"""
|
||||
decode-config.py - Backup/Restore Sonoff-Tasmota configuration data
|
||||
|
@ -955,7 +955,40 @@ Setting_6_6_0_5['flag3'][0].update ({
|
|||
'tuya_dimmer_min_limit': ('<L', (0x3A0,1,19), (None, None, ('SetOption', '"SetOption69 {}".format($)')) ),
|
||||
})
|
||||
# ======================================================================
|
||||
Setting_6_6_0_6 = copy.deepcopy(Setting_6_6_0_5)
|
||||
Setting_6_6_0_6['flag3'][0].pop('tuya_show_dimmer',None)
|
||||
Setting_6_6_0_6['flag3'][0].update ({
|
||||
'tuya_disable_dimmer': ('<L', (0x3A0,1,15), (None, None, ('SetOption', '"SetOption65 {}".format($)')) ),
|
||||
})
|
||||
# ======================================================================
|
||||
Setting_6_6_0_7 = copy.deepcopy(Setting_6_6_0_6)
|
||||
Setting_6_6_0_7.update ({
|
||||
'energy_usage': ({
|
||||
'usage1_kWhtotal': ('<L', 0x77C, (None, None, ('Power', None)) ),
|
||||
'usage1_kWhtoday': ('<L', 0x780, (None, None, ('Power', None)) ),
|
||||
'return1_kWhtotal': ('<L', 0x784, (None, None, ('Power', None)) ),
|
||||
'return2_kWhtotal': ('<L', 0x788, (None, None, ('Power', None)) ),
|
||||
'last_usage_kWhtotal': ('<L', 0x78C, (None, None, ('Power', None)) ),
|
||||
'last_return_kWhtotal': ('<L', 0x790, (None, None, ('Power', None)) ),
|
||||
}, 0x77C, (None, None, ('Power', None)) ),
|
||||
})
|
||||
# ======================================================================
|
||||
Setting_6_6_0_8 = copy.deepcopy(Setting_6_6_0_7)
|
||||
Setting_6_6_0_8['flag3'][0].update ({
|
||||
'energy_weekend': ('<L', (0x3A0,1,20), (None, None, ('Power', '"Tariff3 {}".format($)')) ),
|
||||
})
|
||||
# ======================================================================
|
||||
Setting_6_6_0_9 = copy.deepcopy(Setting_6_6_0_8)
|
||||
Setting_6_6_0_9.update ({
|
||||
'baudrate': ('<H', 0x778, (None, None, ('Serial', '"Baudrate {}".format($)')), ('$ * 1200','$ / 1200') ),
|
||||
'sbaudrate': ('<H', 0x77A, (None, None, ('Serial', '"SBaudrate {}".format($)')), ('$ * 1200','$ / 1200') ),
|
||||
})
|
||||
# ======================================================================
|
||||
Settings = [
|
||||
(0x6060009,0x1000, Setting_6_6_0_9),
|
||||
(0x6060008,0x1000, Setting_6_6_0_8),
|
||||
(0x6060007,0x1000, Setting_6_6_0_7),
|
||||
(0x6060006, 0xe00, Setting_6_6_0_6),
|
||||
(0x6060005, 0xe00, Setting_6_6_0_5),
|
||||
(0x6060003, 0xe00, Setting_6_6_0_3),
|
||||
(0x6060002, 0xe00, Setting_6_6_0_2),
|
||||
|
@ -2468,6 +2501,8 @@ def SetCmnd(cmnds, fieldname, fielddef, valuemapping, mappedvalue, addroffset=0,
|
|||
|
||||
# a simple value
|
||||
elif isinstance(format_, (str, bool, int, float, long)):
|
||||
if group is not None:
|
||||
group = group.title();
|
||||
if isinstance(tasmotacmnd, tuple):
|
||||
tasmotacmnds = tasmotacmnd
|
||||
for tasmotacmnd in tasmotacmnds:
|
||||
|
|
Loading…
Reference in New Issue