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);
#endif
#ifdef LIGHTS
#ifdef USE_LIGHTS
lightsInit();
#endif

View file

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

View file

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

View file

@ -20,12 +20,12 @@
#include "io/lights.h"
#ifdef LIGHTS
#ifdef USE_LIGHTS
static IO_t lightsIO = DEFIO_IO(NONE);
static bool lights_on = false;
#ifdef FAILSAFE_LIGHTS
#ifdef USE_FAILSAFE_LIGHTS
static timeUs_t last_status_change = 0;
#endif
@ -47,7 +47,7 @@ void lightsUpdate(timeUs_t currentTimeUs)
{
UNUSED(currentTimeUs);
if (lightsIO) {
#ifdef FAILSAFE_LIGHTS
#ifdef USE_FAILSAFE_LIGHTS
if (FLIGHT_MODE(FAILSAFE_MODE) && ARMING_FLAG(WAS_EVER_ARMED)) {
bool new_lights_status = lights_on;
if (lights_on) {
@ -67,13 +67,13 @@ void lightsUpdate(timeUs_t currentTimeUs)
}
#else
lightsSetStatus(IS_RC_MODE_ACTIVE(BOXLIGHTS));
#endif /* FAILSAFE_LIGHTS */
#endif /* USE_FAILSAFE_LIGHTS */
}
}
void lightsInit()
{
lightsIO = IOGetByTag(IO_TAG(LIGHTS));
lightsIO = IOGetByTag(IO_TAG(LIGHTS_PIN));
if (lightsIO) {
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"
#ifdef LIGHTS
#ifdef USE_LIGHTS
//#define FAILSAFE_LIGHTS
//#define USE_FAILSAFE_LIGHTS
#ifndef LIGHTS_OUTPUT_MODE
#define LIGHTS_OUTPUT_MODE IOCFG_OUT_PP
#endif
#ifndef FAILSAFE_LIGHTS_ON_TIME
#ifdef USE_FAILSAFE_LIGHTS
#ifndef FAILSAFE_LIGHTS_ON_TIME
#define FAILSAFE_LIGHTS_ON_TIME 100 // ms
#endif
#ifndef FAILSAFE_LIGHTS_OFF_TIME
#endif
#ifndef FAILSAFE_LIGHTS_OFF_TIME
#define FAILSAFE_LIGHTS_OFF_TIME 900 // ms
#endif
#endif
#endif /* USE_FAILSAFE_LIGHTS */
void lightsUpdate(timeUs_t currentTimeUs);
void lightsInit();
#endif /* LIGHTS */
#endif /* USE_LIGHTS */

View file

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