kopia lustrzana https://github.com/SP8EBC/ParaTNC
changes to allow compilation and working in plain kiss mode
rodzic
fa6fee010b
commit
e31373d01a
13
src/main.c
13
src/main.c
|
@ -6,6 +6,7 @@
|
|||
#include <stm32f10x_rcc.h>
|
||||
#include <stm32f10x_iwdg.h>
|
||||
#include <stm32f10x.h>
|
||||
#include "drivers/gpio_conf.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "packet_tx_handler.h"
|
||||
|
@ -41,7 +42,6 @@
|
|||
#include "drivers/tx20.h"
|
||||
#include "drivers/analog_anemometer.h"
|
||||
#include "aprs/wx.h"
|
||||
#include "drivers/gpio_conf.h"
|
||||
|
||||
#include "../system/include/modbus_rtu/rtu_serial_io.h"
|
||||
|
||||
|
@ -533,8 +533,10 @@ int main(int argc, char* argv[]){
|
|||
AFSK_Init(&main_afsk);
|
||||
ax25_init(&main_ax25, &main_afsk, 0, message_callback);
|
||||
|
||||
#ifdef _METEO
|
||||
// getting all meteo measuremenets to be sure that WX frames want be sent with zeros
|
||||
wx_get_all_measurements();
|
||||
#endif
|
||||
|
||||
#if defined _VICTRON && !defined _UMB_MASTER
|
||||
// initializing protocol parser
|
||||
|
@ -601,7 +603,7 @@ int main(int argc, char* argv[]){
|
|||
|
||||
#ifndef _METEO
|
||||
//telemetry_send_values(rx10m, tx10m, digi10m, kiss10m, rte_wx_temperature_dallas_valid, rte_wx_dallas_qf, rte_wx_ms5611_qf, rte_wx_dht.qf);
|
||||
SendOwnBeacon();
|
||||
beacon_send_own();
|
||||
#else
|
||||
|
||||
//SendWXFrame(rte_wx_average_windspeed, rte_wx_max_windspeed, rte_wx_average_winddirection, rte_wx_temperature_dallas_valid, rte_wx_pressure_valid, rte_wx_humidity);
|
||||
|
@ -725,8 +727,9 @@ int main(int argc, char* argv[]){
|
|||
if (main_modbus_rtu_master_enabled == 1) {
|
||||
rtu_serial_start();
|
||||
}
|
||||
|
||||
#ifdef _METEO
|
||||
wx_get_all_measurements();
|
||||
#endif
|
||||
|
||||
#if defined(_UMB_MASTER)
|
||||
umb_0x26_status_request(&rte_wx_umb, &rte_wx_umb_context);
|
||||
|
@ -737,9 +740,9 @@ int main(int argc, char* argv[]){
|
|||
}
|
||||
|
||||
if (rte_main_trigger_modbus_status == 1) {
|
||||
|
||||
#ifdef _MODBUS_RTU
|
||||
rtu_serial_get_status_string(&rte_wx_rtu_pool_queue, main_own_aprs_msg, MAIN_OWN_APRS_MSG_LN, &main_own_aprs_msg_len);
|
||||
|
||||
#endif
|
||||
ax25_sendVia(&main_ax25, main_own_path, main_own_path_ln, main_own_aprs_msg, main_own_aprs_msg_len);
|
||||
|
||||
afsk_txStart(&main_afsk);
|
||||
|
|
|
@ -61,12 +61,10 @@ void digi_init(void) {
|
|||
}
|
||||
|
||||
uint8_t digi_process(struct AX25Msg *msg) {
|
||||
#ifdef _DIGI
|
||||
|
||||
|
||||
|
||||
uint8_t retval = DIGI_PACKET_DIDNT_DIGIPEATED;
|
||||
|
||||
#ifdef _DIGI
|
||||
|
||||
// check if the received message is not too long for the transmit buffers
|
||||
if (msg->len >= (CONFIG_AX25_FRAME_BUF_LEN - sizeof(AX25Call) * 7) ) {
|
||||
return DIGI_PACKET_TOO_LONG;
|
||||
|
|
|
@ -79,7 +79,6 @@ int32_t rtu_get_temperature(float* out) {
|
|||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_AVALIABLE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
|
@ -108,6 +107,7 @@ int32_t rtu_get_temperature(float* out) {
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -174,7 +174,6 @@ int32_t rtu_get_pressure(float* out) {
|
|||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_AVALIABLE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
|
@ -202,6 +201,7 @@ int32_t rtu_get_pressure(float* out) {
|
|||
scaling_d;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -268,7 +268,6 @@ int32_t rtu_get_wind_direction(uint16_t* out) {
|
|||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_AVALIABLE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
|
@ -296,6 +295,7 @@ int32_t rtu_get_wind_direction(uint16_t* out) {
|
|||
scaling_d;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -362,7 +362,6 @@ int32_t rtu_get_wind_speed(uint16_t* out) {
|
|||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_AVALIABLE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
|
@ -390,6 +389,7 @@ int32_t rtu_get_wind_speed(uint16_t* out) {
|
|||
scaling_d);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -455,7 +455,6 @@ int32_t rtu_get_wind_gusts(uint16_t* out) {
|
|||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_AVALIABLE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
|
@ -483,6 +482,7 @@ int32_t rtu_get_wind_gusts(uint16_t* out) {
|
|||
scaling_d);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -535,7 +535,6 @@ int32_t rtu_get_humidity(int8_t* out) {
|
|||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_AVALIABLE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
|
@ -563,6 +562,7 @@ int32_t rtu_get_humidity(int8_t* out) {
|
|||
scaling_d);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -451,6 +451,7 @@ int32_t rtu_serial_get_status_string(rtu_pool_queue_t* queue, char* out, uint16_
|
|||
int string_ln = 0;
|
||||
|
||||
memset(out, 0x00, out_buffer_ln);
|
||||
#ifdef _MODBUS_RTU
|
||||
|
||||
string_ln = snprintf(out, out_buffer_ln, "MT %d, LRET %d, LSRT %d, NSE %d, NOE1 %d, NOE2 %d, NOE3 %d, NOE4 %d",
|
||||
main_get_master_time(),
|
||||
|
@ -461,7 +462,7 @@ int32_t rtu_serial_get_status_string(rtu_pool_queue_t* queue, char* out, uint16_
|
|||
queue->number_of_errors[1],
|
||||
queue->number_of_errors[2],
|
||||
queue->number_of_errors[3]);
|
||||
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue