Improve menu handling

This commit is contained in:
3djc
2020-11-24 08:57:16 +01:00
parent 2dfa8a80ab
commit e2f4805725
18 changed files with 43 additions and 13 deletions
+2 -1
View File
@@ -195,7 +195,8 @@ void processGhostTelemetryFrame()
packet = (GhostMenuFrame * ) telemetryRxBuffer;
lineData = (GhostMenuData *) &reusableBuffer.ghostMenu.line[packet->lineIndex];
lineData->splitLine = 0;
reusableBuffer.ghostMenu.menuFlags = packet->menuFlags;
reusableBuffer.ghostMenu.menuStatus = packet->menuStatus;
TRACE("menuStatus: %x",reusableBuffer.ghostMenu.menuStatus);
lineData->lineFlags = packet->lineFlags;
for (uint8_t i = 0; i < GHST_MENU_CHARS; i++) {
if (packet->menuText[i] == 0x7C) {
+10 -6
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details.
*/
#ifndef _GHOST_H_
#define _GHOST_H_
#pragma once
#include <inttypes.h>
#include "dataconstants.h"
@@ -143,6 +142,12 @@ enum GhostMenuControl
GHST_MENU_CTRL_REDRAW = 0X04,
};
enum GhostMenuStatus
{
GHST_MENU_STATUS_UNOPENED = 0x00,
GHST_MENU_STATUS_OPENED = 0x01,
GHST_MENU_STATUS_CLOSING = 0x02,
};
enum GhostFrames
{
@@ -159,8 +164,8 @@ struct GhostMenuFrame
uint8_t address;
uint8_t length ;
uint8_t packetId;
uint8_t menuFlags; // GHST_MENU_CTRL
uint8_t lineFlags; // Carat states, Inverse, Bold for each of Menu Label, and Value
uint8_t menuStatus; // GhostMenuStatus
uint8_t lineFlags; // GhostLineFlags
uint8_t lineIndex; // 0 = first line
unsigned char menuText[GHST_MENU_CHARS];
uint8_t crc;
@@ -168,10 +173,9 @@ struct GhostMenuFrame
struct GhostMenuData
{
uint8_t menuFlags; // Update Line, Clear Menu, etc.
uint8_t menuStatus; // Update Line, Clear Menu, etc.
uint8_t lineFlags; // Carat states, Inverse, Bold for each of Menu Label, and Value
uint8_t splitLine; // Store beginning of Value substring
char menuText[GHST_MENU_CHARS + 1];
};
#endif // _GHOST_H_