Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
hott_gam.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Sergey Krukowski <softsr@yahoo.de>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
27 #ifndef HOTT_GAM_H
28 #define HOTT_GAM_H
29 
30 #include "autopilot.h"
31 
32 //Graupner #33611 General Air Module
33 #define HOTT_TELEMETRY_GAM_SENSOR_ID 0x8D
34 
35 struct HOTT_GAM_MSG {
36  int8_t start_byte; //#01 start int8_t constant value 0x7c
37  int8_t gam_sensor_id; //#02 EAM sensort id. constat value 0x8d
38  int8_t warning_beeps; //#03 1=A 2=B ... 0x1a=Z 0 = no alarm
39  // Q Min cell voltage sensor 1
40  // R Min Battery 1 voltage sensor 1
41  // J Max Battery 1 voltage sensor 1
42  // F Min temperature sensor 1
43  // H Max temperature sensor 1
44  // S Min Battery 2 voltage sensor 2
45  // K Max Battery 2 voltage sensor 2
46  // G Min temperature sensor 2
47  // I Max temperature sensor 2
48  // W Max current
49  // V Max capacity mAh
50  // P Min main power voltage
51  // X Max main power voltage
52  // O Min altitude
53  // Z Max altitude
54  // C negative difference m/s too high
55  // A negative difference m/3s too high
56  // N positive difference m/s too high
57  // L positive difference m/3s too high
58  // T Minimum RPM
59  // Y Maximum RPM
60 
61  int8_t sensor_id; //#04 constant value 0xd0
62  int8_t alarm_invers1; //#05 alarm bitmask. Value is displayed inverted
63  //Bit# Alarm field
64  // 0 all cell voltage
65  // 1 Battery 1
66  // 2 Battery 2
67  // 3 Temperature 1
68  // 4 Temperature 2
69  // 5 Fuel
70  // 6 mAh
71  // 7 Altitude
72  int8_t alarm_invers2; //#06 alarm bitmask. Value is displayed inverted
73  //Bit# Alarm Field
74  // 0 main power current
75  // 1 main power voltage
76  // 2 Altitude
77  // 3 m/s
78  // 4 m/3s
79  // 5 unknown
80  // 6 unknown
81  // 7 "ON" sign/text msg active
82 
83  int8_t cell1; //#07 cell 1 voltage lower value. 0.02V steps, 124=2.48V
84  int8_t cell2; //#08
85  int8_t cell3; //#09
86  int8_t cell4; //#10
87  int8_t cell5; //#11
88  int8_t cell6; //#12
89  int8_t batt1_L; //#13 battery 1 voltage LSB value. 0.1V steps. 50 = 5.5V
90  int8_t batt1_H; //#14
91  int8_t batt2_L; //#15 battery 2 voltage LSB value. 0.1V steps. 50 = 5.5V
92  int8_t batt2_H; //#16
93  int8_t temperature1; //#17 temperature 1. offset of 20. a value of 20 = 0°C
94  int8_t temperature2; //#18 temperature 2. offset of 20. a value of 20 = 0°C
95  int8_t fuel_procent; //#19 Fuel capacity in %. Values 0--100
96  // graphical display ranges: 0-25% 50% 75% 100%
97  int8_t fuel_ml_L; //#20 Fuel in ml scale. Full = 65535!
99  int8_t rpm_L; //#22 RPM in 10 RPM steps. 300 = 3000rpm
100  int8_t rpm_H; //#23
101  int8_t altitude_L; //#24 altitude in meters. offset of 500, 500 = 0m
103  int8_t climbrate_L; //#26 climb rate in 0.01m/s. Value of 30000 = 0.00 m/s
105  int8_t climbrate3s; //#28 climb rate in m/3sec. Value of 120 = 0m/3sec
106  int8_t current_L; //#29 current in 0.1A steps
108  int8_t main_voltage_L; //#31 Main power voltage using 0.1V steps
110  int8_t batt_cap_L; //#33 used battery capacity in 10mAh steps
112  int8_t speed_L; //#35 (air?) speed in km/h(?) we are using ground speed here per default
114  int8_t min_cell_volt; //#37 minimum cell voltage in 2mV steps. 124 = 2,48V
115  int8_t min_cell_volt_num; //#38 number of the cell with the lowest voltage
116  int8_t rpm2_L; //#39 RPM in 10 RPM steps. 300 = 3000rpm
117  int8_t rpm2_H; //#40
118  int8_t general_error_number; //#41 Voice error == 12. TODO: more docu
119  int8_t pressure; //#42 Pressure up to 16bar. 0,1bar scale. 20 = 2bar
120  int8_t version; //#43 version number TODO: more info?
121  int8_t stop_byte; //#44 stop int8_t
122  //#45 CRC/Parity
123 };
124 
125 static void hott_init_gam_msg(struct HOTT_GAM_MSG *hott_gam_msg)
126 {
127  memset(hott_gam_msg, 0, sizeof(struct HOTT_GAM_MSG));
128  hott_gam_msg->start_byte = 0x7C;
130  hott_gam_msg->sensor_id = 0xD0;
131  hott_gam_msg->stop_byte = 0x7D;
132 }
133 
134 static void hott_update_gam_msg(struct HOTT_GAM_MSG *hott_gam_msg)
135 {
136  hott_gam_msg->temperature1 = 1;
137  hott_gam_msg->temperature2 = 2; // 0°C
138  hott_gam_msg->altitude_L = 3;
139  hott_gam_msg->climbrate_L = 4;
140  hott_gam_msg->climbrate3s = 5; // 0 m/3s using filtered data here
141  hott_gam_msg->current_L = 6;
142  hott_gam_msg->main_voltage_L = 7;
143  hott_gam_msg->batt_cap_L = 8;
144  hott_gam_msg->fuel_procent = 9; // my fuel are electrons :)
145  hott_gam_msg->speed_L = 10;
146 
147  //display ON when motors are armed
148  if (autopilot_get_motors_on()) {
149  hott_gam_msg->alarm_invers2 |= 0x80;
150  } else {
151  hott_gam_msg->alarm_invers2 &= 0x7f;
152  }
153 }
154 
155 #endif /* HOTT_GAM_H */
bool autopilot_get_motors_on(void)
get motors status
Definition: autopilot.c:295
Core autopilot interface common to all firmwares.
int8_t fuel_ml_L
Definition: hott_gam.h:97
int8_t main_voltage_H
Definition: hott_gam.h:109
int8_t climbrate3s
Definition: hott_gam.h:105
int8_t pressure
Definition: hott_gam.h:119
int8_t warning_beeps
Definition: hott_gam.h:38
#define HOTT_TELEMETRY_GAM_SENSOR_ID
Definition: hott_gam.h:33
int8_t cell5
Definition: hott_gam.h:87
int8_t batt1_H
Definition: hott_gam.h:90
int8_t current_H
Definition: hott_gam.h:107
int8_t batt2_L
Definition: hott_gam.h:91
int8_t temperature1
Definition: hott_gam.h:93
int8_t batt2_H
Definition: hott_gam.h:92
int8_t temperature2
Definition: hott_gam.h:94
int8_t cell4
Definition: hott_gam.h:86
int8_t rpm_H
Definition: hott_gam.h:100
int8_t current_L
Definition: hott_gam.h:106
static void hott_init_gam_msg(struct HOTT_GAM_MSG *hott_gam_msg)
Definition: hott_gam.h:125
int8_t altitude_L
Definition: hott_gam.h:101
int8_t speed_H
Definition: hott_gam.h:113
int8_t climbrate_L
Definition: hott_gam.h:103
int8_t stop_byte
Definition: hott_gam.h:121
int8_t rpm2_L
Definition: hott_gam.h:116
int8_t fuel_ml_H
Definition: hott_gam.h:98
int8_t fuel_procent
Definition: hott_gam.h:95
int8_t min_cell_volt
Definition: hott_gam.h:114
int8_t rpm2_H
Definition: hott_gam.h:117
int8_t min_cell_volt_num
Definition: hott_gam.h:115
int8_t version
Definition: hott_gam.h:120
int8_t batt_cap_H
Definition: hott_gam.h:111
int8_t gam_sensor_id
Definition: hott_gam.h:37
static void hott_update_gam_msg(struct HOTT_GAM_MSG *hott_gam_msg)
Definition: hott_gam.h:134
int8_t start_byte
Definition: hott_gam.h:36
int8_t climbrate_H
Definition: hott_gam.h:104
int8_t sensor_id
Definition: hott_gam.h:61
int8_t alarm_invers2
Definition: hott_gam.h:72
int8_t batt1_L
Definition: hott_gam.h:89
int8_t cell6
Definition: hott_gam.h:88
int8_t rpm_L
Definition: hott_gam.h:99
int8_t speed_L
Definition: hott_gam.h:112
int8_t cell3
Definition: hott_gam.h:85
int8_t general_error_number
Definition: hott_gam.h:118
int8_t main_voltage_L
Definition: hott_gam.h:108
int8_t cell1
Definition: hott_gam.h:83
int8_t alarm_invers1
Definition: hott_gam.h:62
int8_t batt_cap_L
Definition: hott_gam.h:110
int8_t altitude_H
Definition: hott_gam.h:102
int8_t cell2
Definition: hott_gam.h:84
signed char int8_t
Typedef defining 8 bit char type.
Definition: vl53l1_types.h:103