Skip to content

Commit f82044b

Browse files
authored
Merge pull request #22 from larus-breeze/sha256
Sha256
2 parents 8a1a610 + d4f718e commit f82044b

File tree

10 files changed

+156
-184
lines changed

10 files changed

+156
-184
lines changed

NAV_Algorithms/navigator.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ void navigator_t::update_GNSS_data( const coordinates_t &coordinates)
8282
}
8383

8484
// to be called at 10 Hz
85-
void navigator_t::update_at_10Hz ()
85+
bool navigator_t::update_at_10Hz ()
8686
{
87+
bool landing_detected=false;
8788
atmosphere.feed_QFF_density_metering(
8889
air_pressure_resampler_100Hz_10Hz.get_output(),
8990
flight_observer.get_filtered_GNSS_altitude());
@@ -98,7 +99,11 @@ void navigator_t::update_at_10Hz ()
9899

99100
airborne_detector.report_to_be_airborne( abs( flight_observer.get_speed_compensation_GNSS()) > AIRBORNE_TRIGGER_SPEED);
100101
if( airborne_detector.detect_just_landed())
101-
ahrs.write_calibration_into_EEPROM();
102+
{
103+
ahrs.write_calibration_into_EEPROM();
104+
landing_detected = true;
105+
}
106+
return landing_detected;
102107
}
103108

104109
//! copy all navigator data into output_data structure

NAV_Algorithms/navigator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ class navigator_t
159159
*
160160
* to be called @ 10 Hz
161161
* calculate wind data and vario average for "vario integrator"
162+
* @return true if a landing has just been detected
162163
*/
163-
void update_at_10Hz();
164+
bool update_at_10Hz();
164165

165166
/**
166167
* @brief update on new navigation data from GNSS

NAV_Algorithms/organizer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,17 @@ class organizer_t
9191
navigator.update_pitot ( (output_data.m.pitot_pressure - pitot_offset) * pitot_span);
9292
}
9393

94-
void update_every_100ms( output_data_t & output_data)
94+
bool update_every_100ms( output_data_t & output_data)
9595
{
96-
navigator.update_at_10Hz ();
96+
bool landing_detected = navigator.update_at_10Hz ();
9797
navigator.feed_QFF_density_metering( output_data.m.static_pressure - QNH_offset, -output_data.c.position[DOWN]);
9898

9999
if( ++magnetic_induction_update_counter > 36000) // every hour
100100
{
101101
update_magnetic_induction_data( output_data.c.latitude, output_data.c.longitude);
102102
magnetic_induction_update_counter=0;
103103
}
104+
return landing_detected;
104105
}
105106

106107
void set_attitude ( float roll, float nick, float present_heading)

NAV_Algorithms/persistent_data.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ ROM persistent_data_t PERSISTENT_DATA[]=
5353
{WIND_TC, "Wind_TC", false, 5.0f, 0}, //! Wind fast time constant unsigned s / ( 100.0f / 65536 )
5454
{MEAN_WIND_TC, "Mean_Wind_TC", false, 30.0f, 0}, //! Wind slow time constant unsigned s / ( 100.0f / 65536 )
5555
{VETF, "VrtclEnrgTuning", false, 1.0f, 0}, //! Vertical Energy tuning factor s / ( 1.0f / 65536 )
56+
{HORIZON, "Horizon_active", false, 1.0f, 0}, //! Horizon output is available
5657

5758
{GNSS_CONFIGURATION, "GNSS_CONFIG", false, 1.0f, 0}, //! type of GNSS system
5859
{ANT_BASELENGTH, "ANT_BASELEN", false, 1.0f, 0}, //! Slave DGNSS antenna baselength / mm
@@ -98,6 +99,7 @@ bool EEPROM_convert( EEPROM_PARAMETER_ID id, EEPROM_data_t & EEPROM_value, float
9899
case BOARD_ID:
99100
case GNSS_CONFIGURATION:
100101
case MAG_AUTO_CALIB:
102+
case HORIZON:
101103
if( read)
102104
value = (float)(EEPROM_value.u16);
103105
else

NAV_Algorithms/persistent_data.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ enum EEPROM_PARAMETER_ID
6969
WIND_TC,
7070
MEAN_WIND_TC,
7171
VETF, // VERTICAL_ENERGY_TUNING_FACTOR
72+
HORIZON,
7273

7374
GNSS_CONFIGURATION=40,
7475
ANT_BASELENGTH,

Output_Formatter/CAN_output.cpp

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,29 @@ enum CAN_ID_SENSOR
5050
c_CID_KSB_Vdd = 0x112, //!< unit16_t as voltage * 10
5151
};
5252

53-
void CAN_output ( const output_data_t &x)
53+
void CAN_output ( const output_data_t &x, bool horizon_activated)
5454
{
5555
CANpacket p;
5656

57-
#if HORIZON_DATA_SECRET == 1
58-
p.id=c_CAN_Id_EulerAngles; // 0x101
59-
p.dlc=6;
60-
p.data_sh[0] = ZERO;
61-
p.data_sh[1] = ZERO;
62-
p.data_sh[2] = (int16_t)(round(x.euler.y * 1000.0f));
63-
CAN_send(p, 1);
64-
#else
65-
p.id=c_CAN_Id_EulerAngles; // 0x101
66-
p.dlc=6;
67-
p.data_sh[0] = (int16_t)(round(x.euler.r * 1000.0f)); // unit = 1/1000 RAD
68-
p.data_sh[1] = (int16_t)(round(x.euler.n * 1000.0f));
69-
p.data_sh[2] = (int16_t)(round(x.euler.y * 1000.0f));
70-
CAN_send(p, 1);
71-
#endif
57+
if( horizon_activated)
58+
{
59+
p.id=c_CAN_Id_EulerAngles; // 0x101
60+
p.dlc=6;
61+
p.data_sh[0] = (int16_t)(round(x.euler.r * 1000.0f)); // unit = 1/1000 RAD
62+
p.data_sh[1] = (int16_t)(round(x.euler.n * 1000.0f));
63+
p.data_sh[2] = (int16_t)(round(x.euler.y * 1000.0f));
64+
CAN_send(p, 1);
65+
}
66+
else
67+
{
68+
p.id=c_CAN_Id_EulerAngles; // 0x101
69+
p.dlc=6;
70+
p.data_sh[0] = ZERO;
71+
p.data_sh[1] = ZERO;
72+
p.data_sh[2] = (int16_t)(round(x.euler.y * 1000.0f));
73+
CAN_send(p, 1);
74+
}
75+
7276
p.id=c_CAN_Id_Airspeed; // 0x102
7377
p.dlc=4;
7478
p.data_sh[0] = (int16_t)(round(x.TAS * 3.6f)); // m/s -> km/h

Output_Formatter/CAN_output.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727

2828
#include "data_structures.h"
2929

30-
void CAN_output ( const output_data_t &);
30+
void CAN_output ( const output_data_t &x, bool horizon_activated);
3131

3232
#endif /* SRC_CAN_OUTPUT_H_ */

0 commit comments

Comments
 (0)