1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 17:25:20 +03:00

Merge pull request #5208 from jflyper/bfdev-piniobox-cleanup

PINIOBOX Separation of boxId and permanentId.
This commit is contained in:
Michael Keller 2018-02-20 01:53:07 +13:00 committed by GitHub
commit b4667332d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 25 deletions

View file

@ -269,15 +269,20 @@ void initActiveBoxIds(void)
// 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;
if (pinioBoxConfig()->permanentId[i] != PERMANENT_ID_NONE) {
const box_t *box = findBoxByPermanentId(pinioBoxConfig()->permanentId[i]);
if (box) {
switch(box->boxId) {
case BOXUSER1:
case BOXUSER2:
case BOXUSER3:
case BOXUSER4:
BME(box->boxId);
break;
default:
break;
}
}
}
}
#endif

View file

@ -25,6 +25,8 @@ typedef struct box_s {
const uint8_t permanentId; // permanent ID used to identify BOX. This ID is unique for one function, DO NOT REUSE IT
} box_t;
#define PERMANENT_ID_NONE 255
const box_t *findBoxByBoxId(boxId_e boxId);
const box_t *findBoxByPermanentId(uint8_t permanentId);

View file

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