diff --git a/docs/source/Plugin/P009_commands.repl b/docs/source/Plugin/P009_commands.repl index c85ced157..78c5eb206 100644 --- a/docs/source/Plugin/P009_commands.repl +++ b/docs/source/Plugin/P009_commands.repl @@ -127,6 +127,7 @@ | bitmask: | - if not present assume to operate in all pins | - if present is used as a mask (1=update, 0=do not update) + | - pins are numbered from right to left (i.e. 87654321) | - if number of bit lower than number of pins, then padded with 0 | - if number of bit higher than number of pins, then it's truncated "," @@ -140,13 +141,14 @@ | - mcpgpioRange,3,12,1,525 or mcpgpioRange,3,12,1,0b0100001101 | mask = '0100001101' | write pattern after mask = 'x1xxxx11x1' where x indicates that the pin will not be changed + | (only pin 1,3,4,9 will be changed) | | - mcpgpioRange,3,12,1,973 or mcpgpioRange,3,12,1,0b1111001101 | mask = 973 = '1111001101' | write pattern after mask = '1111xx11x1' where x indicates that the pin will not be changed " " - ``MCPGPIOrange,,, [,optional bitmask]`` + ``MCPGPIOpattern,,, [,optional bitmask]`` | MCPGPIO start pin: 0 ... 255 | diff --git a/docs/source/Plugin/P019_commands.repl b/docs/source/Plugin/P019_commands.repl index 6cf0c448c..8edadf45c 100644 --- a/docs/source/Plugin/P019_commands.repl +++ b/docs/source/Plugin/P019_commands.repl @@ -128,6 +128,7 @@ | bitmask: | - if not present assume to operate in all pins | - if present is used as a mask (1=update, 0=do not update) + | - pins are numbered from right to left (i.e. 87654321) | - if number of bit lower than number of pins, then padded with 0 | - if number of bit higher than number of pins, then it's truncated "," @@ -141,13 +142,14 @@ | - pcfgpioRange,3,12,1,525 or pcfgpioRange,3,12,1,0b0100001101 | mask = '0100001101' | write pattern after mask = 'x1xxxx11x1' where x indicates that the pin will not be changed + | (only pin 1,3,4,9 will be changed) | | - pcfgpioRange,3,12,1,973 or pcfgpioRange,3,12,1,0b1111001101 | mask = 973 = '1111001101' | write pattern after mask = '1111xx11x1' where x indicates that the pin will not be changed " " - ``PCFGPIOrange,,, [,optional bitmask]`` + ``PCFGPIOpattern,,, [,optional bitmask]`` | PCFGPIO start pin: 0 ... 255 | diff --git a/src/_P019_PCF8574.ino b/src/_P019_PCF8574.ino index 64171ea7f..18dbc7f2e 100644 --- a/src/_P019_PCF8574.ino +++ b/src/_P019_PCF8574.ino @@ -349,6 +349,10 @@ boolean Plugin_019(uint8_t function, struct EventStruct *event, String& string) // Reset SafeButton counter PCONFIG_LONG(3) = 0; + // @giig1967g-20210804: reset timer for long press + PCONFIG_LONG(2) = millis(); + PCONFIG(6) = false; + const unsigned long debounceTime = timePassedSince(PCONFIG_LONG(0)); if (debounceTime >= (unsigned long)lround(PCONFIG_FLOAT(0))) // de-bounce check diff --git a/src/_P108_DDS238.ino b/src/_P108_DDS238.ino index 36e770699..b3baca307 100644 --- a/src/_P108_DDS238.ino +++ b/src/_P108_DDS238.ino @@ -382,38 +382,40 @@ int p108_storageValueToBaudrate(uint8_t baudrate_setting) { float p108_readValue(uint8_t query, struct EventStruct *event) { uint8_t errorcode = -1; // DF - not present in P085 - float value = 0; // DF - not present in P085 + float value = 0.0f; // DF - not present in P085 P108_data_struct *P108_data = static_cast(getPluginTaskData(event->TaskIndex)); if ((nullptr != P108_data) && P108_data->isInitialized()) { switch (query) { case P108_QUERY_V: - value = P108_data->modbus.readHoldingRegister(0x0C ,errorcode) / 10.0; // 0.1 V => V + value = P108_data->modbus.readHoldingRegister(0x0C ,errorcode) / 10.0f; // 0.1 V => V break; case P108_QUERY_A: - value = P108_data->modbus.readHoldingRegister(0x0D, errorcode) / 100.0; // 0.01 A => A + value = P108_data->modbus.readHoldingRegister(0x0D, errorcode) / 100.0f; // 0.01 A => A break; case P108_QUERY_W: - value = P108_data->modbus.readHoldingRegister(0x0E, errorcode) * 1.0 ; + value = P108_data->modbus.readHoldingRegister(0x0E, errorcode); + if (value > 32767) { value -= 65535; } break; case P108_QUERY_VA: - value = P108_data->modbus.readHoldingRegister(0x0F, errorcode) * 1.0 ; + value = P108_data->modbus.readHoldingRegister(0x0F, errorcode); + if (value > 32767) { value -= 65535; } break; case P108_QUERY_PF: - value = P108_data->modbus.readHoldingRegister(0x10, errorcode) / 1000.0; // 0.001 Pf => Pf + value = P108_data->modbus.readHoldingRegister(0x10, errorcode) / 1000.0f; // 0.001 Pf => Pf break; case P108_QUERY_F: - value = P108_data->modbus.readHoldingRegister(0x11, errorcode) / 100.0 ; // 0.01 Hz => Hz + value = P108_data->modbus.readHoldingRegister(0x11, errorcode) / 100.0f; // 0.01 Hz => Hz break; case P108_QUERY_Wh_imp: - return P108_data->modbus.read_32b_HoldingRegister(0x0A) * 10.0; // 0.01 kWh => Wh + return P108_data->modbus.read_32b_HoldingRegister(0x0A) * 10.0f; // 0.01 kWh => Wh break; case P108_QUERY_Wh_exp: - return P108_data->modbus.read_32b_HoldingRegister(0x08) * 10.0; // 0.01 kWh => Wh + return P108_data->modbus.read_32b_HoldingRegister(0x08) * 10.0f; // 0.01 kWh => Wh break; case P108_QUERY_Wh_tot: - return P108_data->modbus.read_32b_HoldingRegister(0x00) * 10.0; // 0.01 kWh => Wh + return P108_data->modbus.read_32b_HoldingRegister(0x00) * 10.0f; // 0.01 kWh => Wh break; } }