kopia lustrzana https://github.com/SP8EBC/ParaTNC
conditional compilation of nvm logger using platform depends defines, loading battery scaling from configuration
rodzic
a943af0210
commit
3c44e7e0d1
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="ilg.gnumcueclipse.debug.gdbjtag.openocd.launchConfigurationType">
|
||||
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.PERIPHERALS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <peripherals> <peripheral name="IWDG"/> <peripheral name="RCC"/> <peripheral name="DBGMCU"/> </peripherals> "/>
|
||||
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.PERIPHERALS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <peripherals> <peripheral name="GPIOA"/> </peripherals> "/>
|
||||
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doContinue" value="true"/>
|
||||
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doDebugInRam" value="false"/>
|
||||
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doFirstReset" value="true"/>
|
||||
|
@ -57,6 +57,6 @@
|
|||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="Context string"> <memoryBlockExpression address="134742016" label="0x8080000"/> <memoryBlockExpression address="134762496" label="0x8085000"/> <memoryBlockExpression address="134764544" label="0x8085800"/> </memoryBlockExpressionList> "/>
|
||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="Context string"> <memoryBlockExpression address="134342656" label="0x0801E800"/> </memoryBlockExpressionList> "/>
|
||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||
</launchConfiguration>
|
||||
|
|
Plik binarny nie jest wyświetlany.
|
@ -164,6 +164,10 @@ typedef struct __attribute__((aligned (4))) config_data_basic_t {
|
|||
*/
|
||||
uint8_t engineering2;
|
||||
|
||||
uint16_t battery_scalling_a;
|
||||
|
||||
uint16_t battery_scalling_b;
|
||||
|
||||
} config_data_basic_t;
|
||||
|
||||
typedef enum config_data_wx_sources_enum_t {
|
||||
|
|
|
@ -43,4 +43,8 @@ int configuration_get_early_tx_assert(void);
|
|||
int configuration_get_power_cycle_vbat_r(void);
|
||||
int configuration_get_reboot_after_24_hours(void);
|
||||
|
||||
uint16_t configuration_get_vbat_a_coeff(void);
|
||||
uint16_t configuration_get_vbat_b_coeff(void);
|
||||
|
||||
|
||||
#endif /* CONFIGURATION_HANDLER_H_ */
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* io_default_vbat_scaling.h
|
||||
*
|
||||
* Created on: Apr 9, 2023
|
||||
* Author: mateusz
|
||||
*/
|
||||
|
||||
#ifndef IO_DEFAULT_VBAT_SCALING_H_
|
||||
#define IO_DEFAULT_VBAT_SCALING_H_
|
||||
|
||||
#define VBAT_MEAS_A_COEFF 1000
|
||||
#define VBAT_MEAS_B_COEFF 95
|
||||
|
||||
|
||||
|
||||
#endif /* IO_DEFAULT_VBAT_SCALING_H_ */
|
|
@ -42,8 +42,7 @@ void io_vbat_meas_enable(void);
|
|||
void io_pool_vbat_r(int16_t minutes_to_wx);
|
||||
#endif
|
||||
|
||||
#define VBAT_MEAS_A_COEFF 1200
|
||||
#define VBAT_MEAS_B_COEFF 40
|
||||
|
||||
|
||||
/**
|
||||
* Keep this uncommented to configure ADC which monitor Vbatt to
|
||||
|
|
|
@ -25,33 +25,7 @@
|
|||
|
||||
#define NONSTANDARD (uint8_t)0x0F
|
||||
|
||||
#define KISS_DATA (uint8_t) 0x00
|
||||
|
||||
#define KISS_GET_RUNNING_CONFIG (uint8_t) 0x20
|
||||
#define KISS_RUNNING_CONFIG (uint8_t) 0x70
|
||||
|
||||
#define KISS_GET_VERSION_AND_ID (uint8_t) 0x21
|
||||
#define KISS_VERSION_AND_ID (uint8_t) 0x71
|
||||
|
||||
#define KISS_ERASE_STARTUP_CFG (uint8_t) 0x22
|
||||
#define KISS_ERASE_STARTUP_CFG_RESP (uint8_t) 0x72
|
||||
|
||||
#define KISS_PROGRAM_STARTUP_CFG (uint8_t) 0x23
|
||||
#define KISS_PROGRAM_STARTUP_CFG_RESP (uint8_t) 0x73
|
||||
|
||||
#define KISS_CONFIG_CRC (uint8_t) 0x24
|
||||
#define KISS_CONFIG_CRC_RESP (uint8_t) 0x74
|
||||
|
||||
#define KISS_RESTART (uint8_t) 0x25
|
||||
#define KISS_RESTART_RESP (uint8_t) 0x75
|
||||
|
||||
#define KISS_TOGGLE_PTT (uint8_t) 0x26
|
||||
//#define KISS_RESTART_RESP (uint8_t) 0x76
|
||||
|
||||
#define KISS_CONTROL_VOLTAGE (uint8_t) 0x27
|
||||
#define KISS_CONTROL_VOLTAGE_RESP (uint8_t) 0x77
|
||||
|
||||
#define KISS_RETURN_IDLE 1
|
||||
|
||||
extern uint8_t kiss_current_async_message;
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* kiss_communication_service_ids.h
|
||||
*
|
||||
* Created on: Apr 9, 2023
|
||||
* Author: mateusz
|
||||
*/
|
||||
|
||||
#ifndef KISS_COMMUNICATION_SERVICE_IDS_H_
|
||||
#define KISS_COMMUNICATION_SERVICE_IDS_H_
|
||||
|
||||
|
||||
#define KISS_DATA (uint8_t) 0x00
|
||||
|
||||
#define KISS_RESTART (uint8_t) 0x11
|
||||
#define KISS_RESTART_RESP (uint8_t) 0x51
|
||||
|
||||
#define KISS_GET_VERSION_AND_ID (uint8_t) 0x21
|
||||
#define KISS_VERSION_AND_ID (uint8_t) 0x61
|
||||
|
||||
#define KISS_READ_DID (uint8_t) 0x22
|
||||
#define KISS_READ_DID_RESP (uint8_t) 0x62
|
||||
|
||||
#define KISS_READ_MEM_ADDR (uint8_t) 0x23
|
||||
#define KISS_READ_MEM_ADDR_RESP (uint8_t) 0x63
|
||||
|
||||
#define KISS_PROGRAM_STARTUP_CFG (uint8_t) 0x34
|
||||
#define KISS_PROGRAM_STARTUP_CFG_RESP (uint8_t) 0x74
|
||||
|
||||
#define KISS_GET_RUNNING_CONFIG (uint8_t) 0x35
|
||||
#define KISS_RUNNING_CONFIG (uint8_t) 0x75
|
||||
|
||||
#define KISS_ERASE_STARTUP_CFG (uint8_t) 0x37
|
||||
#define KISS_ERASE_STARTUP_CFG_RESP (uint8_t) 0x77
|
||||
|
||||
//#define KISS_CONFIG_CRC (uint8_t) 0x24
|
||||
//#define KISS_CONFIG_CRC_RESP (uint8_t) 0x74
|
||||
|
||||
//#define KISS_TOGGLE_PTT (uint8_t) 0x26
|
||||
//#define KISS_RESTART_RESP (uint8_t) 0x76
|
||||
|
||||
//#define KISS_CONTROL_VOLTAGE (uint8_t) 0x27
|
||||
//#define KISS_CONTROL_VOLTAGE_RESP (uint8_t) 0x77
|
||||
|
||||
#define KISS_RETURN_IDLE 1
|
||||
|
||||
|
||||
#endif /* KISS_COMMUNICATION_SERVICE_IDS_H_ */
|
|
@ -8,7 +8,7 @@
|
|||
#include "config_data.h"
|
||||
|
||||
#define SW_VER "EA20"
|
||||
#define SW_DATE "18022023"
|
||||
#define SW_DATE "09042023"
|
||||
#define SW_KISS_PROTO "A"
|
||||
|
||||
#define SYSTICK_TICKS_PER_SECONDS 100
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
// reprogram it from the default set stored somewhere within .code section
|
||||
|
||||
#include "config_data.h"
|
||||
#include "io_default_vbat_scaling.h"
|
||||
|
||||
#include "station_config.h"
|
||||
|
||||
|
@ -212,10 +213,13 @@ const config_data_basic_t __attribute__((section(".config_section_default.basic"
|
|||
#endif
|
||||
|
||||
#ifdef ENG2
|
||||
.engineering2 = ENG2
|
||||
.engineering2 = ENG2,
|
||||
#else
|
||||
.engineering2 = 0
|
||||
.engineering2 = 0,
|
||||
#endif
|
||||
|
||||
.battery_scalling_a = VBAT_MEAS_A_COEFF,
|
||||
.battery_scalling_b = VBAT_MEAS_B_COEFF
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
*/
|
||||
|
||||
#include "config_data.h"
|
||||
#include "io_default_vbat_scaling.h"
|
||||
|
||||
#include "station_config.h"
|
||||
|
||||
|
@ -205,10 +206,13 @@ const config_data_basic_t __attribute__((section(".config_section_first.basic"))
|
|||
#endif
|
||||
|
||||
#ifdef ENG1
|
||||
.engineering1 = ENG1
|
||||
.engineering1 = ENG1,
|
||||
#else
|
||||
.engineering1 = 0xFF
|
||||
.engineering1 = 0xFF,
|
||||
#endif
|
||||
|
||||
.battery_scalling_a = VBAT_MEAS_A_COEFF,
|
||||
.battery_scalling_b = VBAT_MEAS_B_COEFF
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "config_data.h"
|
||||
#include "io_default_vbat_scaling.h"
|
||||
|
||||
#include "station_config.h"
|
||||
|
||||
|
@ -199,10 +200,13 @@ const config_data_basic_t __attribute__((section(".config_section_second.basic")
|
|||
#endif
|
||||
|
||||
#ifdef ENG1
|
||||
.engineering1 = ENG1
|
||||
.engineering1 = ENG1,
|
||||
#else
|
||||
.engineering1 = 0xFF
|
||||
.engineering1 = 0xFF,
|
||||
#endif
|
||||
|
||||
.battery_scalling_a = VBAT_MEAS_A_COEFF,
|
||||
.battery_scalling_b = VBAT_MEAS_B_COEFF
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "config_data.h"
|
||||
#include "config_data_externs.h"
|
||||
|
||||
#include "io_default_vbat_scaling.h"
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#ifdef STM32F10X_MD_VL
|
||||
|
@ -41,13 +43,13 @@
|
|||
#define CONFIG_SECTION_DEFAULT_START 0x0801E000
|
||||
|
||||
#define CONFIG_MODE_PGM_CNTR 0x0
|
||||
#define CONFIG_MODE_OFSET 0x20 // Current size: 0x10, free: 0x10
|
||||
#define CONFIG_BASIC_OFFSET 0x40 // Current size: 0x9D, free: 0x43
|
||||
#define CONFIG_SOURCES_OFFSET 0x120 // Current size: 0x4, free: 0x1C
|
||||
#define CONFIG_UMB_OFFSET 0x140 // Current size: 0x12, free: 0xE
|
||||
#define CONFIG_RTU_OFFSET 0x160 // Current size: 0x54, free: 0x4C
|
||||
#define CONFIG_GSM_OFFSET 0x200 // Current size: 0xF8,
|
||||
#define CONFIG__END__OFFSET 0x300
|
||||
#define CONFIG_MODE_OFSET 0x20 // Current size: 0x14, free: 0x0C
|
||||
#define CONFIG_BASIC_OFFSET 0x40 // Current size: 0xA4, free: 0x3C
|
||||
#define CONFIG_SOURCES_OFFSET 0x120 // Current size: 0x8, free: 0x18
|
||||
#define CONFIG_UMB_OFFSET 0x140 // Current size: 0x10, free: 0x10
|
||||
#define CONFIG_RTU_OFFSET 0x160 // Current size: 0x10, free: 0x90
|
||||
#define CONFIG_GSM_OFFSET 0x200 // Current size: 0x114,
|
||||
#define CONFIG__END__OFFSET 0x7E0
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -863,3 +865,36 @@ int configuration_get_reboot_after_24_hours(void) {
|
|||
|
||||
return out;
|
||||
}
|
||||
|
||||
uint16_t configuration_get_vbat_a_coeff(void) {
|
||||
|
||||
uint16_t out = 0;
|
||||
|
||||
// get coefficient stored into flash memory
|
||||
out = main_config_data_basic->battery_scalling_a;
|
||||
|
||||
// check if it is set to non default value
|
||||
if (out == 0x00 || out == 0xFF) {
|
||||
// revert back to hardcoded value
|
||||
out = VBAT_MEAS_A_COEFF;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
uint16_t configuration_get_vbat_b_coeff(void) {
|
||||
|
||||
uint16_t out = 0;
|
||||
|
||||
// get coefficient stored into flash memory
|
||||
out = main_config_data_basic->battery_scalling_b;
|
||||
|
||||
// check if it is set to non default value
|
||||
if (out == 0x00 || out == 0xFF) {
|
||||
// revert back to hardcoded value
|
||||
out = VBAT_MEAS_B_COEFF;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "kiss_communication.h"
|
||||
#include "kiss_communication_service_ids.h"
|
||||
#include "configuration_handler.h"
|
||||
#include "main.h"
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <kiss_communication.h>
|
||||
#include "kiss_callback.h"
|
||||
|
||||
#include "kiss_communication_service_ids.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "config_data_externs.h"
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "float_to_string.h"
|
||||
#include "pwr_save.h"
|
||||
#include <wx_pwr_switch.h>
|
||||
#include "io_default_vbat_scaling.h"
|
||||
|
||||
#include "it_handlers.h"
|
||||
|
||||
|
@ -557,7 +558,7 @@ int main(int argc, char* argv[]){
|
|||
pwr_save_init(main_config_data_mode->powersave);
|
||||
|
||||
// initialize B+ measurement
|
||||
io_vbat_meas_init(VBAT_MEAS_A_COEFF, VBAT_MEAS_B_COEFF);
|
||||
io_vbat_meas_init(configuration_get_vbat_a_coeff(), configuration_get_vbat_b_coeff());
|
||||
#endif
|
||||
|
||||
// initalizing separated Open Collector output
|
||||
|
@ -1494,9 +1495,11 @@ int main(int argc, char* argv[]){
|
|||
wx_pwr_switch_periodic_handle();
|
||||
}
|
||||
|
||||
#ifdef PARAMETEO
|
||||
if (configuration_get_power_cycle_vbat_r() == 1 && !main_afsk.sending) {
|
||||
io_pool_vbat_r(packet_tx_get_minutes_to_next_wx());
|
||||
}
|
||||
#endif
|
||||
|
||||
wx_check_force_i2c_reset();
|
||||
|
||||
|
|
|
@ -236,6 +236,7 @@ void packet_tx_handler(const config_data_basic_t * const config_basic, const con
|
|||
// check if there is a time to send meteo packet through RF
|
||||
if (packet_tx_meteo_counter >= packet_tx_meteo_interval && packet_tx_meteo_interval != 0) {
|
||||
|
||||
#ifdef STM32L471xx
|
||||
if (config_mode->nvm_logger != 0) {
|
||||
packet_tx_nvm.temperature_humidity = wx_get_nvm_record_temperature();
|
||||
packet_tx_nvm.wind = wx_get_nvm_record_wind();
|
||||
|
@ -244,6 +245,7 @@ void packet_tx_handler(const config_data_basic_t * const config_basic, const con
|
|||
// write to NVM if it is enabled
|
||||
nvm_measurement_store(&packet_tx_nvm);
|
||||
}
|
||||
#endif
|
||||
|
||||
// this function is required if more than one RF frame will be send from this function at once
|
||||
// it waits for transmission completion and add some delay to let digipeaters do theris job
|
||||
|
|
|
@ -56,9 +56,8 @@ int32_t wx_get_humidity_measurement(const config_data_wx_sources_t * const confi
|
|||
// set the flag that external temperature is available
|
||||
out |= WX_HANDLER_PARAMETER_RESULT_HUMIDITY;
|
||||
|
||||
if (measurement_result == BME280_OK) {
|
||||
rte_wx_humidity_valid = rte_wx_humidity;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -107,20 +107,20 @@ int32_t wx_get_pressure_measurement(const config_data_wx_sources_t * const confi
|
|||
case WX_SOURCE_RTU:
|
||||
case WX_SOURCE_FULL_RTU: {
|
||||
|
||||
// get the value read from RTU registers
|
||||
measurement_retval = rtu_get_humidity(&rte_wx_humidity, config_rtu);
|
||||
|
||||
// check
|
||||
if (measurement_retval == MODBUS_RET_OK || measurement_retval == MODBUS_RET_DEGRADED) {
|
||||
|
||||
// set the flag that external temperature is available
|
||||
output |= WX_HANDLER_PARAMETER_RESULT_HUMIDITY;
|
||||
|
||||
if (measurement_retval == BME280_OK) {
|
||||
rte_wx_humidity_valid = rte_wx_humidity;
|
||||
}
|
||||
}
|
||||
|
||||
// // get the value read from RTU registers
|
||||
// measurement_retval = rtu_get_humidity(&rte_wx_humidity, config_rtu);
|
||||
//
|
||||
// // check
|
||||
// if (measurement_retval == MODBUS_RET_OK || measurement_retval == MODBUS_RET_DEGRADED) {
|
||||
//
|
||||
// // set the flag that external temperature is available
|
||||
// output |= WX_HANDLER_PARAMETER_RESULT_HUMIDITY;
|
||||
//
|
||||
// if (measurement_retval == BME280_OK) {
|
||||
// rte_wx_humidity_valid = rte_wx_humidity;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
break;
|
||||
}
|
||||
case WX_SOURCE_DAVIS_SERIAL:
|
||||
|
|
Ładowanie…
Reference in New Issue