fredlcore / BSB-LAN

LAN/WiFi interface for Boiler-System-Bus (BSB) and Local Process Bus (LPB) and Punkt-zu-Punkt Schnittstelle (PPS) with a Siemens® controller used by Elco®, Brötje® and similar heating systems
216 stars 83 forks source link

[BUG] Crash on opening sensor page (Guru Meditation Error: Core 1 panic'ed) #564

Closed deki closed 1 year ago

deki commented 1 year ago

BSB-LAN Version 3.1.5-20230326095055

Architecture ESP32 NodeMCU

Bus system BSB

Describe the bug Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled. and reboot happens when opening sensors page.

To Reproduce Steps to reproduce the behavior: Open sensors page /K44

Logs

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13924
ho 0 tail 12 room 4
load:0x40080400,len:3600
entry 0x400805f0
READY
Reading EEPROM
Reading done.
EEPROM schema v.11 Program schema v.11
Address EEPROM option 0: 0
Address EEPROM option 1: 1
Address EEPROM option 2: 2
Address EEPROM option 3: 6
Address EEPROM option 4: 226
Address EEPROM option 5: 306
Address EEPROM option 6: 490
Address EEPROM option 7: 491
Address EEPROM option 8: 492
Address EEPROM option 9: 493
Address EEPROM option 10: 494
Address EEPROM option 11: 495
Address EEPROM option 12: 499
Address EEPROM option 13: 819
Address EEPROM option 14: 823
Address EEPROM option 15: 1143
Address EEPROM option 16: 1149
Address EEPROM option 17: 1150
Address EEPROM option 18: 1154
Address EEPROM option 19: 1158
Address EEPROM option 20: 1162
Address EEPROM option 21: 1166
Address EEPROM option 22: 1168
Address EEPROM option 23: 1172
Address EEPROM option 24: 1176
Address EEPROM option 25: 1240
Address EEPROM option 26: 1304
Address EEPROM option 27: 1305
Address EEPROM option 28: 1306
Address EEPROM option 29: 1316
Address EEPROM option 30: 1317
Address EEPROM option 31: 1637
Address EEPROM option 32: 1638
Address EEPROM option 33: 1642
Address EEPROM option 34: 1643
Address EEPROM option 35: 1644
Address EEPROM option 36: 1645
Address EEPROM option 37: 1649
Address EEPROM option 38: 1714
Address EEPROM option 39: 1779
Address EEPROM option 40: 1844
Address EEPROM option 41: 1876
Address EEPROM option 42: 1878
Address EEPROM option 43: 1879
Address EEPROM option 44: 1880
Address EEPROM option 45: 1881
Address EEPROM option 46: 1913
Address EEPROM option 47: 1977
Address EEPROM option 48: 1997
Address EEPROM option 49: 2017
Address EEPROM option 50: 2037
Address EEPROM option 51: 2038
Address EEPROM option 52: 2039
Address EEPROM option 53: 2040
Address EEPROM option 54: 2041
Address EEPROM option 55: 2042
Address EEPROM option 56: 2043
Address EEPROM option 57: 2075
Address EEPROM option 58: 2076
Address EEPROM option 59: 2077
Address EEPROM option 60: 2078
Address EEPROM option 61: 2080
Address EEPROM optionj
Address EEPROM option 63: 2083
Address EEPROM option 64: 2084
Power-saving activated.
Size of cmdtbl: 35812
free RAM: 286212
BSB-LAN version: 3.1.5-20230326095055
3.1.5-20230326095055
Microcontroller: ESP32/NodeMCU
Using RX/TX pins 16, 17
PPS settings:
Starting SD..Setting up WiFi interface..................................................
Attempting to connect to WPA SSID: MyWifi..E (17757) wifi:sta is connecting, return error
..
You're connected to the network:
SSID: MyWifi
IP Address: 192.168.xx.xx
Signal strength (RSSI): -44Bm
Waiting 3 seconds to give Ethernet shield time to get ready...
Calculating free space on SD...1433600 Bytes free
Start network services
Device family: 163
Device variant: 5

Starting MDNS service with hostname BSB-LAN
Setup complete
Client ID: BSB-LAN
Will topic: heating/status
Connect to MQTT broker, updating will topic
Subscribed to topic 'heating'
Published status 'online' to topic 'heating/status'
DSP1->HEIZ QUR 8310.0 Diagnose Erzeuger - Kesseltemperatur-Istwert: 
DC 8A 00 0B 06 3D 0D 05 19 4F 8C
HEIZ->DSP1 ANS 8310.0 Diagnose Erzeuger - Kesseltemperatur-Istwert: 34.5 °C
DC 80 0A 0E 07 0D 3D 05 19 00 08 A1 93 E9
DSP1->HEIZ QUR 8310.0 Diagnose Erzeuger - Kesseltemperatur-Istwert: 
DC 8A 00 0B 06 3D 0D 05 19 4F 8C
HEIZ->DSP1 ANS 8310.0 Diagnose Erzeuger - Kesseltemperatur-Istwert: 34.0 °C
DC 80 0A 0E 07 0D 3D 05 19 00 08 82 87 E8
DSP1->HEIZ QUR 8310.0 Diagnose Erzeuger - Kesseltemperatur-Istwert: 
DC 8A 00 0B 06 3D 0D 05 19 4F 8C
HEIZ->DSP1 ANS 8310.0 Diagnose Erzeuger - Kesseltemperatur-Istwert: 33.5 °C
DC 80 0A 0E 07 0D 3D 05 19 00 08 62 7A C6
Client ID: BSB-LAN
Will topic: heating/status
Connect to MQTT broker, updating will topic
Subscribed to topic 'heating'
Published status 'online' to topic 'heating/status'
GET / HTTP/1.1

GET /K44 HTTP/1.1

56
Virtual parameter 20000 queried. Table line 1243
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x4008ab6d  PS      : 0x00060d30  A0      : 0x800d6461  A1      : 0x3ffb1f00  
A2      : 0x3ffc5720  A3      : 0x00000000  A4      : 0x000000ff  A5      : 0x0000ff00  
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x00000000  A9      : 0x3ffb1b40  
A10     : 0x3ffc5720  A11     : 0xffffffff  A12     : 0x00000006  A13     : 0x3ffb1d50  
A14     : 0x00000006  A15     : 0x3ffb1d50  SAR     : 0x0000001f  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x4008ab6d  LEND    : 0x4008ab81  LCOUNT  : 0xffffffff  

Backtrace: 0x4008ab6a:0x3ffb1f00 0x400d645e:0x3ffb1f10 0x400d9a1d:0x3ffb1f30 0x400db7d3:0x3ffb1f70 0x400df00d:0x3ffb1fa0 0x400ee89d:0x3ffb2290

ELF file SHA256: f393d899c49b5b86

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13924
ho 0 tail 12 room 4
load:0x40080400,len:3600
entry 0x400805f0
READY

Expected behavior Sensor page opens instead of reboot

Desktop (if applicable, please complete the following information):

fredlcore commented 1 year ago

Thanks. please also post your BSB_LAN_config.h so I can recreate the issue here.

fredlcore commented 1 year ago

And please also call the following parameters directly via the URL http://bsb-lan/PARAMETERNUMBER 20000 20006 20050 20500 20700

deki commented 1 year ago
/************************************************************************************/
/************************************************************************************/
/* Settings -   BEGIN                                                               */
/************************************************************************************/
/************************************************************************************/

// Upon first installation, rename this file from BSB_lan_config.h.default to BSB_lan_config.h and adjust settings accordingly
// Users who still use Arduino Mega2560 boards instead of Arduin Due: Please have a look at the very end of this configuration
// where certain modules are disabled by default due to limited flash memory.

/* Select language; so far German is the most complete, with English following.
 * Available languages are: Czech (CS), German (DE), Danish (DA), English (EN), Spanish (ES), Finnish (FI),
 * French (FR), Greek (EL), Hungarian (HU), Italian (IT), Dutch (NL), Polish (PL), Russian (RU), Swedish (SV),
 * Slovenian (SI) and Turkish (TR).
 * Incomplete languages will automatically be filled up with English translations first, and if no English translation
 * is available, fallback will take place to German.
*/
#define LANG DE

/*
Allow to initialize program configuration by reading settings from EEPROM
byte UseEEPROM = 0; // Configuration is read from this config file.
                    // Configuration can be stored in EEPROM but will not used while UseEEPROM is zero.
                    // Set zero for fallback startup in case EEPROM configuration is broken.
byte UseEEPROM = 1; // Configuration will be read from EEPROM. This is the default.
*/
byte UseEEPROM = 1;

/*
 *  Enter a MAC address, found either on the EthernetShield or use the one below.
 *  Change this if you have more than one BSB-LAN adapter in your LAN, so that there aren't any address conflicts.
 *  MAC address here only affects the LAN shield, it doesn't apply to the WiFi-ESP-solution.
*/
byte mac[6] = { 0x00, 0x80, 0x41, 0x19, 0x69, 0x90 };

/*
 * Initialize the Ethernet server library
 * with the IP address and port you want to use
 * (port 80 is default for HTTP):
*/

uint16_t HTTPPort = 80;
bool useDHCP = true;                 // Set to false if you want to use a fixed IP.
byte ip_addr[4] = {192,168,178,88};     // Please note the commas instead of dots!!!  Set useDHCP to true if you want DHCP.
byte gateway_addr[4] = {192,168,178,1}; // Gateway address. This is usually your router's IP address. Please note the commas instead of dots!!! Ignored if first value is 0.
byte dns_addr[4] = {192,168,178,1};     // DNS server. Please note the commas instead of dots!!! Ignored if first value is 0.
byte subnet_addr[4] = {255,255,255,0};  // Subnet address. Please use commas instead of dots!!! Ignored if first value is 0.

#define WIFI                          // Activate this definement if you want to use WiFi. Note: MAC address can't be set individually.
char wifi_ssid[32] = "MyWifi"; // enter your WiFi network name (SSID) here
char wifi_pass[64] = "MyPassword";// enter your WiFi password here
#define WIFI_SPI_SS_PIN 12              // defines SPI-SS pin for Arduino-ESP8266 connection

#define MDNS_SUPPORT                   // Advertises the hostname in the local network. Disable this if you don't want your device to be found under this name in your network.
char mDNS_hostname[32] = "BSB-LAN";

#define DEBUG         // Compile with verbose DEBUG module if defined
byte debug_mode = 1;  // Debug mode: 0 - disabled, 1 - send debug messages to serial interface, 2 - send debug messages to telnet client
byte verbose = 1;     // If set to 1, all messages on the bus are printed to debug interface
byte monitor = 0;     // Bus monitor mode. This is only necessary for in-depth debug sessions.
bool show_unknown = true; // true - show all parameters, false - hide unknown parameters from web display (parameters will still be queried and therefore take time!)
//#define DEVELOPER_DEBUG //Very verbose debug output. This option will dramatically slow down MCU performance. Useful for developers not for users.

/* SECURITY OPTIONS
 * There are several options to control and protect access to your heating system. However, keep
 * in mind, that even activating all three options are no guarantee that a versatile intruder with
 * access to your (W)LAN won't be able to gain access. In any case, no encryption of data streams
 * is provided from the Arduino itself. Use VPN or a SSL proxy if that is a must for you and connect
 * the Arduino wired to the VPN server or SSL proxy. On the other hand, someone with this amount
 * of criminal activity will probably have it easier just to access your heating system face-to-face ;)
*/

/*
 * if PASSKEY length is non-zero, the URL has to contain the defined passkey as first element
 * e.g.
 * char PASSKEY[64] = "1234";
 * http://192.168.178.88/1234/                - to view the main website (don't forget the trailing slash!)
 * http://192.168.178.88/1234/K               - to list all categories
 * http://192.168.178.88/1234/8700/8740/8741  - to list parameters 8700, 8740 and 8741 in one request
*/
char PASSKEY[64] = "";

/* activate IP-address-based access.
You can set any ip address as trusted.
Not used if first byte is 0
*/
byte trusted_ip_addr[4] = {0,0,0,0};
byte trusted_ip_addr2[4] = {0,0,0,0};

/* Activate HTTP-Auth authentication to provide username/password based access. No encryption!
 * Credentials have to be entered in the form
 * User:Password
 */
//char USER_PASS[64] = "User:Password";
char USER_PASS[64] = "";      // HTTP-Auth will be disabled if USER_PASS string length is zero

// Compile module with one wire bus support.
#define ONE_WIRE_BUS
byte One_Wire_Pin = 0;         // Define the pin for one wire temperature sensors. 0 - disable oneWire bus

// Compile module with DHT temperature/humidity sensors support
#define DHT_BUS
// Define the pins for DHT temperature/humidity sensors (Up to 10)
uint8_t DHT_Pins[10] = {0};

// Compile module with BME280 temperature/humidity/pressure sensors support on I2C bus.
// Up to two sensors with 0x76 and 0x77 addresses.
#define BME280
byte BME_Sensors = 0; //Define number of BME280 sensors

// Compile module for calculation 24h averages for selected programs
#define AVERAGES
// Create 24h averages from these parameters and save data into averages.txt on SD-card.
float avg_parameters[80] = {
// parameter, destination (as in dest_address below)
  8700, 0,                         // Außentemperatur
  8326, 0                          // Brenner-Modulation
};

/* Compile module for logging.
File logging requires a FAT32 formatted micro SD card inserted into the Ethernet shield's card slot.
Does: log bus telegrams to file
      log selected values to file
      store to SD and load selected 24h averages
      send selected values as UDP broadcast
      push selected values to an MQTT broker*/
#define LOGGER

#define UDP_LOG_PORT 6502 // fixed here, not configurable via web interface

// Use SD card adapter on ESP32-based boards instead of internal flash-based storage
//#define ESP32_USE_SD

// Log "raw" bus telegrams. Data saved in journal.txt on SD-card.
// Telegrams logged upon boot:
// int logTelegram = LOGTELEGRAM_OFF; // nothing to log,
// int logTelegram = LOGTELEGRAM_ON;  // log all telegrams,
// int logTelegram = LOGTELEGRAM_ON + LOGTELEGRAM_UNKNOWN_ONLY;           // log unknown telegrams,
// int logTelegram = LOGTELEGRAM_ON + LOGTELEGRAM_BROADCAST_ONLY;         // log broadcast telegrams,
// int logTelegram = LOGTELEGRAM_ON + LOGTELEGRAM_UNKNOWNBROADCAST_ONLY;  // log unknown broadcast telegrams only;
int logTelegram = LOGTELEGRAM_OFF;

// Logging data from parameters
// Interval and list of parameters can be redefined through /L command during runtime
// Data will be written to "datalog.txt"
unsigned long log_interval = 3600;  // Logging interval (to SD card, UDP and MQTT broker) in seconds
float log_parameters[80] = {
// parameter, destination (as in dest_address below)
  8700, 0,                   // Außentemperatur
  8743, 0,                  // Vorlauftemperatur
  8314, 0,                  // Rücklauftemperatur
//  20000, 0,                 // Spezialparameter: Brenner-Laufzeit Stufe 1
//  20001, 0,                 // Spezialparameter: Brenner-Takte Stufe 1
//  20002, 0,                 // Spezialparameter: Brenner-Laufzeit Stufe 2
//  20003, 0,                 // Spezialparameter: Brenner-Takte Stufe 2
//  20004, 0,                 // Spezialparameter: TWW-Laufzeit
//  20005, 0,                 // Spezialparameter: TWW-Takte
//  20050, 0,                 // Spezialparameter 20050-20099: 24h-Durchschnittswerte
//  20100, 0,                 // Spezialparameter 20100-20299: DHT22-Sensoren 1-50
//  20300, 0,                 // Spezialparameter 20300-20499: DS18B20-Sensoren 1-100
//  20500, 0                  // Spezialparameter 20500-20699: MAX!-Sensoren 1-50
};

// Compile MQTT extension: activate sending log_parameters to MQTT broker every log_interval seconds
#define MQTT
byte mqtt_mode = 3; // MQTT: 1 - send messages in plain text format, 2 - send messages in JSON format, 3 - send messages in rich JSON format. Use this if you want a json package of your logging information printed to the mqtt topic
// JSON payload will be of the structure: {"MQTTDeviceID": {"status":{"log_param1":"value1"}}}
// rich JSON payload will be of the structure: {"MQTTDeviceID": {"id": "parmeter number from log values", "name": "parameter name from logvalues", "value": "query result", "desc": "enum value description", "unit": "unit of measurement", "error", error code}}
byte mqtt_broker_ip_addr[4] = {192,168,xx,xx}; // MQTT broker ip address. Please use commas instead of dots!!!
char MQTTUsername[65] = "";                 // Set username for MQTT broker here or set empty string if no username/password is used.
char MQTTPassword[65] = "";                 // Set password for MQTT broker here or set empty string if no password is used.
char MQTTTopicPrefix[65] = "heating";           // Optional: Choose the "topic" for MQTT messages here. In case of empty string, default topic name will be used

// Optional: Define a device name to use as header in json payload. In case of empty string, "BSB-LAN" will be used.
// This value is also used as a client ID towards the MQTT broker, change it if you have more than one BSB-LAN on your broker.
char MQTTDeviceID[32] = "BSB-LAN";

// Logging mode: 0 - disabled, 1 - write values to SD card, 2 - write 24h averages to SD card, 4 - send values to MQTT, 8 -  send values to UDP. Can be any sum of these values.
byte LoggingMode = 4; //CF_LOGMODE_SD_CARD | CF_LOGMODE_24AVG | CF_LOGMODE_MQTT | CF_LOGMODE_UDP

// Compile IPWE extension
#define IPWE
bool enable_ipwe = false;  // true - activate IPWE extension (http://xxx.xxx.xxx.xxx/ipwe.cgi)
// Parameters to be displayed in IPWE extension
float ipwe_parameters[80] = {
// parameter, destination (as in dest_address below)
  8700, 0,                  // Außentemperatur
  8743, 0,                  // Vorlauftemperatur
  8314, 0,                  // Rücklauftemperatur
//  8750, 0,                  // Gebläsedrehzahl
//  8830, 0,                  // Warmwassertemperatur
//  8740, 0,                  // Raumtemperatur Ist
//  8741, 0,                  // Raumtemperatur Soll
//  8326, 0,                  // Brenner-Modulation
//  8337, 0,                  // Startzähler Brenner
//  8703, 0,                  // Aussentemperatur gedämpft
//  8704, 0                   // Aussentemperatur gemischt
};

// If you prefer to use the log file plotting (/DG) used in BSB-LAN 2.1.3, disable the following #define.
// Otherwise a newer implementation will be used that does require (automated) loading of an additional
// Javascript library off the internet (currently 204 KB), but offers the following improvements:
// - better legibility for value numbers with plot lines close to each other (mouseover on plot)
// - user can interactively highlight plot lines for improved overview (mouseover on legend entries)
// - user can interactively disable plot lines for improved overview and vertical scaling (click on legend entries)
// - added zoom (mousewheel/pinch on plot) and pan capability (drag zoomed-in plot)
// - saves over 4 KB in compiled BSB-LAN sketch
#define USE_ADVANCED_PLOT_LOG_FILE
#define DEFAULT_DAYS_TO_PLOT "3" // must be a positive integer value in double quotes!

// Compile CUNO/CUNX/modified MAX!Cube extension.
#define MAX_CUL
bool enable_max_cul = false;                // enable or disable connection to CUNO/CUNX/modified MAX!Cube;
byte max_cul_ip_addr[4] = {192,168,178,5};     // IP of CUNO/CUNX/modified MAX!Cube. Please use commas instead of dots!!!
char max_device_list[20][11] = {               // list of MAX! wall/heating thermostats that should be polled
  "KEQ0502326",                                // use MAX! serial numbers here which have to have exactly 10 characters
  "KEQ0505080"
};

// defines the number of retries for the query command
#define QUERY_RETRIES  3

// Setting bus pins and bus type

byte bus_pins[2] = {0,0}; //First value - RX pin, second value - TX pin. 0,0 - auto select (19,18 for Due, 16,17 for NodeMCU, 36,17 for Olimex EVB, 36,5 for Olimex POE and 68,69 for Mega).
uint8_t bus_type = 0;  // set bus system at boot: 0 = BSB, 1 = LPB, 2 = PPS
// BSB:
// - 'own_address' sets own address, defaults to 0x42 (LAN in serial monitor)
// - 'dest_address' sets destination address, defaults to 0 for heating system.
// LPB:
// - 'own_address and 'dest_address' set own and destination address (high nibble = segment, low nibble = device minus 1)
// - defaults to 0x42 for own address and 0x00 for destination address, i.e. segment 4, device 3 for Arduino/BSB-LAN and segment 0, device 1 for heating system
byte own_address = 0x42;
byte dest_address = 0x00;
// PPS:
// - set 'pps_write' to "1" to enable writing to heater - only use this if there is no other room controller (such as QAA50/QAA70) active.
bool pps_write = 0;
byte QAA_TYPE = 0x53;  // 0x53 = QAA70, 0x52 = QAA50, 0x5A = QAA10, 0x37 = QAA95, 0x66 = BMU, 0xEA = MCBA/REA70/DC225

/* Set the device family and device variant of your heating system. Only change this if you _really_ know what you are doing!
 * Set fixed_device_family and fixed_device_variant to your device family and variant (parameters 6225 and 6226) here
 * if heating system is not running when Arduino is powered on.
*/
uint16_t fixed_device_family = 0;
uint16_t fixed_device_variant = 0;

// defines default flag for parameters
// use "#define DEFAULT_FLAG FL_SW_CTL_RONLY" to control read/write functionality via configuration in web interface.
// use "#define DEFAULT_FLAG 0" to make (almost) all parameters writeable
// use #define DEFAULT_FLAG FL_RONLY to run the program always in read-only mode.
#define DEFAULT_FLAG FL_SW_CTL_RONLY

// include commands from BSB_lan_custom.h to be executed at the end of each main loop
//#define CUSTOM_COMMANDS

/*
 * Check for new versions when accessing BSB-LAN's main page.
 * Doing so will poll the most recent version number from the BSB-LAN server.
 * In this process, it is unavoidable that your IP address will be transferred to the server, obviously.
 * We nevertheless mention this here because this constitutes as 'personal data' and this feature is therefore disabled by default.
 * Activating this feature means you are consenting to transmitting your IP address to the BSB-LAN server where it will be stored
 * for up to two weeks in the server's log files to allow for technical as well as abuse analaysis.
 * No other data (such as anything related to your heating system) is transmitted in this process, as you can see in the source code.
*/
#define VERSION_CHECK
bool enable_version_check = false;

#define ENABLE_ESP32_OTA
boolean enable_ota_update = false;

// Reduce clock speed of ESP32 from 240 MHz to 80MHz, saving ca. 20% energy. 
// Reduces WiFi range and log file display times when using and WiFi (LAN not affected). Set to "false" if you have problems with any of these.
boolean esp32_save_energy = true;                                                                    

// "External" web server. Read files from SD-card. Only static content: html, js, css, jpg, etc.
//#define WEBSERVER

// Configuration will be stored in EEPROM
#define CONFIG_IN_EEPROM

// Compile web-based configuration and EEPROM config store module extension.
#define WEBCONFIG

// Compile JSON-based configuration and EEPROM config store module extension.
#define JSONCONFIG

#define RGT_EMULATOR
float rgte_sensorid[3][5] = {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}; //Temperature sensor program IDs for RGT1/PPS - RGT3. If zero then RGT will not be emulated. If more than one program set per RGT then average will be calculated and used.

//Enable presence buttons and TWW/DHW push on selected pins.
// Pins on Mega can be (Digital) 2, 3, 18, 19, 20, 21
// On Due any Digital pins can be selected excluding 12, 16-21, 31, 33, 53.
// Make sure you aren't using pins which are already in use for sensors (default: 2, 3, 7) or change them accordingly.
#define BUTTONS
uint8_t button_on_pin[4] = {0, 0, 0, 0}; //Order: TWW push, presence ROOM1, presence ROOM2, presence ROOM3

// Variables for future use:
// Compile room unit replacement extension
#define ROOM_UNIT
byte UdpIP[4] = {0,0,0,0}; // (destination IP address for sending UDP packets to, the room unit replacement of FHEM user @fabulous uses that)
uint16_t UdpDelay = 15;    // (interval in seconds to send UDP packets)

// Compile off-site logger extension
#define OFF_SITE_LOGGER
byte destinationServer[128] = "";   // URL string to periodically send values to an off-site logger
uint16_t destinationPort = 80;      // port number for abovementioned server
uint32_t destinationDelay = 84600;  // interval in seconds to send values

/************************************************************************************/
/************************************************************************************/
/* Settings -   END                                                                 */
/************************************************************************************/
/************************************************************************************/
deki commented 1 year ago

Calling parameters via URL doesn't work as well.

DE-cr commented 1 year ago

I was just to about to report the same thing, then I noticed this bug report here. My setup (WLAN SSID and password erased for this post): BSB-LAN_C

DE-cr commented 1 year ago

And please also call the following parameters directly via the URL http://bsb-lan/PARAMETERNUMBER 20000 20006 20050 20500 20700

20050 works as expected, the others crash my system.

fredlcore commented 1 year ago

@DE-cr: I can'r reproduce this here, could you add some kind of debug messages in lines 4100ff (queryVirtualPrognr) and see if the variable line holds an invalid value or if the function call to recognizeVirtualFunctionGroup creates the problem? I assume that the error happens somewhere in these lines.

DE-cr commented 1 year ago

I'll see what I can see. ;) In the meantime, I can report that config changing via /CI (to enable telnet debugging) also crashed my system. P.S. ...once, i.e. not reproducible.

DE-cr commented 1 year ago

A printFmtToDebug() call right in the first line of queryVirtualPrognr() does not give me any output, so I guess the problem is before that. Where is /Kn (with n being the category number) handled? I've only found

        // list categories
        if (p[1]=='K' && !isdigit(p[2])) {

i.e. /K without n.

fredlcore commented 1 year ago

That would be line 6869 ff. and then 6907.

This error with the sensors really sounds familiar and I'm sure we fixed it or at least figured out which settings had to be made, but I can't find it right now, will keep searching...

fredlcore commented 1 year ago

Can both of you please just install the most recent version from master and only change your network settings in BSB_LAN_config.h, please, and start out with UseEEPROM = 0. If then there is no error, set UseEEPROM = 1 and test again. If that also works, please adjust your settings one-by-one, save the settings and access the sensors page again. That would be the only way to figure out where the problem lies. I have downloaded the master repo and just changed the network settings and it worked without problems.

DE-cr commented 1 year ago

Downloaded BSB-LAN-master, changed default config.h to UseEEPROM=0, enabled WiFi, set SSID and password, compiled and uploaded to ESP32, called http://bsb-lan/ (ok), called sensors (/K28) => crash.

DE-cr commented 1 year ago

That would be line 6869 ff. and then 6907.

Thanks, I thought that would be in the JSON handling part only.

Some debug code at 6869 ff ...

            if (range[0]=='K') {
              uint8_t cat = atoi(&range[1]) * 2; // * 2 - two columns in ENUM_CAT_NR table
printFmtToDebug("range=%s,cat=%d,sizeof(*ENUM_CAT_NR)=%ld,sizeof(ENUM_CAT_NR=%ld),ENUM_CAT_NR[%ld]\n",range,cat,sizeof(*ENUM_CAT_NR),sizeof(ENUM_CAT_NR),sizeof(ENUM_CAT_NR)/sizeof(*ENUM_CAT_NR));//-cr
              start = ENUM_CAT_NR[cat];
              end = ENUM_CAT_NR[cat+1];
printFmtToDebug("start=%g,end=%g\n",start,end);//-cr
              if (end > ENUM_CAT_NR[cat+2]) {
                end = ENUM_CAT_NR[cat+2]-1;
              }
printFmtToDebug("end=%g\n",end);//-cr
            } else {

... gives me:

GET /K28 HTTP/1.1

range=K28,cat=56,sizeof(*ENUM_CAT_NR)=4,sizeof(ENUM_CAT_NR=232),ENUM_CAT_NR[58]
start=20000,end=20899
end=-211.125
30
Virtual parameter 20000 queried. Table line 447
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

=>

              if (end > ENUM_CAT_NR[cat+2]) {
                end = ENUM_CAT_NR[cat+2]-1;
              }

... reads past the end of ENUM_CAT_NR!

DE-cr commented 1 year ago

... as would a user's manually calling /K99, e.g. ;)

fredlcore commented 1 year ago

Ok, this line

end = ENUM_CAT_NR[cat+2]-1;

obviously makes no sense, but I still don't get it why it works here without a problem. Anyway, I'll add a check for maximum category number, that should fix it.

fredlcore commented 1 year ago

Sorry, it does make sense because some devices generate parameter lists with overlapping parameter numbers. So taking the start of the next category minus one as the end of the current category if it overlaps into the next is already a safety check.

DE-cr commented 1 year ago

Even with overlapping parameter lists: Couldn't this be removed?:

              if (end > ENUM_CAT_NR[cat+2]) {
                end = ENUM_CAT_NR[cat+2]-1;
              }
fredlcore commented 1 year ago

No, because if you have a parameter list like this (which really exists):

700, 9590,
1000, 1250,

then you don't want the first category to spew out all parameters from 700 to 9590, but just 700 to 999. 9590 in this case is a "hidden" parameter that the heater advertises with an apparently unused parameter number that however doesn't fit the category range. We still add it to the parameter list, but users will only have access to it when directly accessing the parameter (of if it would fall into another regular category range).

I have now uploaded a fix, could you please check and see if it works now? Thanks.

DE-cr commented 1 year ago

Will do, when I'm back at home.

DE-cr commented 1 year ago

Still crashes my system, sorry. I'll do more debugging later., when I find the time.

DE-cr commented 1 year ago

I can tell you now that my system crashes in the last line of this code excerpt:

char *build_pvalstr(bool extended) {
  int len = 0;
  outBuf[len] = 0;
  if (extended && decodedTelegram.error != 257) {
    len+=sprintf_P(outBuf, PSTR("%g "), decodedTelegram.prognr);

    len+=strlen(strcpy_PF(outBuf + len, decodedTelegram.catdescaddr));

...with decodedTelegram.catdescaddr==0 and decodedTelegram.prognr==20000 and decodedTelegram.cat==30.

Figuring out why .catdescaddr doesn't point to a C string here might be easier for you than for me. Otherwise I could look at it again tomorrow evening.

fredlcore commented 1 year ago

Thanks, that resembles the problem I think I had fixed some weeks ago, but maybe at a different location in code. I'll see what I can do...

fredlcore commented 1 year ago

Hm, if decodedTelegram.cat is still 30, then that's the problem. It has to be 28. 30 is again beyond the size of the category ENUM. I wonder where the 30 in the output of your debug code comes from. I don't see it in your code and neither in the general code. But the problem lies there where the category gets bumped up by two.

fredlcore commented 1 year ago

Ok, I think I found it: https://github.com/fredlcore/BSB-LAN/commit/34707cd653c1a7ff308f8e67c83e5fcc90047bd7 Let me know if that really fixes the problem.

DE-cr commented 1 year ago

No more crashes on my system. :+1:

deki commented 1 year ago

Great to see the progress. I'm away from home right now but will try on the weekend.

fredlcore commented 1 year ago

Great, thanks for the feedback, @DE-cr: Is the /CI crash also fixed?

DE-cr commented 1 year ago

The /CI crash appeared only once, but I'll try again tonight, when I'm at home.

DE-cr commented 1 year ago

/CI: enabled telnet debugging (this is where my system crashed once, as reported above), disabled debugging again => works as expected

fredlcore commented 1 year ago

Great, so I'll close this as fixed now...