diff --git a/common/src/i2c_slave.c b/common/src/i2c_slave.c index 3f07208407e308253e1fcb4dbf6513dad02792f1..552b1c6a5b5b6d3f660b26845c27dbee36bcb554 100644 --- a/common/src/i2c_slave.c +++ b/common/src/i2c_slave.c @@ -17,7 +17,7 @@ static struct io_descriptor *io; static uint16_t dev_addr __xMR; static uint16_t rx_state __xMR = CMD; static uint8_t tmp_std_cmd_addr; -static uint16_t std_cmd_addr __xMR; +static uint16_t std_cmd_addr __xMR = 0xFF; static int16_t cmd_index __xMR; static int16_t cmd_len __xMR; static uint8_t tmp_ext_cmd_addr; @@ -72,7 +72,6 @@ static void __xMR I2C_rx_complete(const struct i2c_s_async_descriptor *const des if (use_pec) pec_checksum = crc8_byte(pec_checksum ^ std_cmd_addr); if (std_cmd_addr == 0xFF) { - std_cmd_addr = 0; rx_state = EXT_CMD; send_ack(descr); set_cmd(descr, 3); @@ -223,7 +222,7 @@ static void __xMR I2C_tx_pending(const struct i2c_s_async_descriptor *const desc added_tx_pec = 1; sent_checksum = 0; } - if (std_cmd_addr) { + if (std_cmd_addr != 0xFF) { if ((*cmds->cmds[cmd_index].data_len < 0) && (!blk_wrote_len_byte)) { cmd_len = 0; tx_tmp = -*cmds->cmds[cmd_index].data_len;