Added device class code and default value for serial 1

This commit is contained in:
Jan Mrna 2022-06-19 22:54:13 +02:00
parent f4ee8ace45
commit 173aeec2fc
2 changed files with 9 additions and 0 deletions

View File

@ -48,6 +48,10 @@ config_read(&config);
* Device description data can be accessed using direct readout from the memory
* Device configuration data can be accessed using config_t struct.
*/
/* device class: IAQ_Wired ; device code: 0x0010 (see serial generator repo) */
#define CONFIG_DEVICE_CODE 0x0010
#define CONFIG_DEFAULT_LED_ON 1
#define CONFIG_DEFAULT_LED_BRIGHTNESS 100
#define CONFIG_DEFAULT_LED_ALERT1_LIMIT 1500
@ -55,6 +59,8 @@ config_read(&config);
#define CONFIG_DEFAULT_LED_SMOOTH 1
#define CONFIG_DEFAULT_SCD4x_T_OFFSET 0
#define CONFIG_DEFAULT_BAUDRATE_INDEX 0
#define CONFIG_DEFAULT_SERIAL_1 (CONFIG_DEVICE_CODE)
/* SERIAL_2 is not defined, as it makes no sense to have default value */
#define CONFIG_SERIAL_NUMBER_1_LENGTH 2
#define CONFIG_SERIAL_NUMBER_2_LENGTH 2

View File

@ -296,6 +296,9 @@ int main(void)
int8_t config_read_status = config_read(&sensor_config);
if (config_read_status != CONFIG_OK)
{
/* serial_number_1 contains device class code,
* in case of EEPROM corruption it should have reasonable value */
sensor_config.serial_number_1 = CONFIG_DEFAULT_SERIAL_1;
sensor_config.modbus_addr = MODBUS_DEFAULT_SLAVE_ADDRESS;
sensor_config.led_co2_alert_limit1 = CONFIG_DEFAULT_LED_ALERT1_LIMIT;
sensor_config.led_co2_alert_limit2 = CONFIG_DEFAULT_LED_ALERT2_LIMIT;