From 9681929f98cfac2b3433b605bcf788ef8bacf0a2 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Mon, 16 Jan 2017 11:13:53 +0100 Subject: [PATCH] tramp: re-enabled temperature support Temps have been measured right on the STM32F031G6 located on the surface of the Tramp and seem to be quite accurate. Above 104C, it starts to trickle the power down. --- src/main/io/vtx_tramp.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/io/vtx_tramp.c b/src/main/io/vtx_tramp.c index f7c25e0942..4e4716836a 100644 --- a/src/main/io/vtx_tramp.c +++ b/src/main/io/vtx_tramp.c @@ -61,6 +61,7 @@ uint8_t trampCurBand = 0; uint8_t trampCurChan = 0; uint16_t trampCurPower = 0; // Actual transmitting power uint16_t trampCurConfigPower = 0; // Configured transmitting power +int16_t trampCurTemp = 0; uint8_t trampCurPitmode = 0; uint32_t trampConfFreq = 0; @@ -174,6 +175,16 @@ char trampHandleResponse(void) // throw bytes echoed from tx to rx in bidirectional mode away } break; + + case 's': + { + uint16_t temp = (int16_t)(trampRespBuffer[6]|(trampRespBuffer[7] << 8)); + if(temp != 0) { + trampCurTemp = temp; + return 's'; + } + } + break; } return 0; @@ -323,13 +334,17 @@ void trampProcess(uint32_t currentTimeUs) case TRAMP_STATUS_OFFLINE: case TRAMP_STATUS_ONLINE: - if (cmp32(currentTimeUs, lastQueryTimeUs) > 1000 * 1000) { // 1s if (trampStatus == TRAMP_STATUS_OFFLINE) trampQueryR(); - else - trampQueryV(); + else { + static unsigned int cnt = 0; + if(((cnt++) & 1) == 0) + trampQueryV(); + else + trampQueryS(); + } lastQueryTimeUs = currentTimeUs; } @@ -474,6 +489,8 @@ static long trampCmsConfigChan(displayPort_t *pDisp, const void *self) return 0; } +static OSD_INT16_t trampCmsEntTemp = { &trampCurTemp, -100, 300, 0 }; + static const char * const trampCmsPitmodeNames[] = { "---", "OFF", "ON " }; @@ -560,6 +577,7 @@ static OSD_Entry trampMenuEntries[] = { "CHAN", OME_TAB, trampCmsConfigChan, &trampCmsEntChan, 0 }, { "(FREQ)", OME_UINT16, NULL, &trampCmsEntFreqRef, DYNAMIC }, { "POWER", OME_TAB, NULL, &trampCmsEntPower, 0 }, + { "T(C)", OME_INT16, NULL, &trampCmsEntTemp, DYNAMIC }, { "SET", OME_Submenu, cmsMenuChange, &trampCmsMenuCommence, 0 }, { "BACK", OME_Back, NULL, NULL, 0 },