1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

Add box to pinio monitor/mapper

This commit is contained in:
jflyper 2018-02-03 11:18:18 +09:00
parent 8294048ce5
commit 6557b161aa
15 changed files with 193 additions and 1 deletions

View file

@ -38,6 +38,8 @@
#include "telemetry/telemetry.h"
#include "pg/piniobox.h"
#ifndef USE_OSD_SLAVE
// permanent IDs must uniquely identify BOX meaning, DO NOT REUSE THEM!
@ -82,6 +84,10 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT] = {
{ BOXBEEPGPSCOUNT, "BEEP GPS SATELLITE COUNT", 37 },
{ BOX3DONASWITCH, "3D ON A SWITCH", 38 },
{ BOXVTXPITMODE, "VTX PIT MODE", 39 },
{ BOXUSER1, "USER1", 40 },
{ BOXUSER2, "USER2", 41 },
{ BOXUSER3, "USER3", 42 },
{ BOXUSER4, "USER4", 43 },
};
// mask of enabled IDs, calculated on startup based on enabled features. boxId_e is used as bit index
@ -260,6 +266,23 @@ void initActiveBoxIds(void)
BME(BOXVTXPITMODE);
#endif
#ifdef USE_PINIOBOX
// Turn BOXUSERx only if pinioBox facility monitors them, as the facility is the only BOXUSERx observer.
// Note that pinioBoxConfig can be set to monitor any box.
for (int i = 0; i < PINIO_COUNT; i++) {
switch(pinioBoxConfig()->boxId[i]) {
case BOXUSER1:
case BOXUSER2:
case BOXUSER3:
case BOXUSER4:
BME(pinioBoxConfig()->boxId[i]);
break;
default:
break;
}
}
#endif
#undef BME
// check that all enabled IDs are in boxes array (check may be skipped when using findBoxById() functions)
for (boxId_e boxId = 0; boxId < CHECKBOX_ITEM_COUNT; boxId++)

View file

@ -36,3 +36,4 @@ void serializeBoxPermanentIdFn(struct sbuf_s *dst, const box_t *box);
typedef void serializeBoxFn(struct sbuf_s *dst, const box_t *box);
void serializeBoxReply(struct sbuf_s *dst, int page, serializeBoxFn *serializeBox);
void initActiveBoxIds(void);
bool getBoxIdState(boxId_e boxid);

View file

@ -869,6 +869,7 @@ const clivalue_t valueTable[] = {
// PG_PINIO_CONFIG
#ifdef USE_PINIO
{ "pinio_config", VAR_UINT8 | MASTER_VALUE | MODE_ARRAY, .config.array.length = PINIO_COUNT, PG_PINIO_CONFIG, offsetof(pinioConfig_t, config) },
{ "piniobox_config", VAR_INT8 | MASTER_VALUE | MODE_ARRAY, .config.array.length = PINIO_COUNT, PG_PINIOBOX_CONFIG, offsetof(pinioBoxConfig_t, boxId) },
#endif
};