From 1755f48efab3ddf2c34670ddf950498ef537f677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlastimil=20Slint=C3=A1k?= Date: Sat, 15 Mar 2025 11:49:04 +0100 Subject: [PATCH] Fixed most of the compilers warnings, more refactoring needed --- NPR_14/source/Eth_IPv4.cpp | 2 +- NPR_14/source/HMI_telnet.cpp | 6 +++--- NPR_14/source/L1L2_radio.cpp | 8 ++++---- NPR_14/source/SI4463.cpp | 17 +++++++++-------- NPR_14/source/TDMA.cpp | 8 ++++---- NPR_14/source/config_flash.cpp | 2 +- NPR_14/source/signaling.cpp | 8 ++++---- NPR_14/source/signaling.h | 2 +- 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/NPR_14/source/Eth_IPv4.cpp b/NPR_14/source/Eth_IPv4.cpp index 69e1e75..5ceb3f4 100644 --- a/NPR_14/source/Eth_IPv4.cpp +++ b/NPR_14/source/Eth_IPv4.cpp @@ -60,7 +60,7 @@ int Eth_RX_dequeue (W5500_chip* W5500) { int RX_size=0; int mac_size=0; - int i; + // int i; //int match_RTP = 1; unsigned int ethertype; if (*(W5500->interrupt)==0) { diff --git a/NPR_14/source/HMI_telnet.cpp b/NPR_14/source/HMI_telnet.cpp index e37f3ea..a2fee45 100644 --- a/NPR_14/source/HMI_telnet.cpp +++ b/NPR_14/source/HMI_telnet.cpp @@ -426,7 +426,7 @@ void HMI_exit(void) { } static char HMI_yes_no[2][4]={'n','o',0,0, 'y','e','s',0}; -static char HMI_trans_modes[2][4]={'I','P',0,0,'E','t','h',0}; +// static char HMI_trans_modes[2][4]={'I','P',0,0,'E','t','h',0}; static char HMI_master_FDD[3][5]={'n','o',0,0,0,'d','o','w','n',0,'u','p',0,0,0}; void HMI_display_config(void) { @@ -478,7 +478,7 @@ void HMI_set_command(char* loc_param1, char* loc_param2) { unsigned char temp_uchar; unsigned long int temp_uint; float frequency; - unsigned char previous_freq_band; + // unsigned char previous_freq_band; char DHCP_warning[50]; if ((loc_param1) && (loc_param2)) { if (strcmp(loc_param1, "callsign") == 0) { @@ -822,7 +822,7 @@ void HMI_print_who(void) { loc_age = loc_age / 1000000; if (is_TDMA_master) {loc_age = 0;} // master : already timeout in state machine //printf ("age:%i ", loc_age); - if ( (CONF_radio_addr_table_status[i]) && (loc_age < connexion_timeout) ) { + if ( (CONF_radio_addr_table_status[i]) && (loc_age < CONNECTION_TIMEOUT) ) { HMI_printf (" ID:%i Callsign:%s ", i, CONF_radio_addr_table_callsign[i]+2); IP_int2char (CONF_radio_addr_table_IP_begin[i], IP_c); HMI_printf ("IP start:%i.%i.%i.%i ", IP_c[0], IP_c[1], IP_c[2], IP_c[3]); diff --git a/NPR_14/source/L1L2_radio.cpp b/NPR_14/source/L1L2_radio.cpp index f2bb3c0..842e6b0 100644 --- a/NPR_14/source/L1L2_radio.cpp +++ b/NPR_14/source/L1L2_radio.cpp @@ -68,7 +68,7 @@ void FDDdown_RX_pckt_treat(unsigned char* in_data, int size) { //debug_counter++; } -static int RX_FRAME_count_debug = 0; +// static int RX_FRAME_count_debug = 0; void radio_RX_FIFO_dequeue (W5500_chip* W5500) { static unsigned char ethernet_buffer[radio_addr_table_size][1600]; @@ -99,7 +99,7 @@ void radio_RX_FIFO_dequeue (W5500_chip* W5500) { unsigned char TDMA_byte; unsigned char is_downlink; unsigned long int timer_snapshot; - int i; + // int i; if (RX_FIFO_last_received > RX_FIFO_RD_point) { //something new in RX FIFO timer_snapshot = GLOBAL_timer.read_us(); @@ -418,7 +418,7 @@ void segment_and_push (unsigned char* data_unsegmented, int total_size, unsigned unsigned char radio_pckt[360]; #endif int size_sent; - unsigned int rsize_needed; + // unsigned int rsize_needed; unsigned int timer_snapshot; size_remaining = total_size; @@ -428,7 +428,7 @@ void segment_and_push (unsigned char* data_unsegmented, int total_size, unsigned segment_counter = 0; size_sent = 0; - rsize_needed = 100 + (total_size * 1.4); + // rsize_needed = 100 + (total_size * 1.4); if (total_size < 1510) { if (TX_FIFO_full_global(1) == 0) { G_uplink_bandwidth_temp = G_uplink_bandwidth_temp + total_size; diff --git a/NPR_14/source/SI4463.cpp b/NPR_14/source/SI4463.cpp index 444dfa4..9605abc 100644 --- a/NPR_14/source/SI4463.cpp +++ b/NPR_14/source/SI4463.cpp @@ -550,7 +550,7 @@ int SI4463_read_temperature(SI4463_Chip* SI4463) { static int previous_temperature = 300; void SI4463_periodic_temperature_check(SI4463_Chip* SI4463) { - int need_recalibrate; + // int need_recalibrate; int delta_temperature; int i; @@ -562,14 +562,14 @@ void SI4463_periodic_temperature_check(SI4463_Chip* SI4463) { delta_temperature = G_temperature_SI4463 - previous_temperature; if ( ( delta_temperature > 14) || (delta_temperature < -14) ) { //if (1) { - need_recalibrate = 1; + // need_recalibrate = 1; i = SI4463_configure_all(); previous_temperature = G_temperature_SI4463; if (i == 0) {//fail to recalibrate NVIC_SystemReset(); } - } else { - need_recalibrate = 0; + // } else { + // need_recalibrate = 0; } //RADIO_restart_if_necessary(0, need_recalibrate, 0); //0,need,0 } @@ -643,7 +643,7 @@ void SI4463_FIFO_RX_transfer(unsigned int size) { void SI4463_FIFO_TX_transfer(unsigned int size) { //unsigned char trash[150]; //static unsigned char command[5]; - int size_to_write; + // int size_to_write; G_SI4463->cs->write(0); command[0] = 0x66; G_SI4463->spi->transfer_2 (command, 1, SI_trash, 1); @@ -1282,8 +1282,8 @@ void SI4432_TX_test(unsigned int req_duration) { //duration in ms unsigned int timer_begin; unsigned int timer_snapshot; unsigned int real_duration; - unsigned char SI4463_state; - unsigned char loc_answer[8]; + // unsigned char SI4463_state; + // unsigned char loc_answer[8]; unsigned char trash[4]; TX_test_inprogress = 1; @@ -1313,7 +1313,8 @@ void SI4432_TX_test(unsigned int req_duration) { //duration in ms void SI4463_set_frequency(float freq_base, float freq_step) { unsigned char radio_config[15] = {0x11, 0x40, 0x06, 0x00}; - unsigned int step_size_temp, FC_int, FC_frac_int, i; + unsigned int step_size_temp, FC_int, FC_frac_int; + // unsigned int i; float FC_int_float, FC_frac_float; //FC_int_float = freq_base / 7.5; diff --git a/NPR_14/source/TDMA.cpp b/NPR_14/source/TDMA.cpp index aa773ef..5c875a3 100644 --- a/NPR_14/source/TDMA.cpp +++ b/NPR_14/source/TDMA.cpp @@ -48,7 +48,7 @@ void TDMA_init_all(void) { unsigned char TDMA_byte_elaboration(unsigned char synchro) { unsigned char TDMA_byte; unsigned long int uplink_buffer_size; - unsigned long int uplink_buffer_size_temp; + // unsigned long int uplink_buffer_size_temp; if (is_TDMA_master) { // TDMA Master TDMA_byte = 0x40;//uplink/downlink bit TDMA_byte = TDMA_byte + (TDMA_frame_nb & 0x1F); @@ -198,7 +198,7 @@ void TDMA_master_allocation () { unsigned int loc_time_offset; long int local_TA; unsigned int downlink_buffer_size; - unsigned int downlink_buffer_size_temp; + // unsigned int downlink_buffer_size_temp; static unsigned char TDMA_alloc_frame_raw[150]; unsigned char rframe_length; unsigned char loc_client_needs[radio_addr_table_size]; @@ -426,7 +426,7 @@ void TDMA_slave_alloc_exploitation(unsigned char* unFECdata, int unFECsize) { int i; unsigned char loc_client_ID; unsigned char loc_TDMA_slot_length; - unsigned char loc_power; + // unsigned char loc_power; unsigned long int loc_TDMA_offset; i=2; //1st byte: client ID, 2nd byte:protocol loc_client_ID = unFECdata[2]; @@ -440,7 +440,7 @@ void TDMA_slave_alloc_exploitation(unsigned char* unFECdata, int unFECsize) { my_multiframe_ID = 0x0F & unFECdata[i+4]; my_multiframe_mask = (0xF0 & unFECdata[i+4]) >> 4; my_multiframe_mask = LUT_multif_mask[my_multiframe_mask]; - loc_power = ( 0xF0 & unFECdata[i+3] ) >> 4; + // loc_power = ( 0xF0 & unFECdata[i+3] ) >> 4; //printf("TDMAf:"); //for (j=0; j< 5; j++) { // printf(" %02X", unFECdata[i+j]); diff --git a/NPR_14/source/config_flash.cpp b/NPR_14/source/config_flash.cpp index 628b773..292b4b9 100644 --- a/NPR_14/source/config_flash.cpp +++ b/NPR_14/source/config_flash.cpp @@ -130,7 +130,7 @@ void NFPR_config_read(AnalogIn* analog_pin) { unsigned char NFPR_random_generator(AnalogIn* analog_pin) { unsigned short interm_random; unsigned char random_8; - int i, j; + int i; random_8 = 0; for (i=0; i<8; i++) { interm_random = analog_pin->read_u16(); diff --git a/NPR_14/source/signaling.cpp b/NPR_14/source/signaling.cpp index f9b1d5d..dcefda3 100644 --- a/NPR_14/source/signaling.cpp +++ b/NPR_14/source/signaling.cpp @@ -483,7 +483,7 @@ void signaling_TX_add_entry(unsigned char* raw_data, int size) { //void signaling_frame_push(unsigned char* TX_signal_frame_raw) { void signaling_frame_push(void) { - int rsize_needed; + // int rsize_needed; int size_w_FEC; int size_wo_FEC; unsigned char rframe_length; @@ -496,7 +496,7 @@ void signaling_frame_push(void) { if (size_wo_FEC < 69) { size_wo_FEC = 69; } - rsize_needed = 100 + (size_wo_FEC * 1.4); + // rsize_needed = 100 + (size_wo_FEC * 1.4); //printf("sig NO ext SRAM\r\n"); //if ((TXPS_FIFO->last_ready - TXPS_FIFO->RD_point) < (TXPS_FIFO_threshold_sig - rsize_needed) ) { //16380 @@ -546,7 +546,7 @@ void signaling_periodic_call() { // called every 2 to 6 seconds signaling_connect_req_TX(); connect_state_machine_counter = 0; } - if ( (my_client_radio_connexion_state==2) && (time_counter_last_ack > connexion_timeout) ) {//timeout, no ACK received for long time + if ( (my_client_radio_connexion_state==2) && (time_counter_last_ack > CONNECTION_TIMEOUT) ) {//timeout, no ACK received for long time // transition to state 1 "waiting for connection" my_client_radio_connexion_state = 1; radio_flush_TX_FIFO(); @@ -566,7 +566,7 @@ void signaling_periodic_call() { // called every 2 to 6 seconds timer_snapshot = GLOBAL_timer.read_us(); for (i=0; i< radio_addr_table_size; i++) { time_since_last_ack = timer_snapshot - CONF_radio_addr_table_date[i]; - if ( (CONF_radio_addr_table_status[i] == 1) && (time_since_last_ack > (2000000*connexion_timeout*CONF_signaling_period)) ) { + if ( (CONF_radio_addr_table_status[i] == 1) && (time_since_last_ack > (2000000UL*CONNECTION_TIMEOUT*CONF_signaling_period)) ) { CONF_radio_addr_table_status[i] = 0; // force disconnect } } diff --git a/NPR_14/source/signaling.h b/NPR_14/source/signaling.h index 64c163a..845f0b2 100644 --- a/NPR_14/source/signaling.h +++ b/NPR_14/source/signaling.h @@ -19,7 +19,7 @@ #define SIGNALING_F4 #include "mbed.h" -#define connexion_timeout 10 +#define CONNECTION_TIMEOUT 10 //multiple of signaling_period 10sec or 20sec or 30sec void signaling_frame_exploitation (unsigned char* unFECdata, int unFECsize, int TA_input);