kopia lustrzana https://github.com/SP8EBC/ParaTNC
bugfix in serial driver code which were handling len_modifier parameter in wrong way
rodzic
5bafdddf81
commit
d76a0e95bc
34
src/main.c
34
src/main.c
|
@ -293,23 +293,23 @@ int main(int argc, char* argv[]){
|
|||
main_wx_srl_ctx_ptr->te_port = GPIOA;
|
||||
#endif
|
||||
|
||||
#if (defined(PARATNC_HWREV_B) || defined(PARATNC_HWREV_C)) && defined(_DAVIS_SERIAL)
|
||||
// reinitialize the KISS serial port temporary to davis baudrate
|
||||
main_target_kiss_baudrate = DAVIS_DEFAULT_BAUDRATE;
|
||||
|
||||
// reset RX state to allow reinitialization with changed baudrate
|
||||
main_kiss_srl_ctx_ptr->srl_rx_state = SRL_RX_NOT_CONFIG;
|
||||
|
||||
// reinitializing serial hardware
|
||||
srl_init(main_kiss_srl_ctx_ptr, USART1, srl_usart1_rx_buffer, RX_BUFFER_1_LN, srl_usart1_tx_buffer, TX_BUFFER_1_LN, main_target_kiss_baudrate);
|
||||
|
||||
srl_switch_timeout(main_kiss_srl_ctx_ptr, SRL_TIMEOUT_ENABLE, 1500);
|
||||
|
||||
davis_init(main_kiss_srl_ctx_ptr);
|
||||
|
||||
davis_wake_up(1);
|
||||
|
||||
#endif
|
||||
//#if (defined(PARATNC_HWREV_B) || defined(PARATNC_HWREV_C)) && defined(_DAVIS_SERIAL)
|
||||
// // reinitialize the KISS serial port temporary to davis baudrate
|
||||
// main_target_kiss_baudrate = DAVIS_DEFAULT_BAUDRATE;
|
||||
//
|
||||
// // reset RX state to allow reinitialization with changed baudrate
|
||||
// main_kiss_srl_ctx_ptr->srl_rx_state = SRL_RX_NOT_CONFIG;
|
||||
//
|
||||
// // reinitializing serial hardware
|
||||
// srl_init(main_kiss_srl_ctx_ptr, USART1, srl_usart1_rx_buffer, RX_BUFFER_1_LN, srl_usart1_tx_buffer, TX_BUFFER_1_LN, main_target_kiss_baudrate);
|
||||
//
|
||||
// srl_switch_timeout(main_kiss_srl_ctx_ptr, SRL_TIMEOUT_ENABLE, 1500);
|
||||
//
|
||||
// davis_init(main_kiss_srl_ctx_ptr);
|
||||
//
|
||||
// davis_wake_up(1);
|
||||
//
|
||||
//#endif
|
||||
|
||||
|
||||
// configuring an APRS path used to transmit own packets (telemetry, wx, beacons)
|
||||
|
|
|
@ -234,7 +234,7 @@ uint8_t srl_wait_for_rx_completion_or_timeout(srl_context_t *ctx, uint8_t* outpu
|
|||
*output = SRL_UNINITIALIZED;
|
||||
|
||||
// block the execution until the
|
||||
while(ctx->srl_rx_state != SRL_WAITING_TO_RX && ctx->srl_rx_state != SRL_RXING && ctx->srl_rx_state != SRL_RX_ERROR);
|
||||
while(ctx->srl_rx_state != SRL_RX_DONE && ctx->srl_rx_state != SRL_RX_ERROR);
|
||||
|
||||
switch (ctx->srl_rx_state) {
|
||||
case SRL_RX_DONE: {
|
||||
|
@ -290,12 +290,20 @@ uint8_t srl_receive_data(srl_context_t *ctx, int num, char start, char stop, cha
|
|||
ctx->srl_rx_state = SRL_WAITING_TO_RX;
|
||||
ctx->srl_rx_waiting_start_time = master_time;
|
||||
}
|
||||
else {
|
||||
ctx->srl_rx_state = SRL_RXING;
|
||||
}
|
||||
|
||||
ctx->srl_enable_echo = echo;
|
||||
ctx->srl_rx_bytes_counter = 0;
|
||||
ctx->srl_rx_bytes_req = num;
|
||||
|
||||
ctx->srl_rx_lenght_param_addres = len_addr;
|
||||
if (len_addr != 0) {
|
||||
ctx->srl_rx_lenght_param_addres = len_addr;
|
||||
}
|
||||
else {
|
||||
ctx->srl_rx_lenght_param_addres = num + 1;
|
||||
}
|
||||
ctx->srl_rx_lenght_param_modifier = len_modifier;
|
||||
|
||||
ctx->srl_rx_timeout_calc_started = 0;
|
||||
|
@ -342,12 +350,20 @@ uint8_t srl_receive_data_with_instant_timeout(srl_context_t *ctx, int num, char
|
|||
ctx->srl_rx_state = SRL_WAITING_TO_RX;
|
||||
ctx->srl_rx_waiting_start_time = master_time;
|
||||
}
|
||||
else {
|
||||
ctx->srl_rx_state = SRL_RXING;
|
||||
}
|
||||
|
||||
ctx->srl_enable_echo = echo;
|
||||
ctx->srl_rx_bytes_counter = 0;
|
||||
ctx->srl_rx_bytes_req = num;
|
||||
|
||||
ctx->srl_rx_lenght_param_addres = len_addr;
|
||||
if (len_addr != 0) {
|
||||
ctx->srl_rx_lenght_param_addres = len_addr;
|
||||
}
|
||||
else {
|
||||
ctx->srl_rx_lenght_param_addres = num + 1;
|
||||
}
|
||||
ctx->srl_rx_lenght_param_modifier = len_modifier;
|
||||
|
||||
// set current time as receive start time
|
||||
|
|
Ładowanie…
Reference in New Issue