From 37a6b32a306087d95ec9cc4fe118e717d1e53575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Mon, 5 Mar 2018 11:57:45 +0000 Subject: [PATCH] Allocate trampReqBuffer on the stack Saves 16 bytes of RAM --- src/main/io/vtx_tramp.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/io/vtx_tramp.c b/src/main/io/vtx_tramp.c index 1419f78c7a..1307e96113 100644 --- a/src/main/io/vtx_tramp.c +++ b/src/main/io/vtx_tramp.c @@ -66,7 +66,6 @@ static vtxDevice_t vtxTramp = { static serialPort_t *trampSerialPort = NULL; -static uint8_t trampReqBuffer[16]; static uint8_t trampRespBuffer[16]; typedef enum { @@ -100,11 +99,6 @@ uint8_t trampFreqRetries = 0; uint16_t trampConfPower = 0; uint8_t trampPowerRetries = 0; -static void trampWriteBuf(uint8_t *buf) -{ - serialWriteBuf(trampSerialPort, buf, 16); -} - static uint8_t trampChecksum(uint8_t *trampBuf) { uint8_t cksum = 0; @@ -120,13 +114,14 @@ void trampCmdU16(uint8_t cmd, uint16_t param) if (!trampSerialPort) return; + uint8_t trampReqBuffer[16]; memset(trampReqBuffer, 0, ARRAYLEN(trampReqBuffer)); trampReqBuffer[0] = 15; trampReqBuffer[1] = cmd; trampReqBuffer[2] = param & 0xff; trampReqBuffer[3] = (param >> 8) & 0xff; trampReqBuffer[14] = trampChecksum(trampReqBuffer); - trampWriteBuf(trampReqBuffer); + serialWriteBuf(trampSerialPort, trampReqBuffer, sizeof(trampReqBuffer)); } void trampSetFreq(uint16_t freq)