From 67f188e663050b032e56498d38c3f336da17f95f Mon Sep 17 00:00:00 2001 From: fredlcore Date: Fri, 22 Mar 2024 01:27:59 +0800 Subject: [PATCH] Bugfix for device flags --- BSB_LAN/BSB_LAN.ino | 12 ++++++------ BSB_LAN/include/get_cmdtbl_values.h | 2 +- BSB_LAN/include/pps_handling.h | 2 +- BSB_LAN/include/print_telegram.h | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/BSB_LAN/BSB_LAN.ino b/BSB_LAN/BSB_LAN.ino index 9c70aa0c..18f98124 100644 --- a/BSB_LAN/BSB_LAN.ino +++ b/BSB_LAN/BSB_LAN.ino @@ -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))) { @@ -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. @@ -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) { @@ -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]); @@ -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; } @@ -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)); } diff --git a/BSB_LAN/include/get_cmdtbl_values.h b/BSB_LAN/include/get_cmdtbl_values.h index 751b6282..2c65668c 100644 --- a/BSB_LAN/include/get_cmdtbl_values.h +++ b/BSB_LAN/include/get_cmdtbl_values.h @@ -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; } diff --git a/BSB_LAN/include/pps_handling.h b/BSB_LAN/include/pps_handling.h index 5046adc4..f32229fe 100644 --- a/BSB_LAN/include/pps_handling.h +++ b/BSB_LAN/include/pps_handling.h @@ -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 diff --git a/BSB_LAN/include/print_telegram.h b/BSB_LAN/include/print_telegram.h index ea0fac31..d22570bc 100644 --- a/BSB_LAN/include/print_telegram.h +++ b/BSB_LAN/include/print_telegram.h @@ -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); } @@ -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);