2020#define MASTER_MAX_CIDS num_device_parameters
2121
2222// Number of reading of parameters from slave
23- #define MASTER_MAX_RETRY (10 )
23+ #define MASTER_MAX_RETRY (1000 )
2424
2525// Timeout to update cid over Modbus
2626#define UPDATE_CIDS_TIMEOUT_MS (500)
@@ -149,10 +149,10 @@ const mb_parameter_descriptor_t device_parameters[] = {
149149 OPTS ( 0xAA , 0x15 , 0 ), PAR_PERMS_READ_WRITE_TRIGGER },
150150 { CID_RELAY_P2 , STR ("RelayP2" ), STR ("on/off" ), MB_DEVICE_ADDR1 , MB_PARAM_COIL , 10 , 6 ,
151151 COIL_OFFSET (coils_port1 ), PARAM_TYPE_U8 , 1 ,
152- OPTS ( 0x55 , 0x2A , 0 ), PAR_PERMS_READ_WRITE_TRIGGER },
152+ OPTS ( 0x55 , 0x2A , 0xAA ), PAR_PERMS_READ_WRITE_TRIGGER },
153153 { CID_DISCR_P1 , STR ("DiscreteInpP1" ), STR ("on/off" ), MB_DEVICE_ADDR1 , MB_PARAM_DISCRETE , 2 , 7 ,
154154 DISCR_OFFSET (discrete_input_port1 ), PARAM_TYPE_U8 , 1 ,
155- OPTS ( 0xAA , 0x15 , 0 ), PAR_PERMS_READ_WRITE_TRIGGER },
155+ OPTS ( 0xAA , 0x15 , 0x55 ), PAR_PERMS_READ_WRITE_TRIGGER },
156156#if CONFIG_FMB_EXT_TYPE_SUPPORT
157157 { CID_HOLD_U8_A , STR ("U8_A" ), STR ("__" ), MB_DEVICE_ADDR1 , MB_PARAM_HOLDING ,
158158 TEST_HOLD_REG_START (holding_u8_a ), TEST_HOLD_REG_SIZE (holding_u8_a ),
@@ -445,7 +445,7 @@ static void master_operation_func(void *arg)
445445 float value = * (float * )temp_data_ptr ;
446446 if (((value > param_descriptor -> param_opts .max ) ||
447447 (value < param_descriptor -> param_opts .min ))) {
448- alarm_state = true;
448+ // alarm_state = true;
449449 break ;
450450 }
451451 } else if ((cid >= CID_RELAY_P1 ) && (cid <= CID_DISCR_P1 )) {
@@ -466,11 +466,11 @@ static void master_operation_func(void *arg)
466466 (char * )param_descriptor -> param_units ,
467467 (const char * )rw_str ,
468468 * (uint8_t * )temp_data_ptr );
469- alarm_state = true;
469+ // alarm_state = true;
470470 break ;
471471 }
472472 if (state & param_descriptor -> param_opts .opt1 ) {
473- alarm_state = true;
473+ // alarm_state = true;
474474 break ;
475475 }
476476 }
@@ -567,11 +567,24 @@ static esp_err_t master_init(void)
567567 return err ;
568568}
569569
570+ #include "esp_heap_trace.h"
571+
572+ #define NUM_RECORDS 100
573+ static heap_trace_record_t trace_record [NUM_RECORDS ];
574+
570575void app_main (void )
571576{
572577 // Initialization of device peripheral and objects
573578 ESP_ERROR_CHECK (master_init ());
574579 vTaskDelay (10 );
575580
581+ ESP_ERROR_CHECK ( heap_trace_init_standalone (trace_record , NUM_RECORDS ) );
582+
583+ ESP_ERROR_CHECK ( heap_trace_start (HEAP_TRACE_LEAKS ) );
584+
576585 master_operation_func (NULL );
586+
587+ ESP_ERROR_CHECK ( heap_trace_stop () );
588+ heap_trace_dump ();
589+
577590}
0 commit comments