Skip to content

Commit

Permalink
Bugfix for device flags
Browse files Browse the repository at this point in the history
  • Loading branch information
fredlcore committed Mar 21, 2024
1 parent db0d157 commit 67f188e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions BSB_LAN/BSB_LAN.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ int findLine(float line
c = get_cmdtbl_cmd(i);
uint8_t dev_fam = get_cmdtbl_dev_fam(i);
uint8_t dev_var = get_cmdtbl_dev_var(i);
uint8_t dev_flags = get_cmdtbl_flags(i);
uint16_t dev_flags = get_cmdtbl_flags(i);
if (verbose == DEVELOPER_DEBUG) printFmtToDebug(PSTR("l = %.1f, dev_fam = %d, dev_var = %d, dev_flags = %d\r\n"), l, dev_fam, dev_var, dev_flags);

if ((dev_fam == my_dev_fam || dev_fam == DEV_FAM(DEV_ALL)) && (dev_var == my_dev_var || dev_var == DEV_VAR(DEV_ALL))) {
Expand Down Expand Up @@ -1571,7 +1571,7 @@ void EEPROM_dump() {
}
}

bool programIsreadOnly(uint8_t param_len) {
bool programIsreadOnly(uint16_t param_len) {
if ((default_flag & FL_SW_CTL_RONLY) == FL_SW_CTL_RONLY) { //software-controlled
switch (programWriteMode) {
case 0: return true; //All read-only.
Expand Down Expand Up @@ -1607,7 +1607,7 @@ void loadPrognrElementsFromTable(float nr, int i) {
decodedTelegram.enumstr_len=get_cmdtbl_enumstr_len(i);
//calc_enum_offset() MUST be after decodedTelegram.type = get_cmdtbl_type() because depend from it (VT_CUSTOM_BIT)
decodedTelegram.enumstr = calc_enum_offset(get_cmdtbl_enumstr(i), decodedTelegram.enumstr_len, decodedTelegram.type == VT_CUSTOM_BIT?1:0);
uint8_t flags=get_cmdtbl_flags(i);
uint16_t flags=get_cmdtbl_flags(i);
if (programIsreadOnly(flags)) {
decodedTelegram.readwrite = FL_RONLY; //read only
} else if ((flags & FL_WONLY) == FL_WONLY) {
Expand Down Expand Up @@ -3162,7 +3162,7 @@ int set(float line // the ProgNr of the heater parameter
default: pps_values[cmd_no] = atoi(val); break;
}

uint8_t flags=get_cmdtbl_flags(i);
uint16_t flags=get_cmdtbl_flags(i);
if ((flags & FL_EEPROM) == FL_EEPROM && EEPROM_ready) {
// if(EEPROM_ready && (allow_write_pps_values[cmd_no / 8] & (1 << (cmd_no % 8)))) {
printFmtToDebug(PSTR("Writing EEPROM slot %d with value %u"), cmd_no, pps_values[cmd_no]);
Expand Down Expand Up @@ -4110,7 +4110,7 @@ void query(float line) { // line (ProgNr)

i=findLine(line,0,&c);
uint8_t query_type = TYPE_QUR;
uint8_t dev_flags = get_cmdtbl_flags(i);
uint16_t dev_flags = get_cmdtbl_flags(i);
if (dev_flags & FL_QINF_ONLY) {
query_type = TYPE_QINF;
}
Expand Down Expand Up @@ -7613,7 +7613,7 @@ void setup() {
int l = findLine(15000+i,temp_idx,&temp_c);
if (l==-1) continue;
// fill bitwise array with flags
uint8_t flags=get_cmdtbl_flags(l);
uint16_t flags=get_cmdtbl_flags(l);
if ((flags & FL_EEPROM) == FL_EEPROM) {
allow_write_pps_values[i / 8] |= (1 << (i % 8));
}
Expand Down
2 changes: 1 addition & 1 deletion BSB_LAN/include/get_cmdtbl_values.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ inline uint8_t get_cmdtbl_dev_var(int i) {
return cmdtbl[i].dev_var;
}

inline uint8_t get_cmdtbl_flags(int i) {
inline uint16_t get_cmdtbl_flags(int i) {
return cmdtbl[i].flags;
}
2 changes: 1 addition & 1 deletion BSB_LAN/include/pps_handling.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ ich mir da nicht)
}
i--;
}
uint8_t flags=get_cmdtbl_flags(i);
uint16_t flags=get_cmdtbl_flags(i);
if (programIsreadOnly(flags) || pps_write != 1 || (msg[1+pps_offset] == 0x79 && pps_time_received == false)) {
switch (msg[1+pps_offset]) {
case 0x4F: log_now = setPPS(PPS_CON, msg[7+pps_offset]); saved_msg_cycle = msg_cycle; msg_cycle = 0; break; // Gerät an der Therme angemeldet? 0 = ja, 1 = nein
Expand Down
4 changes: 2 additions & 2 deletions BSB_LAN/include/print_telegram.h
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ void printTelegram(byte* msg, float query_line) {
if (query_line != -1) {
while (1) {
i = findLine(query_line,i,&c);
uint8_t dev_flags = get_cmdtbl_flags(i);
uint16_t dev_flags = get_cmdtbl_flags(i);
if (dev_flags & FL_SPECIAL_INF) {
c=((c & 0xFF000000) >> 8) | ((c & 0x00FF0000) << 8) | (c & 0x0000FFFF);
}
Expand All @@ -741,7 +741,7 @@ void printTelegram(byte* msg, float query_line) {
line = get_cmdtbl_line(i);
while (c!=CMD_END) {
if ((c & 0xFF00FFFF) == (cmd & 0xFF00FFFF) || (bus->getBusType() == BUS_PPS && ((c & 0x00FF0000) >> 16 == pps_cmd))) {
uint8_t dev_flags = get_cmdtbl_flags(i);
uint16_t dev_flags = get_cmdtbl_flags(i);
uint8_t dev_fam = get_cmdtbl_dev_fam(i);
uint8_t dev_var = get_cmdtbl_dev_var(i);
match_line = get_cmdtbl_line(i);
Expand Down

0 comments on commit 67f188e

Please sign in to comment.