1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 16:25:26 +03:00

digital lights control: add USE_ prefix

This commit is contained in:
Michel Pastor 2018-01-23 18:36:34 +01:00
parent bd7fc77676
commit c96c4fc585
6 changed files with 22 additions and 20 deletions

View file

@ -375,7 +375,7 @@ void init(void)
beeperInit(&beeperDevConfig); beeperInit(&beeperDevConfig);
#endif #endif
#ifdef LIGHTS #ifdef USE_LIGHTS
lightsInit(); lightsInit();
#endif #endif

View file

@ -206,7 +206,7 @@ void initActiveBoxIds(void)
activeBoxIds[activeBoxIdCount++] = BOXBEEPERON; activeBoxIds[activeBoxIdCount++] = BOXBEEPERON;
#ifdef LIGHTS #ifdef USE_LIGHTS
activeBoxIds[activeBoxIdCount++] = BOXLIGHTS; activeBoxIds[activeBoxIdCount++] = BOXLIGHTS;
#endif #endif

View file

@ -316,7 +316,7 @@ void fcTasksInit(void)
#ifdef BEEPER #ifdef BEEPER
setTaskEnabled(TASK_BEEPER, true); setTaskEnabled(TASK_BEEPER, true);
#endif #endif
#ifdef LIGHTS #ifdef USE_LIGHTS
setTaskEnabled(TASK_LIGHTS, true); setTaskEnabled(TASK_LIGHTS, true);
#endif #endif
setTaskEnabled(TASK_BATTERY, feature(FEATURE_VBAT) || feature(FEATURE_CURRENT_METER)); setTaskEnabled(TASK_BATTERY, feature(FEATURE_VBAT) || feature(FEATURE_CURRENT_METER));
@ -449,7 +449,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
}, },
#endif #endif
#ifdef LIGHTS #ifdef USE_LIGHTS
[TASK_LIGHTS] = { [TASK_LIGHTS] = {
.taskName = "LIGHTS", .taskName = "LIGHTS",
.taskFunc = lightsUpdate, .taskFunc = lightsUpdate,

View file

@ -20,12 +20,12 @@
#include "io/lights.h" #include "io/lights.h"
#ifdef LIGHTS #ifdef USE_LIGHTS
static IO_t lightsIO = DEFIO_IO(NONE); static IO_t lightsIO = DEFIO_IO(NONE);
static bool lights_on = false; static bool lights_on = false;
#ifdef FAILSAFE_LIGHTS #ifdef USE_FAILSAFE_LIGHTS
static timeUs_t last_status_change = 0; static timeUs_t last_status_change = 0;
#endif #endif
@ -47,7 +47,7 @@ void lightsUpdate(timeUs_t currentTimeUs)
{ {
UNUSED(currentTimeUs); UNUSED(currentTimeUs);
if (lightsIO) { if (lightsIO) {
#ifdef FAILSAFE_LIGHTS #ifdef USE_FAILSAFE_LIGHTS
if (FLIGHT_MODE(FAILSAFE_MODE) && ARMING_FLAG(WAS_EVER_ARMED)) { if (FLIGHT_MODE(FAILSAFE_MODE) && ARMING_FLAG(WAS_EVER_ARMED)) {
bool new_lights_status = lights_on; bool new_lights_status = lights_on;
if (lights_on) { if (lights_on) {
@ -67,13 +67,13 @@ void lightsUpdate(timeUs_t currentTimeUs)
} }
#else #else
lightsSetStatus(IS_RC_MODE_ACTIVE(BOXLIGHTS)); lightsSetStatus(IS_RC_MODE_ACTIVE(BOXLIGHTS));
#endif /* FAILSAFE_LIGHTS */ #endif /* USE_FAILSAFE_LIGHTS */
} }
} }
void lightsInit() void lightsInit()
{ {
lightsIO = IOGetByTag(IO_TAG(LIGHTS)); lightsIO = IOGetByTag(IO_TAG(LIGHTS_PIN));
if (lightsIO) { if (lightsIO) {
IOInit(lightsIO, OWNER_LED, RESOURCE_OUTPUT, 0); IOInit(lightsIO, OWNER_LED, RESOURCE_OUTPUT, 0);
@ -81,4 +81,4 @@ void lightsInit()
} }
} }
#endif /* LIGHTS */ #endif /* USE_LIGHTS */

View file

@ -19,23 +19,25 @@
#include "common/time.h" #include "common/time.h"
#ifdef LIGHTS #ifdef USE_LIGHTS
//#define FAILSAFE_LIGHTS //#define USE_FAILSAFE_LIGHTS
#ifndef LIGHTS_OUTPUT_MODE #ifndef LIGHTS_OUTPUT_MODE
#define LIGHTS_OUTPUT_MODE IOCFG_OUT_PP #define LIGHTS_OUTPUT_MODE IOCFG_OUT_PP
#endif #endif
#ifndef FAILSAFE_LIGHTS_ON_TIME #ifdef USE_FAILSAFE_LIGHTS
#define FAILSAFE_LIGHTS_ON_TIME 100 // ms #ifndef FAILSAFE_LIGHTS_ON_TIME
#endif #define FAILSAFE_LIGHTS_ON_TIME 100 // ms
#ifndef FAILSAFE_LIGHTS_OFF_TIME #endif
#define FAILSAFE_LIGHTS_OFF_TIME 900 // ms #ifndef FAILSAFE_LIGHTS_OFF_TIME
#endif #define FAILSAFE_LIGHTS_OFF_TIME 900 // ms
#endif
#endif /* USE_FAILSAFE_LIGHTS */
void lightsUpdate(timeUs_t currentTimeUs); void lightsUpdate(timeUs_t currentTimeUs);
void lightsInit(); void lightsInit();
#endif /* LIGHTS */ #endif /* USE_LIGHTS */

View file

@ -65,7 +65,7 @@ typedef enum {
#ifdef BEEPER #ifdef BEEPER
TASK_BEEPER, TASK_BEEPER,
#endif #endif
#ifdef LIGHTS #ifdef USE_LIGHTS
TASK_LIGHTS, TASK_LIGHTS,
#endif #endif
#ifdef USE_GPS #ifdef USE_GPS