Added values into example config file and set fallbacks in config.py

pull/22/head
David Rollinson 2020-12-25 09:47:01 +08:00
rodzic f8549f346c
commit 87c65d8124
3 zmienionych plików z 46 dodań i 9 usunięć

Wyświetl plik

@ -52,6 +52,17 @@ default_config = {
'bearing_weight': 1.0,
'bearing_color': 'black',
'bearing_custom_color': '#FF0000',
# Unit selection
'unitselection': 'metric',
'm_to_ft': 3.28084,
'km_to_miles' : 0.6213171,
'secs_to_mins' : 0.016666,
'ms_to_knots' : 1.94384,
'switch_miles_feet' : 400,
}
@ -141,12 +152,12 @@ def parse_config_file(filename):
# Unit Selection
chase_config['unitselection'] = config.get('units', 'unitselection')
chase_config['m_to_ft'] = config.get('units', 'm_to_ft')
chase_config['km_to_miles'] = config.get('units', 'km_to_miles')
chase_config['secs_to_mins'] = config.get('units', 'secs_to_mins')
chase_config['ms_to_knots'] = config.get('units', 'ms_to_knots')
chase_config['switch_miles_feet'] = config.get('units', 'switch_miles_feet')
chase_config['unitselection'] = config.get('units', 'unitselection', fallback='metric')
chase_config['m_to_ft'] = config.get('units', 'm_to_ft', fallback = '3.28084')
chase_config['km_to_miles'] = config.get('units', 'km_to_miles', fallback = '0.621371')
chase_config['secs_to_mins'] = config.get('units', 'secs_to_mins', fallback = '0.016666')
chase_config['ms_to_knots'] = config.get('units', 'ms_to_knots', fallback = '1.94384')
chase_config['switch_miles_feet'] = config.get('units', 'switch_miles_feet', fallback = '400')
logging.info("Units: " + chase_config['unitselection'])
logging.info("m_to_f: " + chase_config['m_to_ft'])

Wyświetl plik

@ -200,3 +200,30 @@ bearing_color = black
# Custom bearing color, in hexadecimal #RRGGBB
bearing_custom_color = #FF0000
[units]
# unitselection allows choice of metric - the default or imperial1 - horizontal miles and feet for short distances, horizontal miles per hour, vertical feet, vertical feet per minute
unitselection = metric
# unitselection = imperial1
# Imperial conversion factors
m_to_ft = 3.28084
km_to_miles = 0.621371
secs_to_mins = 0.016666
ms_to_knots = 1.94384
# Sensible choice of unit selection (all thresholds set in metric)
# This is the threshold for switching from miles to feet, set in meters.
switch_miles_feet = 400

Wyświetl plik

@ -266,7 +266,7 @@ function initTablesImperial1(){
function updateTelemetryTable(){
var telem_data = [];
if (chase_config['unitselection'] == "imperial1") {initTablesImperial1() ; return ; } // else do everything in metric
if (chase_config['unitselection'] == "imperial1") {updateTelemetryTableImperial1() ; return ; } // else do everything in metric
if (jQuery.isEmptyObject(balloon_positions)){
telem_data = [{callsign:'None'}];
}else{
@ -277,7 +277,7 @@ function updateTelemetryTable(){
// Modify some of the fields to fixed point values.
balloon_call_data.lat = balloon_call_data.position[0].toFixed(5);
balloon_call_data.lon = balloon_call_data.position[1].toFixed(5);
balloon_call_data.alt = balloon_call_data.position[2].toFixed(1) + " (" + balloon_call_data.max_alt.toFixed(0) + ")" ;
balloon_call_data.alt = balloon_call_data.position[2].toFixed(0) + " (" + balloon_call_data.max_alt.toFixed(0) + ")" ;
balloon_call_data.vel_v = balloon_call_data.vel_v.toFixed(1);
// Add in any extra data to the aux field.
@ -308,7 +308,6 @@ function updateTelemetryTable(){
function updateTelemetryTableImperial1(){
var telem_data = [];
if (chase_config['unitselection'] == "imperial1") {initTablesImperial1() ; return ; } // else do everything in metric
if (jQuery.isEmptyObject(balloon_positions)){
telem_data = [{callsign:'None'}];
}else{