Skip to content

Commit 0118c03

Browse files
committed
AP_VideoTX: Add VTX temperature
Make VTX temperature from AP_Tramp available through AP_VideoTX class.
1 parent 9f29606 commit 0118c03

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

libraries/AP_VideoTX/AP_Tramp.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ char AP_Tramp::handle_response(void)
156156
if (temp != 0) {
157157
// Got response, update device status
158158
cur_temp = temp;
159+
160+
// propagate temperature to AP_VideoTX
161+
AP_VideoTX& vtx = AP::vtx();
162+
vtx.set_temperature((float) cur_temp);
163+
159164
return 's';
160165
}
161166
break;

libraries/AP_VideoTX/AP_VideoTX.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ class AP_VideoTX {
178178

179179
static AP_VideoTX *singleton;
180180

181+
// set the vtx temperature from backend, at the moment only AP_Tramp provides temperature
182+
void set_temperature(float temperature) { _internal_temperature = temperature; }
183+
// get the vtx temperature, consumer is OSD, a value of -1.0f indicates an invalid value, i.e. the backend does not provide it.
184+
float get_temperature() const { return _internal_temperature; }
185+
181186
private:
182187
uint8_t find_current_power() const;
183188
// channel frequency
@@ -212,6 +217,9 @@ class AP_VideoTX {
212217

213218
// types of VTX providers
214219
uint8_t _types;
220+
221+
// VTX temperature provided by AP_Tramp backend, not by AP_SmartAudio
222+
float _internal_temperature = -1.0f;
215223
};
216224

217225
namespace AP {

0 commit comments

Comments
 (0)