Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed Sep 23, 2024
1 parent 5aeb043 commit 9c145c1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions components/tc_bus/tc_bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 9c145c1

Please sign in to comment.