diff --git a/components/tc_bus/tc_bus.cpp b/components/tc_bus/tc_bus.cpp index f0f65f2..770f097 100644 --- a/components/tc_bus/tc_bus.cpp +++ b/components/tc_bus/tc_bus.cpp @@ -658,41 +658,42 @@ namespace esphome delay(50); uint8_t index = 0; + uint8_t cell2 = 0; switch(type) { case SETTING_RINGTONE_DOOR_CALL: index = 3; - uint8_t cell2 = memory_buffer_[index] & 0xF; + cell2 = memory_buffer_[index] & 0xF; memory_buffer_[index] = (new_value << 4) | (cell2 & 0xF); settings_.door_call_ringtone = new_value; break; case SETTING_RINGTONE_INTERNAL_CALL: index = 6; - uint8_t cell2 = memory_buffer_[index] & 0xF; + cell2 = memory_buffer_[index] & 0xF; memory_buffer_[index] = (new_value << 4) | (cell2 & 0xF); settings_.internal_call_ringtone = new_value; break; case SETTING_RINGTONE_FLOOR_CALL: index = 9; - uint8_t cell2 = memory_buffer_[index] & 0xF; + cell2 = memory_buffer_[index] & 0xF; memory_buffer_[index] = (new_value << 4) | (cell2 & 0xF); settings_.floor_call_ringtone = new_value; break; case SETTING_RINGTONE_VOLUME: index = 20; - uint8_t cell1 = (memory_buffer_[index] >> 4) & 0xF; - memory_buffer_[index] = (cell1 << 4) | (new_value & 0xF); + cell2 = (memory_buffer_[index] >> 4) & 0xF; + memory_buffer_[index] = (cell2 << 4) | (new_value & 0xF); settings_.ringtone_volume = new_value; break; case SETTING_HANDSET_VOLUME: index = 21; - uint8_t cell1 = (memory_buffer_[index] >> 4) & 0xF; - memory_buffer_[index] = (cell1 << 4) | (new_value & 0xF); + cell2 = (memory_buffer_[index] >> 4) & 0xF; + memory_buffer_[index] = (cell2 << 4) | (new_value & 0xF); settings_.handset_volume = new_value; break;