Skip to content

Commit e25d592

Browse files
authored
Merge pull request #26 from RobustoFramework/1x
1x
2 parents 23ad217 + 13c6e47 commit e25d592

29 files changed

Lines changed: 119 additions & 84 deletions

components/robusto/base/src/logging/logging_esp-idf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void compat_rob_log_writev(rob_log_level_t level, const char *tag, const char *f
4444
// On the ESP platform, there is no need for the sparse mode.
4545
void compat_rob_log_write_sparse(const char *tag, const char *format)
4646
{
47-
va_list arg_list = NULL;
47+
va_list arg_list;
4848
compat_rob_log_writev(ROB_LOG_LOCAL_LEVEL, tag, format, arg_list);
4949
}
5050
#endif

components/robusto/base/src/system/robusto_interrupts_esp32.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,17 @@ uint8_t digitalPinToGPIO(uint8_t pin) {
7878
case 18: return GPIO_NUM_18;
7979
case 19: return GPIO_NUM_19;
8080
case 21: return GPIO_NUM_21;
81+
// These are not always available
82+
#ifdef GPIO_NUM_22
8183
case 22: return GPIO_NUM_22;
84+
#endif
85+
#ifdef GPIO_NUM_23
8286
case 23: return GPIO_NUM_23;
87+
#endif
88+
#ifdef GPIO_NUM_25
8389
case 25: return GPIO_NUM_25;
90+
#endif
91+
8492
case 26: return GPIO_NUM_26;
8593
case 27: return GPIO_NUM_27;
8694
/* Not exposed

components/robusto/base/src/system/robusto_system.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void *robusto_malloc(size_t size)
8484
#endif
8585
}
8686

87-
void *robusto_realloc(void **ptr, size_t size)
87+
void *robusto_realloc(void *ptr, size_t size)
8888
{
8989
#ifdef USE_ESPIDF
9090
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT);

components/robusto/conductor/src/robusto_conductor_client.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ void robusto_add_conductor() {
147147
e_media_type media_type = robusto_mt_lora;
148148
#elif defined(CONFIG_ROBUSTO_CONDUCTOR_CLIENT_CONDUCTOR_MEDIA_I2C)
149149
e_media_type media_type = robusto_mt_i2c;
150+
#elif defined(CONFIG_ROBUSTO_NETWORK_MOCK_TESTING)
151+
e_media_type media_type = robusto_mt_mock;
150152
#else
151153
#error "No media type selected for initial contact with the conductor."
152154
#endif

components/robusto/idf_component.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "2.0.1"
1+
version: "1.3.1"
22
description: "Robusto framework"
33
url: "https://github.com/RobustoFramework"
44
repository: "https://github.com/RobustoFramework/Robusto.git"
@@ -9,7 +9,7 @@ dependencies:
99
espressif/esp_modem: "^1"
1010
jgromes/radiolib: "^6.4"
1111
# Screen support
12-
lvgl/lvgl: "^9"
12+
lvgl/lvgl: "^8"
1313
espressif/esp_lvgl_port: "^2"
1414
espressif/esp_lcd_sh1107: "^1"
1515
maintainers:

components/robusto/include/robusto_message.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ typedef rob_ret_val_t cb_send_message(robusto_peer_t *peer, uint8_t *data, uint3
222222
* @return If true, send receipt (used in initialisation, but not with parts)
223223
*/
224224

225-
bool handle_fragmented(robusto_peer_t *peer, e_media_type media_type, uint8_t *data, int len, uint32_t fragment_size, cb_send_message * send_message);
225+
bool handle_fragmented(robusto_peer_t *peer, e_media_type media_type, const uint8_t *data, int len, uint32_t fragment_size, cb_send_message * send_message);
226226

227227

228228
/**

components/robusto/include/robusto_system.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void * robusto_malloc(size_t size);
7373
* @param size Number of bytes to allocate
7474
* @return void* Pointer to the re-allocated memory
7575
*/
76-
void * robusto_realloc(void **ptr, size_t size);
76+
void * robusto_realloc(void *ptr, size_t size);
7777

7878
/**
7979
* @brief Deallocates the memory at the pointer

components/robusto/input/src/robusto_input_resistance.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ rob_ret_val_t adc_calibration_init(adc_unit_t _adc_unit, adc_channel_t _adc_chan
4242
ROB_LOGE(input_log_prefix, "adc_cali_check_scheme failed with the %i error code.", sch_res);
4343
return ROB_FAIL;
4444
}
45+
#if ADC_CALI_SCHEME_VER_LINE_FITTING
4546
if (scheme_mask == ADC_CALI_SCHEME_VER_LINE_FITTING)
4647
{
48+
4749
adc_cali_line_fitting_config_t line_fitting_config = {
4850
.unit_id = _adc_unit,
4951
.atten = ADC_ATTEN_DB_11,
@@ -54,26 +56,26 @@ rob_ret_val_t adc_calibration_init(adc_unit_t _adc_unit, adc_channel_t _adc_chan
5456
ROB_LOGE(input_log_prefix, "adc_cali_create_scheme_line_fitting failed with the %i error code.", lf_res);
5557
return ROB_FAIL;
5658
}
59+
5760
}
58-
else if (scheme_mask == ADC_CALI_SCHEME_VER_CURVE_FITTING)
61+
else
62+
#elif ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
63+
64+
if (scheme_mask == ADC_CALI_SCHEME_VER_CURVE_FITTING)
5965
{
60-
#if ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
6166
adc_cali_curve_fitting_config_t curve_fitting_config = {
62-
.unit_id = adc_unit,
63-
.chan = adc_channel,
67+
.unit_id = _adc_unit,
68+
.chan = _adc_channel,
6469
.atten = ADC_ATTEN_DB_11,
6570
.bitwidth = ADC_BITWIDTH_DEFAULT};
66-
esp_err_t cf_res = adc_cali_create_scheme_curve_fitting(&curve_fitting_config, cali_handle);
71+
esp_err_t cf_res = adc_cali_create_scheme_curve_fitting(&curve_fitting_config, _cali_handle);
6772
if (cf_res != ESP_OK)
6873
{
6974
ROB_LOGE(input_log_prefix, "adc_cali_create_scheme_curve_fitting failed with the %i error code.", cf_res);
7075
}
71-
#else
72-
ROB_LOGE(input_log_prefix, "Error, unsupported calibration scheme returned by adc_cali_check_scheme: %s",
73-
scheme_mask == 0 ? "Line" : "Curve");
74-
#endif
7576
}
7677
else
78+
#endif
7779
{
7880
ROB_LOGE(input_log_prefix, "Error, unsupported calibration scheme returned by adc_cali_check_scheme: %u", scheme_mask);
7981
return ROB_FAIL;

components/robusto/network/src/media/mock/mock_control.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void ROBUSTO_NETWORK_MOCK_TESTING_init(char * _log_prefix) {
6464
mock_messaging_init(mock_log_prefix);
6565

6666
ROB_LOGI(mock_log_prefix, "Starting the mock worker.");
67-
if (mock_init_worker(&mock_do_on_work_cb, &mock_do_on_poll_cb, mock_log_prefix) != ROB_OK)
67+
if (mock_init_worker((work_callback *)&mock_do_on_work_cb, (poll_callback *)&mock_do_on_poll_cb, mock_log_prefix) != ROB_OK)
6868
{
6969
ROB_LOGE(mock_log_prefix, "Failed initializing mock worker!");
7070
return;

components/robusto/network/src/media/mock/mock_messaging.c

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848

4949
char mock_strings[8] = MOCK_STRINGS;
5050
char mock_binary[4] = MOCK_BINARY;
51-
#define MOCK_PEERNAME_0 "PEER0\x00"
52-
#define MOCK_PEERNAME_1 "PEER1\x00"
51+
#define MOCK_PEERNAME_0 "TEST_MOCK_1\x00"
52+
#define MOCK_PEERNAME_1 "TEST_MOCK_2\x00"
5353
char mock_peername_0[6] = MOCK_PEERNAME_0;
5454
char mock_peername_1[6] = MOCK_PEERNAME_1;
5555

@@ -65,6 +65,25 @@ rob_ret_val_t mock_after_comms(bool is_sending, bool first_call)
6565
return ROB_OK;
6666
}
6767

68+
rob_ret_val_t mock_send_message(robusto_peer_t *peer,uint8_t *data, uint32_t data_length, bool receipt)
69+
{
70+
71+
if (strcmp(peer->name, MOCK_PEERNAME_0) != 0)
72+
{
73+
ROB_LOGE("MOCK", "mock_send_message: The peer name it not '%s', but '%s'", MOCK_PEERNAME_0, peer->name);
74+
}
75+
rob_ret_val_t ret = ROB_OK;
76+
peer->mock_info.last_send = r_millis();
77+
if (receipt)
78+
{
79+
peer->mock_info.last_sent_heartbeat = r_millis();
80+
}
81+
ROB_LOGI("MOCK", "mock_send_message: Mock sending %lu bytes to peer %s", data_length, peer->name);
82+
rob_log_bit_mesh(ROB_LOG_INFO, "MOCK", data, data_length);
83+
return ret;
84+
}
85+
86+
6887

6988
rob_ret_val_t mock_read_receipt(robusto_peer_t *peer, uint8_t **dest_data)
7089
{
@@ -90,26 +109,26 @@ int mock_read_data(uint8_t **rcv_data, robusto_peer_t **peer)
90109
int length = 0;
91110
if ((message_expectation == MMI_STRINGS) || (message_expectation == MMI_STRINGS_ASYNC))
92111
{
93-
length = robusto_make_strings_message(MSG_MESSAGE, 0, 0, (uint8_t *)&mock_strings, 8, rcv_data);
94-
*peer = robusto_peers_find_peer_by_name("TEST_MOCK");
112+
length = robusto_make_multi_message_internal(MSG_MESSAGE, 0, 0, (uint8_t *)&mock_strings, 8, NULL, 0, rcv_data);
113+
*peer = robusto_peers_find_peer_by_name("TEST_MOCK_1");
95114
if ((*peer) != NULL) {
96115
(*peer)->mock_info.last_receive = r_millis();
97116
} else {
98-
ROB_LOGE("MOCK", "TEST_MOCK not found!");
117+
ROB_LOGE("MOCK", "TEST_MOCK_1 not found!");
99118
}
100119

101120
}
102121
else if (message_expectation == MMI_BINARY)
103122
{
104-
length = robusto_make_binary_message(MSG_MESSAGE, 0, 0, (uint8_t *)&mock_binary, 4, rcv_data);
123+
length = robusto_make_multi_message_internal(MSG_MESSAGE, 0, 0, NULL, 0, (uint8_t *)&mock_binary, 4, rcv_data);
105124
}
106125
else if (message_expectation == MMI_SERVICE)
107126
{
108-
length = robusto_make_binary_message(MSG_MESSAGE, 1959, 0, (uint8_t *)&mock_binary, 4, rcv_data);
127+
length = robusto_make_multi_message_internal(MSG_MESSAGE, 1959, 0, NULL, 0, (uint8_t *)&mock_binary, 4, rcv_data);
109128
}
110129
else if (message_expectation == MMI_MULTI)
111130
{
112-
length = robusto_make_multi_message(MSG_MESSAGE, 0, 0, (uint8_t *)&mock_strings, 8, (uint8_t *)&mock_binary, 4, rcv_data);
131+
length = robusto_make_multi_message_internal(MSG_MESSAGE, 0, 0, (uint8_t *)&mock_strings, 8, (uint8_t *)&mock_binary, 4, rcv_data);
113132
}
114133
else if (message_expectation == MMI_BINARY_RESTRICTED)
115134
{

0 commit comments

Comments
 (0)