From 61bbfd6e7c6ecfd0292d6539d6e07d5143fd923f Mon Sep 17 00:00:00 2001 From: "romolo.manfredini@gmail.com" Date: Tue, 26 Jun 2012 07:17:17 +0000 Subject: [PATCH] Add support for FAS100 sensor --- src/frsky.cpp | 33 +++++++++++++++++++++++++++++++-- src/frsky.h | 3 ++- src/myeeprom.h | 7 +++++-- src/open9x.cpp | 3 +++ src/translations/cz.h | 2 +- src/translations/de.h | 2 +- src/translations/en.h | 2 +- src/translations/fr.h | 2 +- src/translations/it.h | 2 +- src/translations/se.h | 2 +- 10 files changed, 47 insertions(+), 11 deletions(-) diff --git a/src/frsky.cpp b/src/frsky.cpp index c7076c9dc..b76d9aed7 100644 --- a/src/frsky.cpp +++ b/src/frsky.cpp @@ -60,6 +60,9 @@ int8_t frskyStreaming = -1; uint8_t frskyUsrStreaming = 0; uint8_t link_counter = 0; +uint32_t consumption = 0; +uint16_t s_currTmr = 0; + FrskyData frskyTelemetry[2]; FrskyRSSI frskyRSSI[2]; @@ -83,6 +86,8 @@ enum BarThresholdIdx { THLD_DIST, THLD_GPSALT, THLD_CELL, + THLD_CURRENT, + THLD_CONSUMPTION, THLD_MAX, }; uint8_t barsThresholds[THLD_MAX]; @@ -272,6 +277,11 @@ void parseTelemHubByte(uint8_t byte) frskyHubData.maxTemperature2 = frskyHubData.temperature2; break; + case offsetof(FrskyHubData, current): + if (frskyHubData.current > frskyHubData.maxCurrent) + frskyHubData.maxCurrent = frskyHubData.current; + break; + case offsetof(FrskyHubData, baroAltitude_bp): // First received barometer altitude => Altitude offset if (!frskyHubData.baroAltitudeOffset) @@ -644,10 +654,14 @@ void check_frsky() frskyRSSI[1].set(0); } #endif +uint16_t currint; +currint=(g_tmr10ms0 (true) == data is streaming in. 0 = nodata detected for some time extern uint8_t frskyUsrStreaming; - +extern uint32_t consumption; #define SEND_MODEL_ALARMS 6 extern uint8_t FrskyAlarmSendState; diff --git a/src/myeeprom.h b/src/myeeprom.h index ec176c78a..b85bd1dd3 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -365,6 +365,8 @@ enum TelemetrySource { TELEM_DIST, TELEM_GPSALT, TELEM_CELL, + TELEM_CURRENT, + TELEM_CONSUMPTION, TELEM_ACCx, TELEM_ACCy, TELEM_ACCz, @@ -379,13 +381,14 @@ enum TelemetrySource { TELEM_MAX_T2, TELEM_MAX_SPEED, TELEM_MAX_DIST, + TELEM_MAX_CURRENT, TELEM_ACC, TELEM_GPS_TIME, TELEM_BAR_MAX = TELEM_CELL, TELEM_NOUSR_BAR_MAX = TELEM_RSSI_RX, - TELEM_CSW_MAX = TELEM_CELL, + TELEM_CSW_MAX = TELEM_CONSUMPTION, TELEM_NOUSR_CSW_MAX = TELEM_RSSI_RX, - TELEM_DISPLAY_MAX = TELEM_MAX_DIST, + TELEM_DISPLAY_MAX = TELEM_MAX_CURRENT, TELEM_STATUS_MAX = TELEM_GPS_TIME }; diff --git a/src/open9x.cpp b/src/open9x.cpp index 219c06fc6..f156b5a1b 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -464,6 +464,8 @@ int16_t getValue(uint8_t i) else if(i