From 1f74977472e6ba1ca82c178f7d625fc6cda9f87c Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Tue, 12 Aug 2014 09:44:44 +0200 Subject: [PATCH 01/27] OP-1379 add base types for colour, Initial ext rgb led api definition --- flight/libraries/inc/optypes.h | 61 +++++++++++++++++++++++++++++ flight/libraries/optypes.c | 40 +++++++++++++++++++ flight/pios/common/pios_notify.c | 29 +++++++++++++- flight/pios/inc/pios_notify.h | 50 +++++++++++++++++++++-- flight/pios/inc/pios_ws2811.h | 11 +----- flight/pios/stm32f4xx/pios_ws2811.c | 4 +- make/apps-defs.mk | 1 + 7 files changed, 181 insertions(+), 15 deletions(-) create mode 100644 flight/libraries/inc/optypes.h create mode 100644 flight/libraries/optypes.c diff --git a/flight/libraries/inc/optypes.h b/flight/libraries/inc/optypes.h new file mode 100644 index 000000000..d48e87887 --- /dev/null +++ b/flight/libraries/inc/optypes.h @@ -0,0 +1,61 @@ +/** + ****************************************************************************** + * + * @file optypes.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief OP Generic data type library + * -- + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef UTIL_H +#define UTIL_H +#include +typedef struct { + uint8_t R; + uint8_t G; + uint8_t B; +} Color_t; + +extern const Color_t Color_Off; +extern const Color_t Color_Red; +extern const Color_t Color_Lime; +extern const Color_t Color_Blue; +extern const Color_t Color_Yellow; +extern const Color_t Color_Cian; +extern const Color_t Color_Magenta; +extern const Color_t Color_Navy; +extern const Color_t Color_Green; +extern const Color_t Color_Purple; +extern const Color_t Color_Teal; +extern const Color_t Color_Orange; + +#define COLOR_OFF { .R = 0x00, .G = 0x00, .B = 0x00 } +#define COLOR_RED { .R = 0xFF, .G = 0x00, .B = 0x00 } +#define COLOR_LIME { .R = 0x00, .G = 0xFF, .B = 0x00 } +#define COLOR_BLUE { .R = 0x00, .G = 0x00, .B = 0xFF } +#define COLOR_YELLOW { .R = 0xFF, .G = 0xFF, .B = 0x00 } +#define COLOR_CIAN { .R = 0x00, .G = 0xFF, .B = 0xFF } +#define COLOR_MAGENTA { .R = 0xFF, .G = 0x00, .B = 0xFF } +#define COLOR_NAVY { .R = 0x00, .G = 0x00, .B = 0x80 } +#define COLOR_GREEN { .R = 0x00, .G = 0x80, .B = 0x00 } +#define COLOR_PURPLE { .R = 0x80, .G = 0x00, .B = 0x80 } +#define COLOR_TEAL { .R = 0x00, .G = 0x80, .B = 0x80 } +#define COLOR_ORANGE { .R = 0xFF, .G = 0xA5, .B = 0x00 } + +#endif /* UTIL_H */ diff --git a/flight/libraries/optypes.c b/flight/libraries/optypes.c new file mode 100644 index 000000000..a203ee555 --- /dev/null +++ b/flight/libraries/optypes.c @@ -0,0 +1,40 @@ +/** + ****************************************************************************** + * + * @file optypes.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief OP Generic data type library + * -- + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +const Color_t Color_Off = COLOR_OFF; +const Color_t Color_Red = COLOR_RED; +const Color_t Color_Lime = COLOR_LIME; +const Color_t Color_Blue = COLOR_BLUE; +const Color_t Color_Yellow = COLOR_YELLOW; +const Color_t Color_Cian = COLOR_CIAN; +const Color_t Color_Magenta = COLOR_MAGENTA; +const Color_t Color_Navy = COLOR_NAVY; +const Color_t Color_Green = COLOR_GREEN; +const Color_t Color_Purple = COLOR_PURPLE; +const Color_t Color_Teal = COLOR_TEAL; +const Color_t Color_Orange = COLOR_ORANGE; diff --git a/flight/pios/common/pios_notify.c b/flight/pios/common/pios_notify.c index bf83c22eb..5f47a18a6 100644 --- a/flight/pios/common/pios_notify.c +++ b/flight/pios/common/pios_notify.c @@ -28,7 +28,8 @@ static volatile pios_notify_notification currentNotification = NOTIFY_NONE; static volatile pios_notify_priority currentPriority; - +static volatile ExtLedNotification_t extLedNotification; +static volatile bool newNotification; void PIOS_NOTIFY_StartNotification(pios_notify_notification notification, pios_notify_priority priority) { @@ -47,3 +48,29 @@ pios_notify_notification PIOS_NOTIFY_GetActiveNotification(bool clear) } return ret; } + + +/* + * Play a sequence on the default external led. Sequences with priority higher than NOTIFY_PRIORITY_LOW + * are repeated only once if repeat = -1 + * @param sequence Sequence to be played + * @param priority Priority of the sequence being played + */ +void PIOS_NOTIFICATION_Default_Ext_Led_Play(const LedSequence_t *sequence, pios_notify_priority priority) +{ + extLedNotification.priority = priority; + extLedNotification.sequence = *sequence; + newNotification = true; +} + + +ExtLedNotification_t *PIOS_NOTIFY_GetNewExtLedSequence(bool clear) +{ + if (!newNotification) { + return 0; + } + if (clear) { + newNotification = false; + } + return (ExtLedNotification_t *)&extLedNotification; +} diff --git a/flight/pios/inc/pios_notify.h b/flight/pios/inc/pios_notify.h index 1e800df5c..12daefdc2 100644 --- a/flight/pios/inc/pios_notify.h +++ b/flight/pios/inc/pios_notify.h @@ -26,7 +26,7 @@ #ifndef PIOS_NOTIFY_H_ #define PIOS_NOTIFY_H_ #include - +#include typedef enum { NOTIFY_NONE = 0, NOTIFY_OK, @@ -35,11 +35,35 @@ typedef enum { } pios_notify_notification; typedef enum { - NOTIFY_PRIORITY_CRITICAL = 2, - NOTIFY_PRIORITY_REGULAR = 1, + NOTIFY_PRIORITY_CRITICAL = 2, + NOTIFY_PRIORITY_REGULAR = 1, NOTIFY_PRIORITY_LOW = 0, + NOTIFY_PRIORITY_BACKGROUND = -1, } pios_notify_priority; + +// A single led step, Color, time On/Off, repeat count +#define NOTIFY_SEQUENCE_MAX_STEPS 5 + +typedef struct { + uint16_t time_off; + uint16_t time_on; + Color_t color; + uint8_t repeats; +} LedStep_t; + +typedef struct { + int8_t repeats; // -1 for infinite repetitions + LedStep_t steps[NOTIFY_SEQUENCE_MAX_STEPS]; +} LedSequence_t; + +typedef struct { + LedSequence_t sequence; + pios_notify_priority priority; +} ExtLedNotification_t; + +#define NOTIFY_IS_NULL_STEP(x) (!x || (!x->time_off && !x->time_on && !x->repeats)) + /** * start a new notification. If a notification is active it will be overwritten if its priority is lower than the new one. * The new will be discarded otherwise @@ -55,4 +79,24 @@ void PIOS_NOTIFY_StartNotification(pios_notify_notification notification, pios_n */ pios_notify_notification PIOS_NOTIFY_GetActiveNotification(bool clear); +/* + * Play a sequence on the default external led. Sequences with priority higher than NOTIFY_PRIORITY_LOW + * are repeated only once if repeat = -1 + * @param sequence Sequence to be played + * @param priority Priority of the sequence being played + */ +void PIOS_NOTIFICATION_Default_Ext_Led_Play(const LedSequence_t *sequence, pios_notify_priority priority); + +/* + * Play a sequence on an external rgb led. Sequences with priority higher than NOTIFY_PRIORITY_LOW + * are repeated only once if repeat = -1 + * @param sequence Sequence to be played + * @param ledNumber Led number + * @param priority Priority of the sequence being played + * + */ +// void PIOS_NOTIFICATION_Ext_Led_Play(const LedSequence_t sequence, uint8_t ledNumber, pios_notify_priority priority); + +ExtLedNotification_t *PIOS_NOTIFY_GetNewExtLedSequence(bool clear); + #endif /* PIOS_NOTIFY_H_ */ diff --git a/flight/pios/inc/pios_ws2811.h b/flight/pios/inc/pios_ws2811.h index cb05070ee..6b8778b19 100644 --- a/flight/pios/inc/pios_ws2811.h +++ b/flight/pios/inc/pios_ws2811.h @@ -35,7 +35,7 @@ #include #include #include - +#include #define sign(x) ((x > 0) - (x < 0)) #define PIOS_WS2811_NUMLEDS 2 @@ -106,12 +106,6 @@ typedef uint16_t ledbuf_t; -typedef struct Color Color; -struct Color { - uint8_t R; - uint8_t G; - uint8_t B; -}; struct pios_ws2811_pin_cfg { GPIO_TypeDef *gpio; GPIO_InitTypeDef gpioInit; @@ -139,9 +133,8 @@ struct pios_ws2811_cfg { void PIOS_WS2811_Init(const struct pios_ws2811_cfg *ws2811_cfg, const struct pios_ws2811_pin_cfg *ws2811_pin_cfg); -void PIOS_WS2811_setColorRGB(Color c, uint8_t led, bool update); +void PIOS_WS2811_setColorRGB(Color_t c, uint8_t led, bool update); void PIOS_WS2811_Update(); void PIOS_WS2811_DMA_irq_handler(); - #endif /* PIOS_WS2811_H_ */ diff --git a/flight/pios/stm32f4xx/pios_ws2811.c b/flight/pios/stm32f4xx/pios_ws2811.c index 96719a4a8..f4ffe1bed 100644 --- a/flight/pios/stm32f4xx/pios_ws2811.c +++ b/flight/pios/stm32f4xx/pios_ws2811.c @@ -177,7 +177,7 @@ void PIOS_WS2811_Init(const struct pios_ws2811_cfg *ws2811_cfg, const struct pio fb = (ledbuf_t *)pios_malloc(PIOS_WS2811_BUFFER_SIZE * sizeof(ledbuf_t)); memset(fb, 0, PIOS_WS2811_BUFFER_SIZE * sizeof(ledbuf_t)); - Color ledoff = { 0, 0, 0 }; + const Color_t ledoff = Color_Off; for (uint8_t i = 0; i < PIOS_WS2811_NUMLEDS; i++) { PIOS_WS2811_setColorRGB(ledoff, i, false); } @@ -302,7 +302,7 @@ void setColor(uint8_t color, ledbuf_t *buf) * @param led led number * @param update Perform an update after changing led color */ -void PIOS_WS2811_setColorRGB(Color c, uint8_t led, bool update) +void PIOS_WS2811_setColorRGB(Color_t c, uint8_t led, bool update) { if (led >= PIOS_WS2811_NUMLEDS) { return; diff --git a/make/apps-defs.mk b/make/apps-defs.mk index 72381423e..1c473383c 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -110,6 +110,7 @@ SRC += $(MATHLIB)/sin_lookup.c SRC += $(MATHLIB)/pid.c SRC += $(MATHLIB)/mathmisc.c SRC += $(FLIGHTLIB)/printf-stdarg.c +SRC += $(FLIGHTLIB)/optypes.c ## Modules SRC += $(foreach mod, $(MODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.c))) From fd92fdfadf20b0f5f53b81c867088d8cd32c6808 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Tue, 12 Aug 2014 22:18:36 +0200 Subject: [PATCH 02/27] OP-1379 - initial version of external led sequencer implemented in notification lib. Alert overlay not working yet. --- flight/libraries/inc/notification.h | 1 + flight/libraries/inc/optypes.h | 3 +- flight/libraries/notification.c | 255 +++++++++++++++++++++++++++- flight/libraries/optypes.c | 1 + 4 files changed, 256 insertions(+), 4 deletions(-) diff --git a/flight/libraries/inc/notification.h b/flight/libraries/inc/notification.h index 2053a9609..bcf85015c 100644 --- a/flight/libraries/inc/notification.h +++ b/flight/libraries/inc/notification.h @@ -25,6 +25,7 @@ */ #ifndef NOTIFICATION_H #define NOTIFICATION_H +#include // period of each blink phase #define LED_BLINK_PERIOD_MS 200 diff --git a/flight/libraries/inc/optypes.h b/flight/libraries/inc/optypes.h index d48e87887..82a95e52e 100644 --- a/flight/libraries/inc/optypes.h +++ b/flight/libraries/inc/optypes.h @@ -44,6 +44,7 @@ extern const Color_t Color_Green; extern const Color_t Color_Purple; extern const Color_t Color_Teal; extern const Color_t Color_Orange; +extern const Color_t Color_White; #define COLOR_OFF { .R = 0x00, .G = 0x00, .B = 0x00 } #define COLOR_RED { .R = 0xFF, .G = 0x00, .B = 0x00 } @@ -57,5 +58,5 @@ extern const Color_t Color_Orange; #define COLOR_PURPLE { .R = 0x80, .G = 0x00, .B = 0x80 } #define COLOR_TEAL { .R = 0x00, .G = 0x80, .B = 0x80 } #define COLOR_ORANGE { .R = 0xFF, .G = 0xA5, .B = 0x00 } - +#define COLOR_WHITE { .R = 0xAA, .G = 0xAA, .B = 0xAA } #endif /* UTIL_H */ diff --git a/flight/libraries/notification.c b/flight/libraries/notification.c index 9015e4dd3..c02152e02 100644 --- a/flight/libraries/notification.c +++ b/flight/libraries/notification.c @@ -29,6 +29,41 @@ #include #include #include +#include + +#ifdef PIOS_INCLUDE_WS2811 +#include +#endif +// Private defines +// Maximum number of notifications enqueued when a higher priority notification is added +#define MAX_BACKGROUND_NOTIFICATIONS 3 +#define MAX_HANDLED_LED 1 + +#define BACKGROUND_SEQUENCE -1 +#define RESET_STEP -1 +#define GET_CURRENT_MILLIS (xTaskGetTickCount() * portTICK_RATE_MS) +// Private data types definition + +// this is the status for a single LED notification led set +typedef struct { + int8_t queued_priorities[MAX_BACKGROUND_NOTIFICATIONS]; + LedSequence_t queued_sequences[MAX_BACKGROUND_NOTIFICATIONS]; + LedSequence_t background_sequence; + uint32_t next_run_time; + uint32_t sequence_starting_time; + + int8_t active_sequence_num; // active queued sequence or BACKGROUND_SEQUENCE + bool running; // is this led running? + bool step_phase_on; // true = step on phase, false = step off phase + uint8_t next_sequence_step; // (step number to be executed) << 1 || (0x00 = on phase, 0x01 = off phase) + uint8_t next_step_rep; // next repetition number for next step (valid if step.repeats >1) + uint8_t next_sequence_rep; // next sequence repetition counter (valid if sequence.repeats > 1) + uint8_t led_set; // target led set +} NotifierLedStatus_t; + +#ifdef PIOS_INCLUDE_WS2811 +static bool led_status_initialized = false; +#endif #ifdef PIOS_LED_ALARM #define ALARM_LED_ON() PIOS_LED_On(PIOS_LED_ALARM) @@ -137,6 +172,9 @@ static bool handleAlarms(uint16_t *r_pattern, uint16_t *b_pattern); static bool handleNotifications(pios_notify_notification runningNotification, uint16_t *r_pattern, uint16_t *b_pattern); static void handleFlightMode(uint16_t *r_pattern, uint16_t *b_pattern); static void handleHeartbeat(uint16_t *r_pattern, uint16_t *b_pattern); + +static void HandleExtLeds(); + void NotificationUpdateStatus() { started = true; @@ -150,7 +188,7 @@ void NotificationUpdateStatus() void NotificationOnboardLedsRun() { - static portTickType lastRunTimestamp; + static uint32_t lastRunTimestamp; static uint16_t r_pattern; static uint16_t b_pattern; static uint8_t cycleCount; // count the number of cycles @@ -164,11 +202,13 @@ void NotificationOnboardLedsRun() STATUS_LENGHT } status; - if (!started || (xTaskGetTickCount() - lastRunTimestamp) < (LED_BLINK_PERIOD_MS * portTICK_RATE_MS / 4)) { + HandleExtLeds(); + const uint32_t current_timestamp = GET_CURRENT_MILLIS; + if (!started || (current_timestamp - lastRunTimestamp) < LED_BLINK_PERIOD_MS) { return; } - lastRunTimestamp = xTaskGetTickCount(); + lastRunTimestamp = current_timestamp; // the led will show various status information, subdivided in three phases // - Notification // - Alarm @@ -294,3 +334,212 @@ static void handleHeartbeat(uint16_t *r_pattern, uint16_t *b_pattern) *b_pattern = BLINK_B_HEARTBEAT_PATTERN; *r_pattern = BLINK_R_HEARTBEAT_PATTERN; } + +#ifdef PIOS_INCLUDE_WS2811 + +NotifierLedStatus_t led_status[MAX_HANDLED_LED]; + +static void InitExtLed() +{ + memset(led_status, 0, sizeof(NotifierLedStatus_t) * MAX_HANDLED_LED); + const uint32_t now = GET_CURRENT_MILLIS; + for (uint8_t l = 0; l < MAX_HANDLED_LED; l++) { + led_status[l].led_set = l; + led_status[l].next_run_time = now + 500; // start within half a second + for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { + led_status[l].queued_priorities[i] = NOTIFY_PRIORITY_BACKGROUND; + } + } +} + +/** + * restart current sequence + */ +static void restart_sequence(NotifierLedStatus_t *status, bool immediate) +{ + status->next_sequence_step = 0; + status->next_step_rep = 0; + status->step_phase_on = true; + status->running = true; + if (immediate) { + uint32_t currentTime = GET_CURRENT_MILLIS; + status->next_run_time = currentTime; + } + status->sequence_starting_time = status->next_run_time; +} + +/** + * modify background sequence or enqueue a new sequence to play + */ +static void push_queued_sequence(ExtLedNotification_t *new_notification, NotifierLedStatus_t *status) +{ + int8_t updated_sequence = BACKGROUND_SEQUENCE; + + if (new_notification->priority == NOTIFY_PRIORITY_BACKGROUND) { + status->background_sequence = new_notification->sequence; + } else { + // a notification with priority higher than background. + // try to enqueue it + int8_t insert_point = -1; + int8_t first_free = -1; + for (int8_t i = MAX_BACKGROUND_NOTIFICATIONS; i > -1; i--) { + const int8_t priority_i = status->queued_priorities[i]; + if (priority_i == NOTIFY_PRIORITY_BACKGROUND) { + first_free = i; + insert_point = i; + continue; + } + if (priority_i > new_notification->priority) { + insert_point = i; + } + } + + if (insert_point != first_free) { + // there is a free slot, move everything up one place + if (first_free != -1) { + for (uint8_t i = MAX_BACKGROUND_NOTIFICATIONS - 1; i > insert_point; i--) { + status->queued_priorities[i] = status->queued_priorities[i - 1]; + status->queued_sequences[i] = status->queued_sequences[i - 1]; + } + if (status->active_sequence_num >= insert_point) { + status->active_sequence_num++; + } + } else { + // no free space, discard lowest priority notification and move everything down + for (uint8_t i = 0; i < insert_point; i++) { + status->queued_priorities[i] = status->queued_priorities[i + 1]; + status->queued_sequences[i] = status->queued_sequences[i + 1]; + } + if (status->active_sequence_num <= insert_point) { + status->active_sequence_num--; + } + } + } + + status->queued_priorities[insert_point] = new_notification->priority; + status->queued_sequences[insert_point] = new_notification->sequence; + updated_sequence = insert_point; + } + + if (status->active_sequence_num < updated_sequence) { + status->active_sequence_num = updated_sequence; + restart_sequence(status, true); + } + if (updated_sequence == BACKGROUND_SEQUENCE) { + restart_sequence(status, false); + } +} + +static bool pop_queued_sequence(NotifierLedStatus_t *status) +{ + if (status->active_sequence_num != BACKGROUND_SEQUENCE) { + // start the lower priority item + status->queued_priorities[status->active_sequence_num] = NOTIFY_PRIORITY_BACKGROUND; + status->active_sequence_num--; + return true; + } + // background sequence was completed + return false; +} + +/** + * advance current sequence pointers for next step + */ +static void advance_sequence(NotifierLedStatus_t *status) +{ + LedSequence_t *activeSequence = + status->active_sequence_num == BACKGROUND_SEQUENCE ? + &status->background_sequence : &status->queued_sequences[status->active_sequence_num]; + + uint8_t step = status->next_sequence_step; + LedStep_t *currentStep = &activeSequence->steps[step]; + + // Next step will be the OFF phase, so just update the time and + if (status->step_phase_on) { + // next will be the off phase + status->next_run_time += currentStep->time_on; + status->step_phase_on = false; + // check if off phase should be skipped + if (currentStep->time_off != 0) { + return; + } + } + + // next step is ON phase. check whether to repeat current step or move to next one + status->next_run_time += currentStep->time_off; + status->step_phase_on = true; + + if (status->next_step_rep + 1 < currentStep->repeats) { + // setup next repetition + status->next_step_rep++; + return; + } + + // move to next step + LedStep_t *nextStep = (step + 1 < NOTIFY_SEQUENCE_MAX_STEPS) ? &activeSequence->steps[step + 1] : 0; + + // next step is null, check whether sequence must be repeated or it must move to lower priority queued or background sequences + if (NOTIFY_IS_NULL_STEP(nextStep)) { + if (activeSequence->repeats == -1 || status->next_sequence_rep + 1 < activeSequence->repeats) { + status->next_sequence_rep++; + // restart the sequence + restart_sequence(status, false); + return; + } + if (status->active_sequence_num != BACKGROUND_SEQUENCE) { + // no repeat, pop enqueued or background sequences + pop_queued_sequence(status); + restart_sequence(status, false); + } else { + status->running = false; + } + } else { + status->next_step_rep = 0; + status->next_sequence_step++; + } +} + +/** + * run a led set + */ +static void run_led(NotifierLedStatus_t *status) +{ + uint32_t currentTime = GET_CURRENT_MILLIS; + + if (!status->running || currentTime < status->next_run_time) { + return; + } + status->next_run_time = currentTime; + uint8_t step = status->next_sequence_step; + + LedSequence_t *activeSequence = status->active_sequence_num == BACKGROUND_SEQUENCE ? + &status->background_sequence : &status->queued_sequences[status->active_sequence_num]; + if (status->step_phase_on) { + PIOS_WS2811_setColorRGB(activeSequence->steps[step].color, status->led_set, true); + } else { + PIOS_WS2811_setColorRGB(Color_Off, status->led_set, true); + } + advance_sequence(status); +} + +void HandleExtLeds() +{ + // handle incoming sequences + if (!led_status_initialized) { + InitExtLed(); + led_status_initialized = true; + } + static ExtLedNotification_t *newNotification; + newNotification = PIOS_NOTIFY_GetNewExtLedSequence(true); + if (newNotification) { + push_queued_sequence(newNotification, &led_status[0]); + } + + // Run Leds + for (uint8_t i = 0; i < MAX_HANDLED_LED; i++) { + run_led(&led_status[i]); + } +} +#else /* ifdef PIOS_INCLUDE_WS2811 */ +void HandleExtLeds() {} +#endif /* ifdef PIOS_INCLUDE_WS2811 */ diff --git a/flight/libraries/optypes.c b/flight/libraries/optypes.c index a203ee555..b67b81c3f 100644 --- a/flight/libraries/optypes.c +++ b/flight/libraries/optypes.c @@ -38,3 +38,4 @@ const Color_t Color_Green = COLOR_GREEN; const Color_t Color_Purple = COLOR_PURPLE; const Color_t Color_Teal = COLOR_TEAL; const Color_t Color_Orange = COLOR_ORANGE; +const Color_t Color_White = COLOR_WHITE; From 1067ea59d18bbe7c66a6fdb06917d518aa29c136 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Tue, 12 Aug 2014 22:19:30 +0200 Subject: [PATCH 03/27] OP-1379 - Split pios_ws2811.h in config and public api header --- flight/pios/inc/pios_ws2811.h | 103 +------------ flight/pios/inc/pios_ws2811_cfg.h | 137 ++++++++++++++++++ flight/pios/stm32f4xx/pios_ws2811.c | 2 +- .../boards/discoveryf4bare/board_hw_defs.c | 2 +- .../targets/boards/revolution/board_hw_defs.c | 2 +- 5 files changed, 141 insertions(+), 105 deletions(-) create mode 100644 flight/pios/inc/pios_ws2811_cfg.h diff --git a/flight/pios/inc/pios_ws2811.h b/flight/pios/inc/pios_ws2811.h index 6b8778b19..2d04288a2 100644 --- a/flight/pios/inc/pios_ws2811.h +++ b/flight/pios/inc/pios_ws2811.h @@ -29,112 +29,11 @@ #define PIOS_WS2811_H_ #include -#include -#include -#include -#include -#include -#include #include -#define sign(x) ((x > 0) - (x < 0)) -#define PIOS_WS2811_NUMLEDS 2 -#define PIOS_WS2811_BUFFER_SIZE (((PIOS_WS2811_NUMLEDS) * 24)) -#define PIOS_WS2811_MEMORYDATASIZE DMA_MemoryDataSize_HalfWord -#define PIOS_WS2811_PERIPHERALDATASIZE DMA_PeripheralDataSize_HalfWord -#define PIOS_WS2811_TIM_PERIOD 20 - -// Following times are keept on the lower side to accounts -// for bus contentions and irq response time -#define PIOS_WS2811_T0_HIGH_PERIOD 25 // .35us +/- 150nS -#define PIOS_WS2811_T1_HIGH_PERIOD 60 // .70us +/- 150nS - -#define PIOS_WS2811_DMA_CH1_CONFIG(channel) \ - { \ - .DMA_BufferSize = PIOS_WS2811_BUFFER_SIZE, \ - .DMA_Channel = channel, \ - .DMA_DIR = DMA_DIR_MemoryToPeripheral, \ - .DMA_FIFOMode = DMA_FIFOMode_Enable, \ - .DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull, \ - .DMA_Memory0BaseAddr = 0, \ - .DMA_MemoryBurst = DMA_MemoryBurst_INC4, \ - .DMA_MemoryDataSize = PIOS_WS2811_MEMORYDATASIZE, \ - .DMA_MemoryInc = DMA_MemoryInc_Enable, \ - .DMA_Mode = DMA_Mode_Circular, \ - .DMA_PeripheralBaseAddr = 0, \ - .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, \ - .DMA_PeripheralDataSize = PIOS_WS2811_PERIPHERALDATASIZE, \ - .DMA_PeripheralInc = DMA_PeripheralInc_Disable, \ - .DMA_Priority = DMA_Priority_VeryHigh, } - -#define PIOS_WS2811_DMA_CH2_CONFIG(channel) \ - { \ - .DMA_BufferSize = 4, \ - .DMA_Channel = channel, \ - .DMA_DIR = DMA_DIR_MemoryToPeripheral, \ - .DMA_FIFOMode = DMA_FIFOMode_Enable, \ - .DMA_FIFOThreshold = DMA_FIFOThreshold_Full, \ - .DMA_Memory0BaseAddr = 0, \ - .DMA_MemoryBurst = DMA_MemoryBurst_INC4, \ - .DMA_MemoryDataSize = PIOS_WS2811_MEMORYDATASIZE, \ - .DMA_MemoryInc = DMA_MemoryInc_Enable, \ - .DMA_Mode = DMA_Mode_Circular, \ - .DMA_PeripheralBaseAddr = 0, \ - .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, \ - .DMA_PeripheralDataSize = PIOS_WS2811_PERIPHERALDATASIZE, \ - .DMA_PeripheralInc = DMA_PeripheralInc_Disable, \ - .DMA_Priority = DMA_Priority_VeryHigh, } - -#define PIOS_WS2811_DMA_UPDATE_CONFIG(channel) \ - { \ - .DMA_BufferSize = 4, \ - .DMA_Channel = channel, \ - .DMA_DIR = DMA_DIR_MemoryToPeripheral, \ - .DMA_FIFOMode = DMA_FIFOMode_Enable, \ - .DMA_FIFOThreshold = DMA_FIFOThreshold_Full, \ - .DMA_Memory0BaseAddr = 0, \ - .DMA_MemoryBurst = DMA_MemoryBurst_INC4, \ - .DMA_MemoryDataSize = PIOS_WS2811_MEMORYDATASIZE, \ - .DMA_MemoryInc = DMA_MemoryInc_Enable, \ - .DMA_Mode = DMA_Mode_Circular, \ - .DMA_PeripheralBaseAddr = 0, \ - .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, \ - .DMA_PeripheralDataSize = PIOS_WS2811_PERIPHERALDATASIZE, \ - .DMA_PeripheralInc = DMA_PeripheralInc_Disable, \ - .DMA_Priority = DMA_Priority_High } - - -typedef uint16_t ledbuf_t; - -struct pios_ws2811_pin_cfg { - GPIO_TypeDef *gpio; - GPIO_InitTypeDef gpioInit; -}; -struct pios_ws2811_cfg { - TIM_TimeBaseInitTypeDef timerInit; - TIM_TypeDef *timer; - uint8_t timerCh1; - uint8_t timerCh2; - - DMA_InitTypeDef dmaInitCh1; - DMA_Stream_TypeDef *streamCh1; - uint32_t dmaItCh1; - - DMA_InitTypeDef dmaInitCh2; - DMA_Stream_TypeDef *streamCh2; - uint32_t dmaItCh2; - - DMA_InitTypeDef dmaInitUpdate; - DMA_Stream_TypeDef *streamUpdate; - uint32_t dmaItUpdate; - uint16_t dmaSource; - struct stm32_irq irq; -}; - -void PIOS_WS2811_Init(const struct pios_ws2811_cfg *ws2811_cfg, const struct pios_ws2811_pin_cfg *ws2811_pin_cfg); +#define PIOS_WS2811_NUMLEDS 2 void PIOS_WS2811_setColorRGB(Color_t c, uint8_t led, bool update); void PIOS_WS2811_Update(); -void PIOS_WS2811_DMA_irq_handler(); #endif /* PIOS_WS2811_H_ */ diff --git a/flight/pios/inc/pios_ws2811_cfg.h b/flight/pios/inc/pios_ws2811_cfg.h new file mode 100644 index 000000000..379df77be --- /dev/null +++ b/flight/pios/inc/pios_ws2811_cfg.h @@ -0,0 +1,137 @@ +/** + ****************************************************************************** + * + * @file pios_ws2811_cfg.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief A driver for ws2811 rgb led controller. + * this is a plain PiOS port of the very clever solution + * implemented by Omri Iluz in the chibios driver here: + * https://github.com/omriiluz/WS2812B-LED-Driver-ChibiOS + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef PIOS_WS2811_CFG_H_ +#define PIOS_WS2811_CFG_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define sign(x) ((x > 0) - (x < 0)) +#define PIOS_WS2811_BUFFER_SIZE (((PIOS_WS2811_NUMLEDS) * 24)) +#define PIOS_WS2811_MEMORYDATASIZE DMA_MemoryDataSize_HalfWord +#define PIOS_WS2811_PERIPHERALDATASIZE DMA_PeripheralDataSize_HalfWord +#define PIOS_WS2811_TIM_PERIOD 20 + +// Following times are keept on the lower side to accounts +// for bus contentions and irq response time +#define PIOS_WS2811_T0_HIGH_PERIOD 25 // .35us +/- 150nS +#define PIOS_WS2811_T1_HIGH_PERIOD 60 // .70us +/- 150nS + +#define PIOS_WS2811_DMA_CH1_CONFIG(channel) \ + { \ + .DMA_BufferSize = PIOS_WS2811_BUFFER_SIZE, \ + .DMA_Channel = channel, \ + .DMA_DIR = DMA_DIR_MemoryToPeripheral, \ + .DMA_FIFOMode = DMA_FIFOMode_Enable, \ + .DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull, \ + .DMA_Memory0BaseAddr = 0, \ + .DMA_MemoryBurst = DMA_MemoryBurst_INC4, \ + .DMA_MemoryDataSize = PIOS_WS2811_MEMORYDATASIZE, \ + .DMA_MemoryInc = DMA_MemoryInc_Enable, \ + .DMA_Mode = DMA_Mode_Circular, \ + .DMA_PeripheralBaseAddr = 0, \ + .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, \ + .DMA_PeripheralDataSize = PIOS_WS2811_PERIPHERALDATASIZE, \ + .DMA_PeripheralInc = DMA_PeripheralInc_Disable, \ + .DMA_Priority = DMA_Priority_VeryHigh, } + +#define PIOS_WS2811_DMA_CH2_CONFIG(channel) \ + { \ + .DMA_BufferSize = 4, \ + .DMA_Channel = channel, \ + .DMA_DIR = DMA_DIR_MemoryToPeripheral, \ + .DMA_FIFOMode = DMA_FIFOMode_Enable, \ + .DMA_FIFOThreshold = DMA_FIFOThreshold_Full, \ + .DMA_Memory0BaseAddr = 0, \ + .DMA_MemoryBurst = DMA_MemoryBurst_INC4, \ + .DMA_MemoryDataSize = PIOS_WS2811_MEMORYDATASIZE, \ + .DMA_MemoryInc = DMA_MemoryInc_Enable, \ + .DMA_Mode = DMA_Mode_Circular, \ + .DMA_PeripheralBaseAddr = 0, \ + .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, \ + .DMA_PeripheralDataSize = PIOS_WS2811_PERIPHERALDATASIZE, \ + .DMA_PeripheralInc = DMA_PeripheralInc_Disable, \ + .DMA_Priority = DMA_Priority_VeryHigh, } + +#define PIOS_WS2811_DMA_UPDATE_CONFIG(channel) \ + { \ + .DMA_BufferSize = 4, \ + .DMA_Channel = channel, \ + .DMA_DIR = DMA_DIR_MemoryToPeripheral, \ + .DMA_FIFOMode = DMA_FIFOMode_Enable, \ + .DMA_FIFOThreshold = DMA_FIFOThreshold_Full, \ + .DMA_Memory0BaseAddr = 0, \ + .DMA_MemoryBurst = DMA_MemoryBurst_INC4, \ + .DMA_MemoryDataSize = PIOS_WS2811_MEMORYDATASIZE, \ + .DMA_MemoryInc = DMA_MemoryInc_Enable, \ + .DMA_Mode = DMA_Mode_Circular, \ + .DMA_PeripheralBaseAddr = 0, \ + .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, \ + .DMA_PeripheralDataSize = PIOS_WS2811_PERIPHERALDATASIZE, \ + .DMA_PeripheralInc = DMA_PeripheralInc_Disable, \ + .DMA_Priority = DMA_Priority_High } + + +typedef uint16_t ledbuf_t; + +struct pios_ws2811_pin_cfg { + GPIO_TypeDef *gpio; + GPIO_InitTypeDef gpioInit; +}; +struct pios_ws2811_cfg { + TIM_TimeBaseInitTypeDef timerInit; + TIM_TypeDef *timer; + uint8_t timerCh1; + uint8_t timerCh2; + + DMA_InitTypeDef dmaInitCh1; + DMA_Stream_TypeDef *streamCh1; + uint32_t dmaItCh1; + + DMA_InitTypeDef dmaInitCh2; + DMA_Stream_TypeDef *streamCh2; + uint32_t dmaItCh2; + + DMA_InitTypeDef dmaInitUpdate; + DMA_Stream_TypeDef *streamUpdate; + uint32_t dmaItUpdate; + uint16_t dmaSource; + struct stm32_irq irq; +}; + +void PIOS_WS2811_Init(const struct pios_ws2811_cfg *ws2811_cfg, const struct pios_ws2811_pin_cfg *ws2811_pin_cfg); + +void PIOS_WS2811_DMA_irq_handler(); +#endif /* PIOS_WS2811_H_ */ diff --git a/flight/pios/stm32f4xx/pios_ws2811.c b/flight/pios/stm32f4xx/pios_ws2811.c index f4ffe1bed..7762cdfb5 100644 --- a/flight/pios/stm32f4xx/pios_ws2811.c +++ b/flight/pios/stm32f4xx/pios_ws2811.c @@ -29,7 +29,7 @@ #ifdef PIOS_INCLUDE_WS2811 -#include "pios_ws2811.h" +#include "pios_ws2811_cfg.h" #include #include #include "FreeRTOS.h" diff --git a/flight/targets/boards/discoveryf4bare/board_hw_defs.c b/flight/targets/boards/discoveryf4bare/board_hw_defs.c index 4583fe6b4..097a8e193 100644 --- a/flight/targets/boards/discoveryf4bare/board_hw_defs.c +++ b/flight/targets/boards/discoveryf4bare/board_hw_defs.c @@ -1811,7 +1811,7 @@ const struct pios_usb_hid_cfg pios_usb_hid_cfg = { }; #endif /* PIOS_INCLUDE_USB_HID && PIOS_INCLUDE_USB_CDC */ #ifdef PIOS_INCLUDE_WS2811 -#include +#include #define PIOS_WS2811_TIM_DIVIDER (PIOS_PERIPHERAL_APB2_CLOCK / (800000 * PIOS_WS2811_TIM_PERIOD)) void DMA2_Stream1_IRQHandler(void) __attribute__((alias("PIOS_WS2811_irq_handler"))); diff --git a/flight/targets/boards/revolution/board_hw_defs.c b/flight/targets/boards/revolution/board_hw_defs.c index 98fce19c7..3a7cf115f 100644 --- a/flight/targets/boards/revolution/board_hw_defs.c +++ b/flight/targets/boards/revolution/board_hw_defs.c @@ -1964,7 +1964,7 @@ const struct pios_usb_hid_cfg pios_usb_hid_cfg = { #endif /* PIOS_INCLUDE_USB_HID && PIOS_INCLUDE_USB_CDC */ #ifdef PIOS_INCLUDE_WS2811 -#include +#include #include #define PIOS_WS2811_TIM_DIVIDER (PIOS_PERIPHERAL_APB2_CLOCK / (800000 * PIOS_WS2811_TIM_PERIOD)) From f556a5e335cb3bdb47b183468536e5012a980993 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Wed, 13 Aug 2014 15:14:55 +0200 Subject: [PATCH 04/27] OP-1379 - Split simple notification and external lednotifications libraries --- flight/libraries/inc/lednotification.h | 33 +++ flight/libraries/inc/notification.h | 1 - flight/libraries/lednotification.c | 268 ++++++++++++++++++ flight/libraries/notification.c | 244 +--------------- flight/modules/System/systemmod.c | 10 +- .../boards/discoveryf4bare/firmware/Makefile | 1 + .../boards/revolution/firmware/Makefile | 1 + 7 files changed, 314 insertions(+), 244 deletions(-) create mode 100644 flight/libraries/inc/lednotification.h create mode 100644 flight/libraries/lednotification.c diff --git a/flight/libraries/inc/lednotification.h b/flight/libraries/inc/lednotification.h new file mode 100644 index 000000000..fadd100f0 --- /dev/null +++ b/flight/libraries/inc/lednotification.h @@ -0,0 +1,33 @@ +/** + ****************************************************************************** + * + * @file lednotification.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief led notification library + * -- + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef LEDNOTIFICATION_H_ +#define LEDNOTIFICATION_H_ +#include + +void LedNotificationExtLedsRun(); + + +#endif /* LEDNOTIFICATION_H_ */ diff --git a/flight/libraries/inc/notification.h b/flight/libraries/inc/notification.h index bcf85015c..2053a9609 100644 --- a/flight/libraries/inc/notification.h +++ b/flight/libraries/inc/notification.h @@ -25,7 +25,6 @@ */ #ifndef NOTIFICATION_H #define NOTIFICATION_H -#include // period of each blink phase #define LED_BLINK_PERIOD_MS 200 diff --git a/flight/libraries/lednotification.c b/flight/libraries/lednotification.c new file mode 100644 index 000000000..b2ca13597 --- /dev/null +++ b/flight/libraries/lednotification.c @@ -0,0 +1,268 @@ +/** + ****************************************************************************** + * + * @file lednotification.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief led notification library. + * -- + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "inc/lednotification.h" +#include +#include +#include +#include +#include +#include +#include + +// Private defines + +// Maximum number of notifications enqueued when a higher priority notification is added +#define MAX_BACKGROUND_NOTIFICATIONS 5 +#define MAX_HANDLED_LED 1 + +#define BACKGROUND_SEQUENCE -1 +#define RESET_STEP -1 +#define GET_CURRENT_MILLIS (xTaskGetTickCount() * portTICK_RATE_MS) + +// Private data types definition +// this is the status for a single notification led set +typedef struct { + int8_t queued_priorities[MAX_BACKGROUND_NOTIFICATIONS]; + LedSequence_t queued_sequences[MAX_BACKGROUND_NOTIFICATIONS]; + LedSequence_t background_sequence; + uint32_t next_run_time; + uint32_t sequence_starting_time; + + int8_t active_sequence_num; // active queued sequence or BACKGROUND_SEQUENCE + bool running; // is this led running? + bool step_phase_on; // true = step on phase, false = step off phase + uint8_t next_sequence_step; // (step number to be executed) << 1 || (0x00 = on phase, 0x01 = off phase) + uint8_t next_step_rep; // next repetition number for next step (valid if step.repeats >1) + uint8_t next_sequence_rep; // next sequence repetition counter (valid if sequence.repeats > 1) + uint8_t led_set; // target led set +} NotifierLedStatus_t; + +static bool led_status_initialized = false; + +NotifierLedStatus_t led_status[MAX_HANDLED_LED]; + +static void InitExtLed() +{ + memset(led_status, 0, sizeof(NotifierLedStatus_t) * MAX_HANDLED_LED); + const uint32_t now = GET_CURRENT_MILLIS; + for (uint8_t l = 0; l < MAX_HANDLED_LED; l++) { + led_status[l].led_set = 0; + led_status[l].next_run_time = now + 500; // start within half a second + for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { + led_status[l].queued_priorities[i] = NOTIFY_PRIORITY_BACKGROUND; + } + } +} + +/** + * restart current sequence + */ +static void restart_sequence(NotifierLedStatus_t *status, bool immediate) +{ + status->next_sequence_step = 0; + status->next_step_rep = 0; + status->step_phase_on = true; + status->running = true; + if (immediate) { + uint32_t currentTime = GET_CURRENT_MILLIS; + status->next_run_time = currentTime; + } + status->sequence_starting_time = status->next_run_time; +} + +/** + * modify background sequence or enqueue a new sequence to play + */ +static void push_queued_sequence(ExtLedNotification_t *new_notification, NotifierLedStatus_t *status) +{ + int8_t updated_sequence = BACKGROUND_SEQUENCE; + + if (new_notification->priority == NOTIFY_PRIORITY_BACKGROUND) { + status->background_sequence = new_notification->sequence; + } else { + // a notification with priority higher than background. + // try to enqueue it + int8_t insert_point = -1; + int8_t first_free = -1; + for (int8_t i = MAX_BACKGROUND_NOTIFICATIONS; i > -1; i--) { + const int8_t priority_i = status->queued_priorities[i]; + if (priority_i == NOTIFY_PRIORITY_BACKGROUND) { + first_free = i; + insert_point = i; + continue; + } + if (priority_i > new_notification->priority) { + insert_point = i; + } + } + + if (insert_point != first_free) { + // there is a free slot, move everything up one place + if (first_free != -1) { + for (uint8_t i = MAX_BACKGROUND_NOTIFICATIONS - 1; i > insert_point; i--) { + status->queued_priorities[i] = status->queued_priorities[i - 1]; + status->queued_sequences[i] = status->queued_sequences[i - 1]; + } + if (status->active_sequence_num >= insert_point) { + status->active_sequence_num++; + } + } else { + // no free space, discard lowest priority notification and move everything down + for (uint8_t i = 0; i < insert_point; i++) { + status->queued_priorities[i] = status->queued_priorities[i + 1]; + status->queued_sequences[i] = status->queued_sequences[i + 1]; + } + if (status->active_sequence_num <= insert_point) { + status->active_sequence_num--; + } + } + } + + status->queued_priorities[insert_point] = new_notification->priority; + status->queued_sequences[insert_point] = new_notification->sequence; + updated_sequence = insert_point; + } + + if (status->active_sequence_num < updated_sequence) { + status->active_sequence_num = updated_sequence; + restart_sequence(status, true); + } + if (updated_sequence == BACKGROUND_SEQUENCE) { + restart_sequence(status, false); + } +} + +static bool pop_queued_sequence(NotifierLedStatus_t *status) +{ + if (status->active_sequence_num != BACKGROUND_SEQUENCE) { + // start the lower priority item + status->queued_priorities[status->active_sequence_num] = NOTIFY_PRIORITY_BACKGROUND; + status->active_sequence_num--; + return true; + } + // background sequence was completed + return false; +} + +/** + * advance current sequence pointers for next step + */ +static void advance_sequence(NotifierLedStatus_t *status) +{ + LedSequence_t *activeSequence = + status->active_sequence_num == BACKGROUND_SEQUENCE ? + &status->background_sequence : &status->queued_sequences[status->active_sequence_num]; + + uint8_t step = status->next_sequence_step; + LedStep_t *currentStep = &activeSequence->steps[step]; + + // Next step will be the OFF phase, so just update the time and + if (status->step_phase_on) { + // next will be the off phase + status->next_run_time += currentStep->time_on; + status->step_phase_on = false; + // check if off phase should be skipped + if (currentStep->time_off != 0) { + return; + } + } + + // next step is ON phase. check whether to repeat current step or move to next one + status->next_run_time += currentStep->time_off; + status->step_phase_on = true; + + if (status->next_step_rep + 1 < currentStep->repeats) { + // setup next repetition + status->next_step_rep++; + return; + } + + // move to next step + LedStep_t *nextStep = (step + 1 < NOTIFY_SEQUENCE_MAX_STEPS) ? &activeSequence->steps[step + 1] : 0; + + // next step is null, check whether sequence must be repeated or it must move to lower priority queued or background sequences + if (NOTIFY_IS_NULL_STEP(nextStep)) { + if (activeSequence->repeats == -1 || status->next_sequence_rep + 1 < activeSequence->repeats) { + status->next_sequence_rep++; + // restart the sequence + restart_sequence(status, false); + return; + } + if (status->active_sequence_num != BACKGROUND_SEQUENCE) { + // no repeat, pop enqueued or background sequences + pop_queued_sequence(status); + restart_sequence(status, false); + status->next_sequence_rep = 0; + } else { + status->running = false; + } + } else { + status->next_step_rep = 0; + status->next_sequence_step++; + } +} + +/** + * run a led set + */ +static void run_led(NotifierLedStatus_t *status) +{ + uint32_t currentTime = GET_CURRENT_MILLIS; + + if (!status->running || currentTime < status->next_run_time) { + return; + } + status->next_run_time = currentTime; + uint8_t step = status->next_sequence_step; + + LedSequence_t *activeSequence = status->active_sequence_num == BACKGROUND_SEQUENCE ? + &status->background_sequence : &status->queued_sequences[status->active_sequence_num]; + if (status->step_phase_on) { + PIOS_WS2811_setColorRGB(activeSequence->steps[step].color, status->led_set, true); + } else { + PIOS_WS2811_setColorRGB(Color_Off, status->led_set, true); + } + advance_sequence(status); +} + +void LedNotificationExtLedsRun() +{ + // handle incoming sequences + if (!led_status_initialized) { + InitExtLed(); + led_status_initialized = true; + } + static ExtLedNotification_t *newNotification; + newNotification = PIOS_NOTIFY_GetNewExtLedSequence(true); + if (newNotification) { + push_queued_sequence(newNotification, &led_status[0]); + } + + // Run Leds + for (uint8_t i = 0; i < MAX_HANDLED_LED; i++) { + run_led(&led_status[i]); + } +} diff --git a/flight/libraries/notification.c b/flight/libraries/notification.c index c02152e02..cf704d4d5 100644 --- a/flight/libraries/notification.c +++ b/flight/libraries/notification.c @@ -31,40 +31,10 @@ #include #include -#ifdef PIOS_INCLUDE_WS2811 -#include -#endif -// Private defines -// Maximum number of notifications enqueued when a higher priority notification is added -#define MAX_BACKGROUND_NOTIFICATIONS 3 -#define MAX_HANDLED_LED 1 -#define BACKGROUND_SEQUENCE -1 -#define RESET_STEP -1 -#define GET_CURRENT_MILLIS (xTaskGetTickCount() * portTICK_RATE_MS) +#define GET_CURRENT_MILLIS (xTaskGetTickCount() * portTICK_RATE_MS) // Private data types definition -// this is the status for a single LED notification led set -typedef struct { - int8_t queued_priorities[MAX_BACKGROUND_NOTIFICATIONS]; - LedSequence_t queued_sequences[MAX_BACKGROUND_NOTIFICATIONS]; - LedSequence_t background_sequence; - uint32_t next_run_time; - uint32_t sequence_starting_time; - - int8_t active_sequence_num; // active queued sequence or BACKGROUND_SEQUENCE - bool running; // is this led running? - bool step_phase_on; // true = step on phase, false = step off phase - uint8_t next_sequence_step; // (step number to be executed) << 1 || (0x00 = on phase, 0x01 = off phase) - uint8_t next_step_rep; // next repetition number for next step (valid if step.repeats >1) - uint8_t next_sequence_rep; // next sequence repetition counter (valid if sequence.repeats > 1) - uint8_t led_set; // target led set -} NotifierLedStatus_t; - -#ifdef PIOS_INCLUDE_WS2811 -static bool led_status_initialized = false; -#endif - #ifdef PIOS_LED_ALARM #define ALARM_LED_ON() PIOS_LED_On(PIOS_LED_ALARM) #define ALARM_LED_OFF() PIOS_LED_Off(PIOS_LED_ALARM) @@ -173,7 +143,6 @@ static bool handleNotifications(pios_notify_notification runningNotification, ui static void handleFlightMode(uint16_t *r_pattern, uint16_t *b_pattern); static void handleHeartbeat(uint16_t *r_pattern, uint16_t *b_pattern); -static void HandleExtLeds(); void NotificationUpdateStatus() { @@ -202,8 +171,8 @@ void NotificationOnboardLedsRun() STATUS_LENGHT } status; - HandleExtLeds(); const uint32_t current_timestamp = GET_CURRENT_MILLIS; + if (!started || (current_timestamp - lastRunTimestamp) < LED_BLINK_PERIOD_MS) { return; } @@ -334,212 +303,3 @@ static void handleHeartbeat(uint16_t *r_pattern, uint16_t *b_pattern) *b_pattern = BLINK_B_HEARTBEAT_PATTERN; *r_pattern = BLINK_R_HEARTBEAT_PATTERN; } - -#ifdef PIOS_INCLUDE_WS2811 - -NotifierLedStatus_t led_status[MAX_HANDLED_LED]; - -static void InitExtLed() -{ - memset(led_status, 0, sizeof(NotifierLedStatus_t) * MAX_HANDLED_LED); - const uint32_t now = GET_CURRENT_MILLIS; - for (uint8_t l = 0; l < MAX_HANDLED_LED; l++) { - led_status[l].led_set = l; - led_status[l].next_run_time = now + 500; // start within half a second - for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { - led_status[l].queued_priorities[i] = NOTIFY_PRIORITY_BACKGROUND; - } - } -} - -/** - * restart current sequence - */ -static void restart_sequence(NotifierLedStatus_t *status, bool immediate) -{ - status->next_sequence_step = 0; - status->next_step_rep = 0; - status->step_phase_on = true; - status->running = true; - if (immediate) { - uint32_t currentTime = GET_CURRENT_MILLIS; - status->next_run_time = currentTime; - } - status->sequence_starting_time = status->next_run_time; -} - -/** - * modify background sequence or enqueue a new sequence to play - */ -static void push_queued_sequence(ExtLedNotification_t *new_notification, NotifierLedStatus_t *status) -{ - int8_t updated_sequence = BACKGROUND_SEQUENCE; - - if (new_notification->priority == NOTIFY_PRIORITY_BACKGROUND) { - status->background_sequence = new_notification->sequence; - } else { - // a notification with priority higher than background. - // try to enqueue it - int8_t insert_point = -1; - int8_t first_free = -1; - for (int8_t i = MAX_BACKGROUND_NOTIFICATIONS; i > -1; i--) { - const int8_t priority_i = status->queued_priorities[i]; - if (priority_i == NOTIFY_PRIORITY_BACKGROUND) { - first_free = i; - insert_point = i; - continue; - } - if (priority_i > new_notification->priority) { - insert_point = i; - } - } - - if (insert_point != first_free) { - // there is a free slot, move everything up one place - if (first_free != -1) { - for (uint8_t i = MAX_BACKGROUND_NOTIFICATIONS - 1; i > insert_point; i--) { - status->queued_priorities[i] = status->queued_priorities[i - 1]; - status->queued_sequences[i] = status->queued_sequences[i - 1]; - } - if (status->active_sequence_num >= insert_point) { - status->active_sequence_num++; - } - } else { - // no free space, discard lowest priority notification and move everything down - for (uint8_t i = 0; i < insert_point; i++) { - status->queued_priorities[i] = status->queued_priorities[i + 1]; - status->queued_sequences[i] = status->queued_sequences[i + 1]; - } - if (status->active_sequence_num <= insert_point) { - status->active_sequence_num--; - } - } - } - - status->queued_priorities[insert_point] = new_notification->priority; - status->queued_sequences[insert_point] = new_notification->sequence; - updated_sequence = insert_point; - } - - if (status->active_sequence_num < updated_sequence) { - status->active_sequence_num = updated_sequence; - restart_sequence(status, true); - } - if (updated_sequence == BACKGROUND_SEQUENCE) { - restart_sequence(status, false); - } -} - -static bool pop_queued_sequence(NotifierLedStatus_t *status) -{ - if (status->active_sequence_num != BACKGROUND_SEQUENCE) { - // start the lower priority item - status->queued_priorities[status->active_sequence_num] = NOTIFY_PRIORITY_BACKGROUND; - status->active_sequence_num--; - return true; - } - // background sequence was completed - return false; -} - -/** - * advance current sequence pointers for next step - */ -static void advance_sequence(NotifierLedStatus_t *status) -{ - LedSequence_t *activeSequence = - status->active_sequence_num == BACKGROUND_SEQUENCE ? - &status->background_sequence : &status->queued_sequences[status->active_sequence_num]; - - uint8_t step = status->next_sequence_step; - LedStep_t *currentStep = &activeSequence->steps[step]; - - // Next step will be the OFF phase, so just update the time and - if (status->step_phase_on) { - // next will be the off phase - status->next_run_time += currentStep->time_on; - status->step_phase_on = false; - // check if off phase should be skipped - if (currentStep->time_off != 0) { - return; - } - } - - // next step is ON phase. check whether to repeat current step or move to next one - status->next_run_time += currentStep->time_off; - status->step_phase_on = true; - - if (status->next_step_rep + 1 < currentStep->repeats) { - // setup next repetition - status->next_step_rep++; - return; - } - - // move to next step - LedStep_t *nextStep = (step + 1 < NOTIFY_SEQUENCE_MAX_STEPS) ? &activeSequence->steps[step + 1] : 0; - - // next step is null, check whether sequence must be repeated or it must move to lower priority queued or background sequences - if (NOTIFY_IS_NULL_STEP(nextStep)) { - if (activeSequence->repeats == -1 || status->next_sequence_rep + 1 < activeSequence->repeats) { - status->next_sequence_rep++; - // restart the sequence - restart_sequence(status, false); - return; - } - if (status->active_sequence_num != BACKGROUND_SEQUENCE) { - // no repeat, pop enqueued or background sequences - pop_queued_sequence(status); - restart_sequence(status, false); - } else { - status->running = false; - } - } else { - status->next_step_rep = 0; - status->next_sequence_step++; - } -} - -/** - * run a led set - */ -static void run_led(NotifierLedStatus_t *status) -{ - uint32_t currentTime = GET_CURRENT_MILLIS; - - if (!status->running || currentTime < status->next_run_time) { - return; - } - status->next_run_time = currentTime; - uint8_t step = status->next_sequence_step; - - LedSequence_t *activeSequence = status->active_sequence_num == BACKGROUND_SEQUENCE ? - &status->background_sequence : &status->queued_sequences[status->active_sequence_num]; - if (status->step_phase_on) { - PIOS_WS2811_setColorRGB(activeSequence->steps[step].color, status->led_set, true); - } else { - PIOS_WS2811_setColorRGB(Color_Off, status->led_set, true); - } - advance_sequence(status); -} - -void HandleExtLeds() -{ - // handle incoming sequences - if (!led_status_initialized) { - InitExtLed(); - led_status_initialized = true; - } - static ExtLedNotification_t *newNotification; - newNotification = PIOS_NOTIFY_GetNewExtLedSequence(true); - if (newNotification) { - push_queued_sequence(newNotification, &led_status[0]); - } - - // Run Leds - for (uint8_t i = 0; i < MAX_HANDLED_LED; i++) { - run_led(&led_status[i]); - } -} -#else /* ifdef PIOS_INCLUDE_WS2811 */ -void HandleExtLeds() {} -#endif /* ifdef PIOS_INCLUDE_WS2811 */ diff --git a/flight/modules/System/systemmod.c b/flight/modules/System/systemmod.c index aa6a8f54d..e37168061 100644 --- a/flight/modules/System/systemmod.c +++ b/flight/modules/System/systemmod.c @@ -42,7 +42,11 @@ #include // private includes #include "inc/systemmod.h" -#include "notification.h" + +#include +#ifdef PIOS_INCLUDE_WS2811 +#include +#endif // UAVOs #include @@ -55,6 +59,7 @@ #include #include #include +#include #ifdef PIOS_INCLUDE_INSTRUMENTATION #include @@ -633,6 +638,9 @@ static void updateSystemAlarms() void vApplicationIdleHook(void) { NotificationOnboardLedsRun(); +#ifdef PIOS_INCLUDE_WS2811 + LedNotificationExtLedsRun(); +#endif } /** * Called by the RTOS when a stack overflow is detected. diff --git a/flight/targets/boards/discoveryf4bare/firmware/Makefile b/flight/targets/boards/discoveryf4bare/firmware/Makefile index 608d2b6cf..29cf57378 100644 --- a/flight/targets/boards/discoveryf4bare/firmware/Makefile +++ b/flight/targets/boards/discoveryf4bare/firmware/Makefile @@ -87,6 +87,7 @@ ifndef TESTAPP SRC += $(FLIGHTLIB)/plans.c SRC += $(FLIGHTLIB)/WorldMagModel.c SRC += $(FLIGHTLIB)/insgps13state.c + SRC += $(FLIGHTLIB)/lednotification.c ## UAVObjects include ./UAVObjects.inc diff --git a/flight/targets/boards/revolution/firmware/Makefile b/flight/targets/boards/revolution/firmware/Makefile index cb99372f1..e4220ade0 100644 --- a/flight/targets/boards/revolution/firmware/Makefile +++ b/flight/targets/boards/revolution/firmware/Makefile @@ -88,6 +88,7 @@ ifndef TESTAPP SRC += $(FLIGHTLIB)/plans.c SRC += $(FLIGHTLIB)/WorldMagModel.c SRC += $(FLIGHTLIB)/insgps13state.c + SRC += $(FLIGHTLIB)/lednotification.c ## UAVObjects include ./UAVObjects.inc From 376aa0052f212412b5ad2c83e24c97868767fa00 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Wed, 13 Aug 2014 15:18:17 +0200 Subject: [PATCH 05/27] OP-1379 - Initial Notify module. Supports: 1) predefined seqences associated with each flightmode. 2) fixed table with alarm index and assciated led warn/error sequences/repetition rate. --- flight/modules/Notify/inc/notify.h | 33 ++ flight/modules/Notify/inc/sequences.h | 417 ++++++++++++++++++ flight/modules/Notify/notify.c | 142 ++++++ .../boards/revolution/firmware/Makefile | 1 + 4 files changed, 593 insertions(+) create mode 100644 flight/modules/Notify/inc/notify.h create mode 100644 flight/modules/Notify/inc/sequences.h create mode 100644 flight/modules/Notify/notify.c diff --git a/flight/modules/Notify/inc/notify.h b/flight/modules/Notify/inc/notify.h new file mode 100644 index 000000000..1b779bf27 --- /dev/null +++ b/flight/modules/Notify/inc/notify.h @@ -0,0 +1,33 @@ +/** + ****************************************************************************** + * + * @file notify.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Notify module, show events and status on external led. + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef NOTIFY_H_ +#define NOTIFY_H_ + + +int32_t NotifyInitialize(void); + + +#endif /* NOTIFY_H_ */ diff --git a/flight/modules/Notify/inc/sequences.h b/flight/modules/Notify/inc/sequences.h new file mode 100644 index 000000000..ebb9bafb6 --- /dev/null +++ b/flight/modules/Notify/inc/sequences.h @@ -0,0 +1,417 @@ +/** + ****************************************************************************** + * + * @file sequences.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Notify module, sequences configuration. + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef SEQUENCES_H_ +#define SEQUENCES_H_ +#include +#include +#include +#include +#include + +typedef enum { + NOTIFY_SEQUENCE_ARMED_FM_MANUAL = 0, + NOTIFY_SEQUENCE_ARMED_FM_STABILIZED1 = 1, + NOTIFY_SEQUENCE_ARMED_FM_STABILIZED2 = 2, + NOTIFY_SEQUENCE_ARMED_FM_STABILIZED3 = 3, + NOTIFY_SEQUENCE_ARMED_FM_STABILIZED4 = 4, + NOTIFY_SEQUENCE_ARMED_FM_STABILIZED5 = 5, + NOTIFY_SEQUENCE_ARMED_FM_STABILIZED6 = 6, + NOTIFY_SEQUENCE_ARMED_FM_AUTOTUNE = 7, + NOTIFY_SEQUENCE_ARMED_FM_GPS = 8, + NOTIFY_SEQUENCE_ARMED_FM_RTH = 9, + NOTIFY_SEQUENCE_ARMED_FM_LAND = 10, + NOTIFY_SEQUENCE_ARMED_FM_AUTO = 11, + NOTIFY_SEQUENCE_ALM_WARN_GPS = 12, + NOTIFY_SEQUENCE_ALM_ERROR_GPS = 13, + NOTIFY_SEQUENCE_ALM_WARN_BATTERY = 14, + NOTIFY_SEQUENCE_ALM_ERROR_BATTERY = 15, + NOTIFY_SEQUENCE_ALM_MAG = 16, + NOTIFY_SEQUENCE_ALM_CONFIG = 17, + NOTIFY_SEQUENCE_DISARMED = 18, +} NotifySequences; + +typedef struct { + uint32_t timeBetweenNotifications; + uint8_t alarmIndex; + uint8_t warnNotification; + uint8_t errorNotification; +} AlarmDefinition_t; + +// consts +const LedSequence_t notifications[] = { + [NOTIFY_SEQUENCE_DISARMED] = { + .repeats = -1, + .steps = { + { + .time_off = 1000, + .time_on = 1000, + .color = COLOR_BLUE, + .repeats = 1, + }, + { + .time_off = 1000, + .time_on = 1000, + .color = COLOR_LIME, + .repeats = 1, + }, + { + .time_off = 1000, + .time_on = 1000, + .color = COLOR_RED, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ARMED_FM_MANUAL] = { + .repeats = -1, + .steps = { + { + .time_off = 900, + .time_on = 100, + .color = COLOR_YELLOW, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED1] = { + .repeats = -1, + .steps = { + { + .time_off = 900, + .time_on = 100, + .color = COLOR_BLUE, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED2] = { + .repeats = -1, + .steps = { + { + .time_off = 100, + .time_on = 100, + .color = COLOR_BLUE, + .repeats = 1, + }, + { + .time_off = 700, + .time_on = 100, + .color = COLOR_BLUE, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED3] = { + .repeats = -1, + .steps = { + { + .time_off = 100, + .time_on = 100, + .color = COLOR_BLUE, + .repeats = 2, + }, + { + .time_off = 500, + .time_on = 100, + .color = COLOR_BLUE, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED4] = { + .repeats = -1, + .steps = { + { + .time_off = 900, + .time_on = 100, + .color = COLOR_PURPLE, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED5] = { + .repeats = -1, + .steps = { + { + .time_off = 100, + .time_on = 100, + .color = COLOR_PURPLE, + .repeats = 1, + }, + { + .time_off = 700, + .time_on = 100, + .color = COLOR_BLUE, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED6] = { + .repeats = -1, + .steps = { + { + .time_off = 100, + .time_on = 100, + .color = COLOR_PURPLE, + .repeats = 1, + }, + { + .time_off = 100, + .time_on = 100, + .color = COLOR_PURPLE, + .repeats = 1, + }, + { + .time_off = 500, + .time_on = 100, + .color = COLOR_BLUE, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ARMED_FM_AUTOTUNE] = { + .repeats = -1, + .steps = { + { + .time_off = 800, + .time_on = 200, + .color = COLOR_BLUE, + .repeats = 1, + }, + }, + }, + + [NOTIFY_SEQUENCE_ARMED_FM_GPS] = { + .repeats = -1, + .steps = { + { + .time_off = 800, + .time_on = 200, + .color = COLOR_GREEN, + .repeats = 1, + }, + }, + }, + + [NOTIFY_SEQUENCE_ARMED_FM_RTH] = { + .repeats = -1, + .steps = { + { + .time_off = 100, + .time_on = 200, + .color = COLOR_GREEN, + .repeats = 1, + }, + { + .time_off = 500, + .time_on = 200, + .color = COLOR_GREEN, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ARMED_FM_LAND] = { + .repeats = -1, + .steps = { + { + .time_off = 100, + .time_on = 200, + .color = COLOR_GREEN, + .repeats = 1, + }, + { + .time_off = 100, + .time_on = 200, + .color = COLOR_BLUE, + .repeats = 1, + }, + { + .time_off = 100, + .time_on = 200, + .color = COLOR_GREEN, + .repeats = 1, + }, + { + .time_off = 100, + .time_on = 200, + .color = COLOR_BLUE, + .repeats = 1, + }, + { + .time_off = 100, + .time_on = 200, + .color = COLOR_GREEN, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ARMED_FM_AUTO] = { + .repeats = -1, + .steps = { + { + .time_off = 100, + .time_on = 200, + .color = COLOR_GREEN, + .repeats = 2, + }, + { + .time_off = 500, + .time_on = 200, + .color = COLOR_GREEN, + .repeats = 1, + }, + }, + }, + + [NOTIFY_SEQUENCE_ALM_WARN_GPS] = { + .repeats = 2, + .steps = { + { + .time_off = 300, + .time_on = 300, + .color = COLOR_ORANGE, + .repeats = 2, + }, + { + .time_off = 300, + .time_on = 300, + .color = COLOR_YELLOW, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ALM_ERROR_GPS] = { + .repeats = 2, + .steps = { + { + .time_off = 300, + .time_on = 300, + .color = COLOR_RED, + .repeats = 2, + }, + { + .time_off = 300, + .time_on = 300, + .color = COLOR_YELLOW, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ALM_WARN_BATTERY] = { + .repeats = 1, + .steps = { + { + .time_off = 100, + .time_on = 100, + .color = COLOR_ORANGE, + .repeats = 10, + }, + }, + }, + [NOTIFY_SEQUENCE_ALM_ERROR_BATTERY] = { + .repeats = 1, + .steps = { + { + .time_off = 100, + .time_on = 100, + .color = COLOR_RED, + .repeats = 10, + }, + }, + }, + [NOTIFY_SEQUENCE_ALM_MAG] = { + .repeats = 1, + .steps = { + { + .time_off = 300, + .time_on = 300, + .color = COLOR_RED, + .repeats = 2, + }, + { + .time_off = 300, + .time_on = 300, + .color = COLOR_GREEN, + .repeats = 1, + }, + }, + }, + [NOTIFY_SEQUENCE_ALM_CONFIG] = { + .repeats = -1, + .steps = { + { + .time_off = 500, + .time_on = 100, + .color = COLOR_RED, + .repeats = 1, + }, + }, + }, +}; + +const LedSequence_t *flightModeMap[] = { + [FLIGHTSTATUS_FLIGHTMODE_MANUAL] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_MANUAL], + [FLIGHTSTATUS_FLIGHTMODE_STABILIZED1] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED1], + [FLIGHTSTATUS_FLIGHTMODE_STABILIZED2] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED2], + [FLIGHTSTATUS_FLIGHTMODE_STABILIZED3] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED3], + [FLIGHTSTATUS_FLIGHTMODE_STABILIZED4] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED4], + [FLIGHTSTATUS_FLIGHTMODE_STABILIZED5] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED5], + [FLIGHTSTATUS_FLIGHTMODE_STABILIZED6] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED6], + [FLIGHTSTATUS_FLIGHTMODE_PATHPLANNER] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_AUTO], + [FLIGHTSTATUS_FLIGHTMODE_AUTOTUNE] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_AUTOTUNE], + [FLIGHTSTATUS_FLIGHTMODE_POSITIONHOLD] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS], + [FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOFPV] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS], + [FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOLOS] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS], + [FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIONSEW] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS], + [FLIGHTSTATUS_FLIGHTMODE_RETURNTOBASE] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_RTH], + [FLIGHTSTATUS_FLIGHTMODE_LAND] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_LAND], + [FLIGHTSTATUS_FLIGHTMODE_POI] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS], + [FLIGHTSTATUS_FLIGHTMODE_AUTOCRUISE] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS], +}; + +const AlarmDefinition_t alarmsMap[] = { + { + .timeBetweenNotifications = 10000, + .alarmIndex = SYSTEMALARMS_ALARM_GPS, + .warnNotification = NOTIFY_SEQUENCE_ALM_WARN_GPS, + .errorNotification = NOTIFY_SEQUENCE_ALM_ERROR_GPS, + }, + { + .timeBetweenNotifications = 15000, + .alarmIndex = SYSTEMALARMS_ALARM_MAGNETOMETER, + .warnNotification = NOTIFY_SEQUENCE_ALM_MAG, + .errorNotification = NOTIFY_SEQUENCE_ALM_MAG, + }, + { + .timeBetweenNotifications = 15000, + .alarmIndex = SYSTEMALARMS_ALARM_BATTERY, + .warnNotification = NOTIFY_SEQUENCE_ALM_WARN_BATTERY, + .errorNotification = NOTIFY_SEQUENCE_ALM_ERROR_BATTERY, + }, +}; +const uint8_t alarmsMapSize = NELEMENTS(alarmsMap); + +#endif /* SEQUENCES_H_ */ diff --git a/flight/modules/Notify/notify.c b/flight/modules/Notify/notify.c new file mode 100644 index 000000000..a944690cb --- /dev/null +++ b/flight/modules/Notify/notify.c @@ -0,0 +1,142 @@ +/** + ****************************************************************************** + * + * @file notify.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Notify module, show events and status on external led. + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** + * Input objects: ExampleObject1, ExampleSettings + * Output object: ExampleObject2 + * + * This module executes in response to ExampleObject1 updates. When the + * module is triggered it will update the data of ExampleObject2. + * + * No threads are used in this example. + * + * UAVObjects are automatically generated by the UAVObjectGenerator from + * the object definition XML file. + * + * Modules have no API, all communication to other modules is done through UAVObjects. + * However modules may use the API exposed by shared libraries. + * See the OpenPilot wiki for more details. + * http://www.openpilot.org/OpenPilot_Application_Architecture + * + */ +#include "openpilot.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "inc/notify.h" +#include "inc/sequences.h" +#include + +#define SAMPLE_PERIOD_MS 250 +// private types +typedef struct { + uint32_t lastAlarmTime; + uint8_t lastAlarm; +} AlarmStatus_t; +// function declarations +static void updatedCb(UAVObjEvent *ev); +static void onTimerCb(UAVObjEvent *ev); +static void checkAlarm(uint8_t alarm, uint8_t *last_alarm, uint32_t *last_alm_time, + uint8_t warn_sequence, uint8_t error_sequence, + uint32_t timeBetweenNotifications); +static AlarmStatus_t *alarmStatus; +int32_t NotifyInitialize(void) +{ + alarmStatus = (AlarmStatus_t *)pios_malloc(sizeof(AlarmStatus_t) * alarmsMapSize); + for (uint8_t i = 0; i < alarmsMapSize; i++) { + alarmStatus[i].lastAlarm = SYSTEMALARMS_ALARM_OK; + alarmStatus[i].lastAlarmTime = 0; + } + + FlightStatusConnectCallback(&updatedCb); + updatedCb(0); + static UAVObjEvent ev; + memset(&ev, 0, sizeof(UAVObjEvent)); + EventPeriodicCallbackCreate(&ev, onTimerCb, SAMPLE_PERIOD_MS / portTICK_RATE_MS); + return 0; +} +MODULE_INITCALL(NotifyInitialize, 0); + + +void updatedCb(UAVObjEvent *ev) +{ + if (!ev || ev->obj == FlightStatusHandle()) { + static uint8_t last_armed = 0xff; + static uint8_t last_flightmode = 0xff; + uint8_t armed; + uint8_t flightmode; + FlightStatusArmedGet(&armed); + FlightStatusFlightModeGet(&flightmode); + if (last_armed != armed || (armed && flightmode != last_flightmode)) { + if (armed) { + PIOS_NOTIFICATION_Default_Ext_Led_Play(flightModeMap[flightmode], NOTIFY_PRIORITY_BACKGROUND); + } else { + PIOS_NOTIFICATION_Default_Ext_Led_Play(¬ifications[NOTIFY_SEQUENCE_DISARMED], NOTIFY_PRIORITY_BACKGROUND); + } + } + last_armed = armed; + last_flightmode = flightmode; + } +} + +void onTimerCb(__attribute__((unused)) UAVObjEvent *ev) +{ + static SystemAlarmsAlarmData alarms; + + SystemAlarmsAlarmGet(&alarms); + for (uint8_t i = 0; i < alarmsMapSize; i++) { + uint8_t alarm = ((uint8_t *)&alarms)[alarmsMap[i].alarmIndex]; + checkAlarm(alarm, + &alarmStatus[i].lastAlarm, + &alarmStatus[i].lastAlarmTime, + alarmsMap[i].warnNotification, + alarmsMap[i].errorNotification, + alarmsMap[i].timeBetweenNotifications); + } +} + +void checkAlarm(uint8_t alarm, uint8_t *last_alarm, uint32_t *last_alm_time, uint8_t warn_sequence, uint8_t error_sequence, uint32_t timeBetweenNotifications) +{ + if (alarm > SYSTEMALARMS_ALARM_OK) { + uint32_t current_time = PIOS_DELAY_GetuS(); + if (*last_alarm < alarm || *last_alm_time + timeBetweenNotifications < current_time) { + uint8_t sequence = (alarm == SYSTEMALARMS_ALARM_WARNING) ? warn_sequence : error_sequence; + PIOS_NOTIFICATION_Default_Ext_Led_Play( + ¬ifications[sequence], + alarm == SYSTEMALARMS_ALARM_WARNING ? NOTIFY_PRIORITY_REGULAR : NOTIFY_PRIORITY_CRITICAL); + *last_alarm = alarm; + *last_alm_time = current_time; + } + } else { + *last_alarm = SYSTEMALARMS_ALARM_OK; + } +} diff --git a/flight/targets/boards/revolution/firmware/Makefile b/flight/targets/boards/revolution/firmware/Makefile index e4220ade0..b544ab4dd 100644 --- a/flight/targets/boards/revolution/firmware/Makefile +++ b/flight/targets/boards/revolution/firmware/Makefile @@ -50,6 +50,7 @@ MODULES += FixedWingPathFollower MODULES += Osd/osdoutout MODULES += Logging MODULES += Telemetry +MODULES += Notify OPTMODULES += ComUsbBridge From e549c71da671783cd23c93d0ff5c84165967aac8 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Wed, 3 Sep 2014 21:14:54 +0200 Subject: [PATCH 06/27] OP-1379 - add unit testing --- Makefile | 2 +- flight/tests/lednotification/FreeRTOS.h | 1 + flight/tests/lednotification/Makefile | 41 ++++++++++ flight/tests/lednotification/openpilot.h | 11 +++ flight/tests/lednotification/pios.h | 13 ++++ flight/tests/lednotification/pios_config.h | 6 ++ flight/tests/lednotification/pios_mem.h | 34 ++++++++ flight/tests/lednotification/unittest.cpp | 90 ++++++++++++++++++++++ make/unittest.mk | 4 + 9 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 flight/tests/lednotification/FreeRTOS.h create mode 100644 flight/tests/lednotification/Makefile create mode 100644 flight/tests/lednotification/openpilot.h create mode 100644 flight/tests/lednotification/pios.h create mode 100644 flight/tests/lednotification/pios_config.h create mode 100644 flight/tests/lednotification/pios_mem.h create mode 100644 flight/tests/lednotification/unittest.cpp diff --git a/Makefile b/Makefile index 48cb90043..219ab95ae 100644 --- a/Makefile +++ b/Makefile @@ -638,7 +638,7 @@ uavo-collections_clean: # ############################## -ALL_UNITTESTS := logfs +ALL_UNITTESTS := logfs lednotification # Build the directory for the unit tests UT_OUT_DIR := $(BUILD_DIR)/unit_tests diff --git a/flight/tests/lednotification/FreeRTOS.h b/flight/tests/lednotification/FreeRTOS.h new file mode 100644 index 000000000..c8b49f26d --- /dev/null +++ b/flight/tests/lednotification/FreeRTOS.h @@ -0,0 +1 @@ +#include diff --git a/flight/tests/lednotification/Makefile b/flight/tests/lednotification/Makefile new file mode 100644 index 000000000..d013f5b83 --- /dev/null +++ b/flight/tests/lednotification/Makefile @@ -0,0 +1,41 @@ +############################################################################### +# @file Makefile +# @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012 +# Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org +# @addtogroup +# @{ +# @addtogroup +# @{ +# @brief Makefile for unit test +############################################################################### +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) +endif + +include $(ROOT_DIR)/make/firmware-defs.mk + +EXTRAINCDIRS += $(TOPDIR) +EXTRAINCDIRS += $(PIOS)/inc +EXTRAINCDIRS += $(FLIGHTLIB)/inc +EXTRAINCDIRS += $(FLIGHTLIB) + +SRC += $(FLIGHTLIB)/optypes.c +SRC += $(PIOS)/common/pios_notify.c + +include $(ROOT_DIR)/make/unittest.mk diff --git a/flight/tests/lednotification/openpilot.h b/flight/tests/lednotification/openpilot.h new file mode 100644 index 000000000..4c2259d19 --- /dev/null +++ b/flight/tests/lednotification/openpilot.h @@ -0,0 +1,11 @@ +#ifndef OPENPILOT_H +#define OPENPILOT_H + +#include + +#define PIOS_Assert(x) \ + if (!(x)) { while (1) {; } \ + } +#define PIOS_DEBUG_Assert(x) PIOS_Assert(x) + +#endif /* OPENPILOT_H */ diff --git a/flight/tests/lednotification/pios.h b/flight/tests/lednotification/pios.h new file mode 100644 index 000000000..12cd5e76a --- /dev/null +++ b/flight/tests/lednotification/pios.h @@ -0,0 +1,13 @@ +#ifndef PIOS_H +#define PIOS_H + +/* PIOS Feature Selection */ +#include "pios_config.h" + +#ifdef PIOS_INCLUDE_FREERTOS +/* FreeRTOS Includes */ +#include "FreeRTOS.h" +#endif +#include "pios_mem.h" + +#endif /* PIOS_H */ diff --git a/flight/tests/lednotification/pios_config.h b/flight/tests/lednotification/pios_config.h new file mode 100644 index 000000000..2a645e951 --- /dev/null +++ b/flight/tests/lednotification/pios_config.h @@ -0,0 +1,6 @@ +#ifndef PIOS_CONFIG_H +#define PIOS_CONFIG_H + +#define PIOS_INCLUDE_FREERTOS + +#endif /* PIOS_CONFIG_H */ diff --git a/flight/tests/lednotification/pios_mem.h b/flight/tests/lednotification/pios_mem.h new file mode 100644 index 000000000..279ce5aef --- /dev/null +++ b/flight/tests/lednotification/pios_mem.h @@ -0,0 +1,34 @@ +/** + ****************************************************************************** + * + * @file pios_mem.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @addtogroup PiOS + * @{ + * @addtogroup PiOS + * @{ + * @brief PiOS memory allocation API + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef PIOS_MEM_H +#define PIOS_MEM_H + +#define pios_fastheapmalloc(size) (malloc(size)) +#define pios_malloc(size) (malloc(size)) +#define pios_free(p) (free(p)) + +#endif /* PIOS_MEM_H */ diff --git a/flight/tests/lednotification/unittest.cpp b/flight/tests/lednotification/unittest.cpp new file mode 100644 index 000000000..80ef7d8a4 --- /dev/null +++ b/flight/tests/lednotification/unittest.cpp @@ -0,0 +1,90 @@ +#include "gtest/gtest.h" + +#include /* printf */ +#include /* abort */ +#include /* memset */ + +extern "C" { +#define xTaskGetTickCount() 1 +#define portTICK_RATE_MS 1 + +#include "lednotification.c" + +void PIOS_WS2811_setColorRGB(__attribute__((unused)) Color_t c, __attribute__((unused)) uint8_t led, __attribute__((unused)) bool update){ + +} +void PIOS_WS2811_Update(){ + +} +} + +class LedNotificationTest : public testing::Test {}; + +TEST_F(LedNotificationTest, TestQueueOrder1) { + NotifierLedStatus_t status; + + for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { + status.queued_priorities[i] = NOTIFY_PRIORITY_BACKGROUND; + } + + + ExtLedNotification_t notification0; + notification0.priority = NOTIFY_PRIORITY_LOW; + push_queued_sequence(¬ification0, &status); + ExtLedNotification_t notification1; + notification1.priority = NOTIFY_PRIORITY_CRITICAL; + push_queued_sequence(¬ification1, &status); + ExtLedNotification_t notification2; + notification2.priority = NOTIFY_PRIORITY_LOW; + push_queued_sequence(¬ification2, &status); + ExtLedNotification_t notification3; + notification3.priority = NOTIFY_PRIORITY_CRITICAL; + push_queued_sequence(¬ification3, &status); + + EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[0]); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[1]); + EXPECT_EQ(NOTIFY_PRIORITY_CRITICAL, status.queued_priorities[2]); + EXPECT_EQ(NOTIFY_PRIORITY_CRITICAL, status.queued_priorities[3]); + EXPECT_EQ(NOTIFY_PRIORITY_BACKGROUND, status.queued_priorities[4]); + +} + +TEST_F(LedNotificationTest, TestQueueOrder2) { + NotifierLedStatus_t status; + +// Fails because insert_point and first_point will both be -1. This will also cause an array-out-of bounds at: +// 146 status->queued_priorities[insert_point] = new_notification->priority; +// 147 status->queued_sequences[insert_point] = new_notification->sequence; +// 148 updated_sequence = insert_point; + + for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { + status.queued_priorities[i] = NOTIFY_PRIORITY_LOW; + } + + ExtLedNotification_t notification; + notification.priority = NOTIFY_PRIORITY_REGULAR; + push_queued_sequence(¬ification, &status); + + EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[4]); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[3]); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[2]); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[1]); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[0]); +} + +TEST_F(LedNotificationTest, TestQueueOrder3) { + NotifierLedStatus_t status; + + // Fails because queued_priorities[0] _LOW and not _REGULAR. I _think_ this is a bug. + for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { + status.queued_priorities[i] = NOTIFY_PRIORITY_REGULAR; + } + + ExtLedNotification_t notification; + notification.priority = NOTIFY_PRIORITY_LOW; + push_queued_sequence(¬ification, &status); + + for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { + EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[i]); + } +} diff --git a/make/unittest.mk b/make/unittest.mk index 5963f5567..2190a6ab4 100644 --- a/make/unittest.mk +++ b/make/unittest.mk @@ -52,6 +52,10 @@ CXXFLAGS += -g -Wall -Wextra # Flags passed to the C compiler CONLYFLAGS += -std=gnu99 +# UNIT_TEST allows to for example to have optional test fixture code enabled or private code exposed in application modules. +CFLAGS += -DUNIT_TEST +CPPFLAGS += -DUNIT_TEST + # Common compiler flags CFLAGS += -O0 -g CFLAGS += -Wall -Werror From 233dec6d8d753cba97ef4db9a14baacb1a5bce56 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Mon, 18 Aug 2014 16:35:02 +0200 Subject: [PATCH 07/27] OP-1379 - Various fixes and additions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Support blocks of led for notification (that is a certain number of leds between a min and a max index); - Fix an issue with bogus colours on fast updates at LED N°0. - Add NOTIFY_SEQUENCE_NULL to skip handling a specific alarm status; - Adjust sequences and add Config and Receiver Alarms; - fix issue with Alarm trigger/repetition; - Enables Notify module only if a WS281x output is enabled. - Add some documentation for sequence/alarm definitions (sequences.h) - Make sequences more coherent. All GPS related info are now shown in green. - Revert to original blinking rate for onboard led - add Notify on DiscoveryF4Bare target --- flight/libraries/inc/notification.h | 2 +- flight/libraries/lednotification.c | 31 +- flight/modules/Notify/inc/sequences.h | 435 +++++------------- flight/modules/Notify/notify.c | 42 +- flight/pios/inc/pios_ws2811_cfg.h | 1 - flight/pios/stm32f4xx/pios_ws2811.c | 8 + .../boards/discoveryf4bare/firmware/Makefile | 1 + flight/tests/lednotification/unittest.cpp | 77 ++-- 8 files changed, 219 insertions(+), 378 deletions(-) diff --git a/flight/libraries/inc/notification.h b/flight/libraries/inc/notification.h index 2053a9609..2091d9189 100644 --- a/flight/libraries/inc/notification.h +++ b/flight/libraries/inc/notification.h @@ -27,7 +27,7 @@ #define NOTIFICATION_H // period of each blink phase -#define LED_BLINK_PERIOD_MS 200 +#define LED_BLINK_PERIOD_MS 50 // update the status snapshot used by notifcations void NotificationUpdateStatus(); diff --git a/flight/libraries/lednotification.c b/flight/libraries/lednotification.c index b2ca13597..4b5950d17 100644 --- a/flight/libraries/lednotification.c +++ b/flight/libraries/lednotification.c @@ -27,8 +27,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -57,7 +57,8 @@ typedef struct { uint8_t next_sequence_step; // (step number to be executed) << 1 || (0x00 = on phase, 0x01 = off phase) uint8_t next_step_rep; // next repetition number for next step (valid if step.repeats >1) uint8_t next_sequence_rep; // next sequence repetition counter (valid if sequence.repeats > 1) - uint8_t led_set; // target led set + uint8_t led_set_start; // first target led for this set + uint8_t led_set_end; // last target led for this set } NotifierLedStatus_t; static bool led_status_initialized = false; @@ -69,7 +70,8 @@ static void InitExtLed() memset(led_status, 0, sizeof(NotifierLedStatus_t) * MAX_HANDLED_LED); const uint32_t now = GET_CURRENT_MILLIS; for (uint8_t l = 0; l < MAX_HANDLED_LED; l++) { - led_status[l].led_set = 0; + led_status[l].led_set_start = 0; + led_status[l].led_set_end = PIOS_WS2811_NUMLEDS - 1; led_status[l].next_run_time = now + 500; // start within half a second for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { led_status[l].queued_priorities[i] = NOTIFY_PRIORITY_BACKGROUND; @@ -105,9 +107,9 @@ static void push_queued_sequence(ExtLedNotification_t *new_notification, Notifie } else { // a notification with priority higher than background. // try to enqueue it - int8_t insert_point = -1; + int8_t insert_point = MAX_BACKGROUND_NOTIFICATIONS - 1; int8_t first_free = -1; - for (int8_t i = MAX_BACKGROUND_NOTIFICATIONS; i > -1; i--) { + for (int8_t i = MAX_BACKGROUND_NOTIFICATIONS - 1; i >= 0; i--) { const int8_t priority_i = status->queued_priorities[i]; if (priority_i == NOTIFY_PRIORITY_BACKGROUND) { first_free = i; @@ -115,10 +117,14 @@ static void push_queued_sequence(ExtLedNotification_t *new_notification, Notifie continue; } if (priority_i > new_notification->priority) { - insert_point = i; + insert_point = ((i > 0) || (first_free > -1)) ? i : -1; // check whether priority is no bigger than lowest queued priority } } + // no space left on queue for this new notification, ignore. + if (insert_point < 0) { + return; + } if (insert_point != first_free) { // there is a free slot, move everything up one place if (first_free != -1) { @@ -230,7 +236,7 @@ static void advance_sequence(NotifierLedStatus_t *status) */ static void run_led(NotifierLedStatus_t *status) { - uint32_t currentTime = GET_CURRENT_MILLIS; + const uint32_t currentTime = GET_CURRENT_MILLIS; if (!status->running || currentTime < status->next_run_time) { return; @@ -240,11 +246,12 @@ static void run_led(NotifierLedStatus_t *status) LedSequence_t *activeSequence = status->active_sequence_num == BACKGROUND_SEQUENCE ? &status->background_sequence : &status->queued_sequences[status->active_sequence_num]; - if (status->step_phase_on) { - PIOS_WS2811_setColorRGB(activeSequence->steps[step].color, status->led_set, true); - } else { - PIOS_WS2811_setColorRGB(Color_Off, status->led_set, true); + const Color_t color = status->step_phase_on ? activeSequence->steps[step].color : Color_Off; + + for (uint8_t i = status->led_set_start; i <= status->led_set_end; i++) { + PIOS_WS2811_setColorRGB(color, i, false); } + PIOS_WS2811_Update(); advance_sequence(status); } diff --git a/flight/modules/Notify/inc/sequences.h b/flight/modules/Notify/inc/sequences.h index ebb9bafb6..c28f90c15 100644 --- a/flight/modules/Notify/inc/sequences.h +++ b/flight/modules/Notify/inc/sequences.h @@ -31,6 +31,7 @@ #include #include +// This represent the list of basic light sequences, defined later typedef enum { NOTIFY_SEQUENCE_ARMED_FM_MANUAL = 0, NOTIFY_SEQUENCE_ARMED_FM_STABILIZED1 = 1, @@ -48,330 +49,120 @@ typedef enum { NOTIFY_SEQUENCE_ALM_ERROR_GPS = 13, NOTIFY_SEQUENCE_ALM_WARN_BATTERY = 14, NOTIFY_SEQUENCE_ALM_ERROR_BATTERY = 15, - NOTIFY_SEQUENCE_ALM_MAG = 16, + NOTIFY_SEQUENCE_ALM_MAG = 16, NOTIFY_SEQUENCE_ALM_CONFIG = 17, - NOTIFY_SEQUENCE_DISARMED = 18, + NOTIFY_SEQUENCE_ALM_RECEIVER = 18, + NOTIFY_SEQUENCE_DISARMED = 19, + NOTIFY_SEQUENCE_NULL = 255, // skips any signalling for this condition } NotifySequences; +// This structure determine sequences attached to an alarm typedef struct { - uint32_t timeBetweenNotifications; - uint8_t alarmIndex; - uint8_t warnNotification; - uint8_t errorNotification; + uint32_t timeBetweenNotifications; // time in milliseconds to wait between each notification iteration + uint8_t alarmIndex; // Index of the alarm, use one of the SYSTEMALARMS_ALARM_XXXXX defines + uint8_t warnNotification; // index of the sequence to be used when alarm is in warning status(pick one from NotifySequences enum) + uint8_t errorNotification; // index of the sequence to be used when alarm is in error status(pick one from NotifySequences enum) } AlarmDefinition_t; -// consts + +// This is the list of defined light sequences +/* how each sequence is defined + * [NOTIFY_SEQUENCE_DISARMED] = { // Sequence ID + .repeats = -1, // Number of repetitions or -1 for infinite + .steps = { // List of steps (until NOTIFY_SEQUENCE_MAX_STEPS steps, default to 5) + { + .time_off = 500, // Off time for the step + .time_on = 500, // On time for the step + .color = COLOR_TEAL, // color + .repeats = 1, // repetitions for this step + }, + }, + }, + * + * There are two kind of sequences: + * - "Background" sequences, executed if no higher priority sequence is played; + * - "Alarm" sequences, that are "modal", they temporarily suspends background sequences and plays. + * Cannot have "-1" repetitions + * At the end background sequence are resumed; + * + */ const LedSequence_t notifications[] = { - [NOTIFY_SEQUENCE_DISARMED] = { - .repeats = -1, - .steps = { - { - .time_off = 1000, - .time_on = 1000, - .color = COLOR_BLUE, - .repeats = 1, - }, - { - .time_off = 1000, - .time_on = 1000, - .color = COLOR_LIME, - .repeats = 1, - }, - { - .time_off = 1000, - .time_on = 1000, - .color = COLOR_RED, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ARMED_FM_MANUAL] = { - .repeats = -1, - .steps = { - { - .time_off = 900, - .time_on = 100, - .color = COLOR_YELLOW, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED1] = { - .repeats = -1, - .steps = { - { - .time_off = 900, - .time_on = 100, - .color = COLOR_BLUE, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED2] = { - .repeats = -1, - .steps = { - { - .time_off = 100, - .time_on = 100, - .color = COLOR_BLUE, - .repeats = 1, - }, - { - .time_off = 700, - .time_on = 100, - .color = COLOR_BLUE, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED3] = { - .repeats = -1, - .steps = { - { - .time_off = 100, - .time_on = 100, - .color = COLOR_BLUE, - .repeats = 2, - }, - { - .time_off = 500, - .time_on = 100, - .color = COLOR_BLUE, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED4] = { - .repeats = -1, - .steps = { - { - .time_off = 900, - .time_on = 100, - .color = COLOR_PURPLE, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED5] = { - .repeats = -1, - .steps = { - { - .time_off = 100, - .time_on = 100, - .color = COLOR_PURPLE, - .repeats = 1, - }, - { - .time_off = 700, - .time_on = 100, - .color = COLOR_BLUE, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED6] = { - .repeats = -1, - .steps = { - { - .time_off = 100, - .time_on = 100, - .color = COLOR_PURPLE, - .repeats = 1, - }, - { - .time_off = 100, - .time_on = 100, - .color = COLOR_PURPLE, - .repeats = 1, - }, - { - .time_off = 500, - .time_on = 100, - .color = COLOR_BLUE, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ARMED_FM_AUTOTUNE] = { - .repeats = -1, - .steps = { - { - .time_off = 800, - .time_on = 200, - .color = COLOR_BLUE, - .repeats = 1, - }, - }, - }, + [NOTIFY_SEQUENCE_DISARMED] = { .repeats = -1, .steps = { + { .time_off = 500, .time_on = 500, .color = COLOR_TEAL, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_MANUAL] = { .repeats = -1, .steps = { + { .time_off = 900, .time_on = 100, .color = COLOR_YELLOW, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED1] = { .repeats = -1, .steps = { + { .time_off = 900, .time_on = 100, .color = COLOR_BLUE, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED2] = { .repeats = -1, .steps = { + { .time_off = 100, .time_on = 100, .color = COLOR_BLUE, .repeats = 1, }, + { .time_off = 700, .time_on = 100, .color = COLOR_BLUE, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED3] = { .repeats = -1, .steps = { + { .time_off = 100, .time_on = 100, .color = COLOR_BLUE, .repeats = 2, }, + { .time_off = 500, .time_on = 100, .color = COLOR_BLUE, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED4] = { .repeats = -1, .steps = { + { .time_off = 900, .time_on = 100, .color = COLOR_PURPLE, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED5] = { .repeats = -1, .steps = { + { .time_off = 100, .time_on = 100, .color = COLOR_PURPLE, .repeats = 1, }, + { .time_off = 700, .time_on = 100, .color = COLOR_BLUE, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_STABILIZED6] = { .repeats = -1, .steps = { + { .time_off = 100, .time_on = 100, .color = COLOR_PURPLE, .repeats = 1, }, + { .time_off = 100, .time_on = 100, .color = COLOR_PURPLE, .repeats = 1, }, + { .time_off = 500, .time_on = 100, .color = COLOR_BLUE, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_AUTOTUNE] = { .repeats = -1, .steps = { + { .time_off = 800, .time_on = 200, .color = COLOR_BLUE, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_GPS] = { .repeats = -1, .steps = { + { .time_off = 800, .time_on = 200, .color = COLOR_GREEN, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_RTH] = { .repeats = -1, .steps = { + { .time_off = 100, .time_on = 100, .color = COLOR_GREEN, .repeats = 1, }, + { .time_off = 100, .time_on = 100, .color = COLOR_YELLOW, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_LAND] = { .repeats = -1, .steps = { + { .time_off = 100, .time_on = 100, .color = COLOR_GREEN, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ARMED_FM_AUTO] = { .repeats = -1, .steps = { + { .time_off = 100, .time_on = 200, .color = COLOR_GREEN, .repeats = 2, }, + { .time_off = 500, .time_on = 200, .color = COLOR_GREEN, .repeats = 1, }, + }, }, - [NOTIFY_SEQUENCE_ARMED_FM_GPS] = { - .repeats = -1, - .steps = { - { - .time_off = 800, - .time_on = 200, - .color = COLOR_GREEN, - .repeats = 1, - }, - }, - }, - - [NOTIFY_SEQUENCE_ARMED_FM_RTH] = { - .repeats = -1, - .steps = { - { - .time_off = 100, - .time_on = 200, - .color = COLOR_GREEN, - .repeats = 1, - }, - { - .time_off = 500, - .time_on = 200, - .color = COLOR_GREEN, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ARMED_FM_LAND] = { - .repeats = -1, - .steps = { - { - .time_off = 100, - .time_on = 200, - .color = COLOR_GREEN, - .repeats = 1, - }, - { - .time_off = 100, - .time_on = 200, - .color = COLOR_BLUE, - .repeats = 1, - }, - { - .time_off = 100, - .time_on = 200, - .color = COLOR_GREEN, - .repeats = 1, - }, - { - .time_off = 100, - .time_on = 200, - .color = COLOR_BLUE, - .repeats = 1, - }, - { - .time_off = 100, - .time_on = 200, - .color = COLOR_GREEN, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ARMED_FM_AUTO] = { - .repeats = -1, - .steps = { - { - .time_off = 100, - .time_on = 200, - .color = COLOR_GREEN, - .repeats = 2, - }, - { - .time_off = 500, - .time_on = 200, - .color = COLOR_GREEN, - .repeats = 1, - }, - }, - }, - - [NOTIFY_SEQUENCE_ALM_WARN_GPS] = { - .repeats = 2, - .steps = { - { - .time_off = 300, - .time_on = 300, - .color = COLOR_ORANGE, - .repeats = 2, - }, - { - .time_off = 300, - .time_on = 300, - .color = COLOR_YELLOW, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ALM_ERROR_GPS] = { - .repeats = 2, - .steps = { - { - .time_off = 300, - .time_on = 300, - .color = COLOR_RED, - .repeats = 2, - }, - { - .time_off = 300, - .time_on = 300, - .color = COLOR_YELLOW, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ALM_WARN_BATTERY] = { - .repeats = 1, - .steps = { - { - .time_off = 100, - .time_on = 100, - .color = COLOR_ORANGE, - .repeats = 10, - }, - }, - }, - [NOTIFY_SEQUENCE_ALM_ERROR_BATTERY] = { - .repeats = 1, - .steps = { - { - .time_off = 100, - .time_on = 100, - .color = COLOR_RED, - .repeats = 10, - }, - }, - }, - [NOTIFY_SEQUENCE_ALM_MAG] = { - .repeats = 1, - .steps = { - { - .time_off = 300, - .time_on = 300, - .color = COLOR_RED, - .repeats = 2, - }, - { - .time_off = 300, - .time_on = 300, - .color = COLOR_GREEN, - .repeats = 1, - }, - }, - }, - [NOTIFY_SEQUENCE_ALM_CONFIG] = { - .repeats = -1, - .steps = { - { - .time_off = 500, - .time_on = 100, - .color = COLOR_RED, - .repeats = 1, - }, - }, - }, + [NOTIFY_SEQUENCE_ALM_WARN_GPS] = { .repeats = 2, .steps = { + { .time_off = 300, .time_on = 300, .color = COLOR_ORANGE, .repeats = 2, }, + { .time_off = 300, .time_on = 300, .color = COLOR_GREEN, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ALM_ERROR_GPS] = { .repeats = 2, .steps = { + { .time_off = 300, .time_on = 300, .color = COLOR_RED, .repeats = 2, }, + { .time_off = 300, .time_on = 300, .color = COLOR_GREEN, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ALM_WARN_BATTERY] = { .repeats = 1, .steps = { + { .time_off = 100, .time_on = 100, .color = COLOR_ORANGE, .repeats = 10, }, + }, }, + [NOTIFY_SEQUENCE_ALM_ERROR_BATTERY] = { .repeats = 1, .steps = { + { .time_off = 100, .time_on = 100, .color = COLOR_RED, .repeats = 10, }, + }, }, + [NOTIFY_SEQUENCE_ALM_MAG] = { .repeats = 1, .steps = { + { .time_off = 300, .time_on = 300, .color = COLOR_RED, .repeats = 2, }, + { .time_off = 300, .time_on = 300, .color = COLOR_PURPLE, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ALM_CONFIG] = { .repeats = 1, .steps = { + { .time_off = 50, .time_on = 50, .color = COLOR_RED, .repeats = 9, }, + { .time_off = 500, .time_on = 50, .color = COLOR_RED, .repeats = 1, }, + }, }, + [NOTIFY_SEQUENCE_ALM_RECEIVER] = { .repeats = 1, .steps = { + { .time_off = 50, .time_on = 50, .color = COLOR_ORANGE, .repeats = 9, }, + { .time_off = 500, .time_on = 50, .color = COLOR_ORANGE, .repeats = 1, }, + }, }, }; +// List of background sequences attached to each flight mode const LedSequence_t *flightModeMap[] = { [FLIGHTSTATUS_FLIGHTMODE_MANUAL] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_MANUAL], [FLIGHTSTATUS_FLIGHTMODE_STABILIZED1] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED1], @@ -392,6 +183,7 @@ const LedSequence_t *flightModeMap[] = { [FLIGHTSTATUS_FLIGHTMODE_AUTOCRUISE] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS], }; +// List of alarms to show with attached sequences for each status const AlarmDefinition_t alarmsMap[] = { { .timeBetweenNotifications = 10000, @@ -402,7 +194,7 @@ const AlarmDefinition_t alarmsMap[] = { { .timeBetweenNotifications = 15000, .alarmIndex = SYSTEMALARMS_ALARM_MAGNETOMETER, - .warnNotification = NOTIFY_SEQUENCE_ALM_MAG, + .warnNotification = NOTIFY_SEQUENCE_NULL, .errorNotification = NOTIFY_SEQUENCE_ALM_MAG, }, { @@ -411,7 +203,20 @@ const AlarmDefinition_t alarmsMap[] = { .warnNotification = NOTIFY_SEQUENCE_ALM_WARN_BATTERY, .errorNotification = NOTIFY_SEQUENCE_ALM_ERROR_BATTERY, }, + { + .timeBetweenNotifications = 5000, + .alarmIndex = SYSTEMALARMS_ALARM_SYSTEMCONFIGURATION, + .warnNotification = NOTIFY_SEQUENCE_NULL, + .errorNotification = NOTIFY_SEQUENCE_ALM_CONFIG, + }, + { + .timeBetweenNotifications = 5000, + .alarmIndex = SYSTEMALARMS_ALARM_RECEIVER, + .warnNotification = NOTIFY_SEQUENCE_ALM_RECEIVER, + .errorNotification = NOTIFY_SEQUENCE_ALM_RECEIVER, + }, }; + const uint8_t alarmsMapSize = NELEMENTS(alarmsMap); #endif /* SEQUENCES_H_ */ diff --git a/flight/modules/Notify/notify.c b/flight/modules/Notify/notify.c index a944690cb..8ccb3cdc4 100644 --- a/flight/modules/Notify/notify.c +++ b/flight/modules/Notify/notify.c @@ -49,12 +49,13 @@ #include #include #include -#include +#include #include #include #include "inc/notify.h" #include "inc/sequences.h" #include +#include #define SAMPLE_PERIOD_MS 250 // private types @@ -71,17 +72,26 @@ static void checkAlarm(uint8_t alarm, uint8_t *last_alarm, uint32_t *last_alm_ti static AlarmStatus_t *alarmStatus; int32_t NotifyInitialize(void) { - alarmStatus = (AlarmStatus_t *)pios_malloc(sizeof(AlarmStatus_t) * alarmsMapSize); - for (uint8_t i = 0; i < alarmsMapSize; i++) { - alarmStatus[i].lastAlarm = SYSTEMALARMS_ALARM_OK; - alarmStatus[i].lastAlarmTime = 0; - } + uint8_t ws281xOutStatus; - FlightStatusConnectCallback(&updatedCb); - updatedCb(0); - static UAVObjEvent ev; - memset(&ev, 0, sizeof(UAVObjEvent)); - EventPeriodicCallbackCreate(&ev, onTimerCb, SAMPLE_PERIOD_MS / portTICK_RATE_MS); + HwSettingsWS2811LED_OutGet(&ws281xOutStatus); + // Todo: Until further applications exists for WS2811 notify enabled status is tied to ws281x output configuration + bool enabled = ws281xOutStatus != HWSETTINGS_WS2811LED_OUT_DISABLED; + + if (enabled) { + alarmStatus = (AlarmStatus_t *)pios_malloc(sizeof(AlarmStatus_t) * alarmsMapSize); + for (uint8_t i = 0; i < alarmsMapSize; i++) { + alarmStatus[i].lastAlarm = SYSTEMALARMS_ALARM_OK; + alarmStatus[i].lastAlarmTime = 0; + } + + FlightStatusConnectCallback(&updatedCb); + static UAVObjEvent ev; + memset(&ev, 0, sizeof(UAVObjEvent)); + EventPeriodicCallbackCreate(&ev, onTimerCb, SAMPLE_PERIOD_MS / portTICK_RATE_MS); + + updatedCb(0); + } return 0; } MODULE_INITCALL(NotifyInitialize, 0); @@ -128,11 +138,13 @@ void checkAlarm(uint8_t alarm, uint8_t *last_alarm, uint32_t *last_alm_time, uin { if (alarm > SYSTEMALARMS_ALARM_OK) { uint32_t current_time = PIOS_DELAY_GetuS(); - if (*last_alarm < alarm || *last_alm_time + timeBetweenNotifications < current_time) { + if (*last_alarm < alarm || *last_alm_time + timeBetweenNotifications * 1000 < current_time) { uint8_t sequence = (alarm == SYSTEMALARMS_ALARM_WARNING) ? warn_sequence : error_sequence; - PIOS_NOTIFICATION_Default_Ext_Led_Play( - ¬ifications[sequence], - alarm == SYSTEMALARMS_ALARM_WARNING ? NOTIFY_PRIORITY_REGULAR : NOTIFY_PRIORITY_CRITICAL); + if (sequence != NOTIFY_SEQUENCE_NULL) { + PIOS_NOTIFICATION_Default_Ext_Led_Play( + ¬ifications[sequence], + alarm == SYSTEMALARMS_ALARM_WARNING ? NOTIFY_PRIORITY_REGULAR : NOTIFY_PRIORITY_CRITICAL); + } *last_alarm = alarm; *last_alm_time = current_time; } diff --git a/flight/pios/inc/pios_ws2811_cfg.h b/flight/pios/inc/pios_ws2811_cfg.h index 379df77be..d4d7085fb 100644 --- a/flight/pios/inc/pios_ws2811_cfg.h +++ b/flight/pios/inc/pios_ws2811_cfg.h @@ -38,7 +38,6 @@ #include #include -#define sign(x) ((x > 0) - (x < 0)) #define PIOS_WS2811_BUFFER_SIZE (((PIOS_WS2811_NUMLEDS) * 24)) #define PIOS_WS2811_MEMORYDATASIZE DMA_MemoryDataSize_HalfWord #define PIOS_WS2811_PERIPHERALDATASIZE DMA_PeripheralDataSize_HalfWord diff --git a/flight/pios/stm32f4xx/pios_ws2811.c b/flight/pios/stm32f4xx/pios_ws2811.c index 7762cdfb5..b126a08d9 100644 --- a/flight/pios/stm32f4xx/pios_ws2811.c +++ b/flight/pios/stm32f4xx/pios_ws2811.c @@ -310,6 +310,7 @@ void PIOS_WS2811_setColorRGB(Color_t c, uint8_t led, bool update) setColor(c.G, fb + (led * 24)); setColor(c.R, fb + 8 + (led * 24)); setColor(c.B, fb + 16 + (led * 24)); + if (update) { PIOS_WS2811_Update(); } @@ -327,6 +328,10 @@ void PIOS_WS2811_Update() // reset counters for synchronization pios_ws2811_cfg->timer->CNT = PIOS_WS2811_TIM_PERIOD - 1; + + DMA_Cmd(pios_ws2811_cfg->streamCh2, ENABLE); + DMA_Cmd(pios_ws2811_cfg->streamCh1, ENABLE); + DMA_Cmd(pios_ws2811_cfg->streamUpdate, ENABLE); // Start a new cycle TIM_Cmd(pios_ws2811_cfg->timer, ENABLE); } @@ -339,6 +344,9 @@ void PIOS_WS2811_DMA_irq_handler() { pios_ws2811_cfg->timer->CR1 &= (uint16_t) ~TIM_CR1_CEN; DMA_ClearFlag(pios_ws2811_cfg->streamCh1, pios_ws2811_cfg->irq.flags); + DMA_Cmd(pios_ws2811_cfg->streamCh2, DISABLE); + DMA_Cmd(pios_ws2811_cfg->streamCh1, DISABLE); + DMA_Cmd(pios_ws2811_cfg->streamUpdate, DISABLE); } #endif // PIOS_INCLUDE_WS2811 diff --git a/flight/targets/boards/discoveryf4bare/firmware/Makefile b/flight/targets/boards/discoveryf4bare/firmware/Makefile index 29cf57378..d60373ee4 100644 --- a/flight/targets/boards/discoveryf4bare/firmware/Makefile +++ b/flight/targets/boards/discoveryf4bare/firmware/Makefile @@ -35,6 +35,7 @@ USE_DSP_LIB ?= NO #MODULES += Airspeed #MODULES += AltitudeHold #MODULES += Stabilization +MODULES += Notify MODULES += VtolPathFollower MODULES += ManualControl MODULES += Actuator diff --git a/flight/tests/lednotification/unittest.cpp b/flight/tests/lednotification/unittest.cpp index 80ef7d8a4..3d289ffec 100644 --- a/flight/tests/lednotification/unittest.cpp +++ b/flight/tests/lednotification/unittest.cpp @@ -10,43 +10,43 @@ extern "C" { #include "lednotification.c" -void PIOS_WS2811_setColorRGB(__attribute__((unused)) Color_t c, __attribute__((unused)) uint8_t led, __attribute__((unused)) bool update){ - -} -void PIOS_WS2811_Update(){ - -} +void PIOS_WS2811_setColorRGB(__attribute__((unused)) Color_t c, __attribute__((unused)) uint8_t led, __attribute__((unused)) bool update) {} +void PIOS_WS2811_Update() {} } class LedNotificationTest : public testing::Test {}; +void insert(NotifierLedStatus_t *status, pios_notify_priority priority) +{ + ExtLedNotification_t notification; + + notification.priority = priority; + push_queued_sequence(¬ification, status); +} + +void init(NotifierLedStatus_t *status, pios_notify_priority priority) +{ + for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { + status->queued_priorities[i] = priority; + } +} + TEST_F(LedNotificationTest, TestQueueOrder1) { NotifierLedStatus_t status; - for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { - status.queued_priorities[i] = NOTIFY_PRIORITY_BACKGROUND; - } + init(&status, NOTIFY_PRIORITY_BACKGROUND); + insert(&status, NOTIFY_PRIORITY_LOW); + insert(&status, NOTIFY_PRIORITY_CRITICAL); + insert(&status, NOTIFY_PRIORITY_LOW); + insert(&status, NOTIFY_PRIORITY_CRITICAL); - ExtLedNotification_t notification0; - notification0.priority = NOTIFY_PRIORITY_LOW; - push_queued_sequence(¬ification0, &status); - ExtLedNotification_t notification1; - notification1.priority = NOTIFY_PRIORITY_CRITICAL; - push_queued_sequence(¬ification1, &status); - ExtLedNotification_t notification2; - notification2.priority = NOTIFY_PRIORITY_LOW; - push_queued_sequence(¬ification2, &status); - ExtLedNotification_t notification3; - notification3.priority = NOTIFY_PRIORITY_CRITICAL; - push_queued_sequence(¬ification3, &status); EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[0]); EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[1]); EXPECT_EQ(NOTIFY_PRIORITY_CRITICAL, status.queued_priorities[2]); EXPECT_EQ(NOTIFY_PRIORITY_CRITICAL, status.queued_priorities[3]); EXPECT_EQ(NOTIFY_PRIORITY_BACKGROUND, status.queued_priorities[4]); - } TEST_F(LedNotificationTest, TestQueueOrder2) { @@ -57,13 +57,9 @@ TEST_F(LedNotificationTest, TestQueueOrder2) { // 147 status->queued_sequences[insert_point] = new_notification->sequence; // 148 updated_sequence = insert_point; - for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { - status.queued_priorities[i] = NOTIFY_PRIORITY_LOW; - } + init(&status, NOTIFY_PRIORITY_LOW); - ExtLedNotification_t notification; - notification.priority = NOTIFY_PRIORITY_REGULAR; - push_queued_sequence(¬ification, &status); + insert(&status, NOTIFY_PRIORITY_REGULAR); EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[4]); EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[3]); @@ -76,15 +72,28 @@ TEST_F(LedNotificationTest, TestQueueOrder3) { NotifierLedStatus_t status; // Fails because queued_priorities[0] _LOW and not _REGULAR. I _think_ this is a bug. - for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { - status.queued_priorities[i] = NOTIFY_PRIORITY_REGULAR; - } + init(&status, NOTIFY_PRIORITY_REGULAR); - ExtLedNotification_t notification; - notification.priority = NOTIFY_PRIORITY_LOW; - push_queued_sequence(¬ification, &status); + insert(&status, NOTIFY_PRIORITY_LOW); for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[i]); } } + +TEST_F(LedNotificationTest, TestQueueOrder4) { + NotifierLedStatus_t status; + + init(&status, NOTIFY_PRIORITY_BACKGROUND); + + insert(&status, NOTIFY_PRIORITY_REGULAR); + insert(&status, NOTIFY_PRIORITY_REGULAR); + insert(&status, NOTIFY_PRIORITY_REGULAR); + insert(&status, NOTIFY_PRIORITY_LOW); + + EXPECT_EQ(NOTIFY_PRIORITY_BACKGROUND, status.queued_priorities[4]); + EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[3]); + EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[2]); + EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[1]); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[0]); +} From cf9329b8ee9bae5cb829bbf1a245a6af5c2ce75c Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Wed, 20 Aug 2014 19:14:03 +0200 Subject: [PATCH 08/27] OP-1440 - Change timing slightly to support also WS2812B --- flight/pios/inc/pios_ws2811_cfg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flight/pios/inc/pios_ws2811_cfg.h b/flight/pios/inc/pios_ws2811_cfg.h index d4d7085fb..a4a6b5739 100644 --- a/flight/pios/inc/pios_ws2811_cfg.h +++ b/flight/pios/inc/pios_ws2811_cfg.h @@ -45,8 +45,8 @@ // Following times are keept on the lower side to accounts // for bus contentions and irq response time -#define PIOS_WS2811_T0_HIGH_PERIOD 25 // .35us +/- 150nS -#define PIOS_WS2811_T1_HIGH_PERIOD 60 // .70us +/- 150nS +#define PIOS_WS2811_T0_HIGH_PERIOD 32 // .35us +/- 150nS +#define PIOS_WS2811_T1_HIGH_PERIOD 70 // .70us +/- 150nS #define PIOS_WS2811_DMA_CH1_CONFIG(channel) \ { \ From 46ef59f1865717deb9b2f42dee6d81ec027f8e91 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Wed, 17 Sep 2014 01:24:01 +0200 Subject: [PATCH 09/27] OP-1379 - Rebuild and simplify the queuing mechanism --- flight/libraries/inc/optypes.h | 4 +- flight/libraries/lednotification.c | 110 +++++++++------------- flight/libraries/optypes.c | 1 + flight/modules/Notify/notify.c | 18 ---- flight/tests/lednotification/unittest.cpp | 90 ++++++++++++++---- 5 files changed, 123 insertions(+), 100 deletions(-) diff --git a/flight/libraries/inc/optypes.h b/flight/libraries/inc/optypes.h index 82a95e52e..6b9080db7 100644 --- a/flight/libraries/inc/optypes.h +++ b/flight/libraries/inc/optypes.h @@ -33,6 +33,7 @@ typedef struct { } Color_t; extern const Color_t Color_Off; +extern const Color_t Color_Black; extern const Color_t Color_Red; extern const Color_t Color_Lime; extern const Color_t Color_Blue; @@ -46,7 +47,8 @@ extern const Color_t Color_Teal; extern const Color_t Color_Orange; extern const Color_t Color_White; -#define COLOR_OFF { .R = 0x00, .G = 0x00, .B = 0x00 } +#define COLOR_BLACK { .R = 0x00, .G = 0x00, .B = 0x00 } +#define COLOR_OFF COLOR_BLACK #define COLOR_RED { .R = 0xFF, .G = 0x00, .B = 0x00 } #define COLOR_LIME { .R = 0x00, .G = 0xFF, .B = 0x00 } #define COLOR_BLUE { .R = 0x00, .G = 0x00, .B = 0xFF } diff --git a/flight/libraries/lednotification.c b/flight/libraries/lednotification.c index 4b5950d17..e6d961747 100644 --- a/flight/libraries/lednotification.c +++ b/flight/libraries/lednotification.c @@ -35,19 +35,18 @@ // Private defines // Maximum number of notifications enqueued when a higher priority notification is added -#define MAX_BACKGROUND_NOTIFICATIONS 5 +#define MAX_BACKGROUND_NOTIFICATIONS 6 #define MAX_HANDLED_LED 1 -#define BACKGROUND_SEQUENCE -1 +#define BACKGROUND_SEQUENCE 0 #define RESET_STEP -1 #define GET_CURRENT_MILLIS (xTaskGetTickCount() * portTICK_RATE_MS) // Private data types definition // this is the status for a single notification led set typedef struct { - int8_t queued_priorities[MAX_BACKGROUND_NOTIFICATIONS]; - LedSequence_t queued_sequences[MAX_BACKGROUND_NOTIFICATIONS]; - LedSequence_t background_sequence; + int8_t queued_priorities[MAX_BACKGROUND_NOTIFICATIONS]; // slot 0 is reserved for background + LedSequence_t queued_sequences[MAX_BACKGROUND_NOTIFICATIONS]; // slot 0 is reserved for background uint32_t next_run_time; uint32_t sequence_starting_time; @@ -100,74 +99,62 @@ static void restart_sequence(NotifierLedStatus_t *status, bool immediate) */ static void push_queued_sequence(ExtLedNotification_t *new_notification, NotifierLedStatus_t *status) { - int8_t updated_sequence = BACKGROUND_SEQUENCE; + int8_t updated_sequence; + + int8_t lowest_priority_index = -1; + int8_t lowest_priority = new_notification->priority; if (new_notification->priority == NOTIFY_PRIORITY_BACKGROUND) { - status->background_sequence = new_notification->sequence; + lowest_priority_index = BACKGROUND_SEQUENCE; } else { - // a notification with priority higher than background. - // try to enqueue it - int8_t insert_point = MAX_BACKGROUND_NOTIFICATIONS - 1; - int8_t first_free = -1; - for (int8_t i = MAX_BACKGROUND_NOTIFICATIONS - 1; i >= 0; i--) { - const int8_t priority_i = status->queued_priorities[i]; - if (priority_i == NOTIFY_PRIORITY_BACKGROUND) { - first_free = i; - insert_point = i; - continue; - } - if (priority_i > new_notification->priority) { - insert_point = ((i > 0) || (first_free > -1)) ? i : -1; // check whether priority is no bigger than lowest queued priority + // slot 0 is reserved for Background sequence + for (int8_t i = 1; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { + if (status->queued_priorities[i] < lowest_priority) { + lowest_priority_index = i; + lowest_priority = status->queued_priorities[i]; } } - - // no space left on queue for this new notification, ignore. - if (insert_point < 0) { - return; - } - if (insert_point != first_free) { - // there is a free slot, move everything up one place - if (first_free != -1) { - for (uint8_t i = MAX_BACKGROUND_NOTIFICATIONS - 1; i > insert_point; i--) { - status->queued_priorities[i] = status->queued_priorities[i - 1]; - status->queued_sequences[i] = status->queued_sequences[i - 1]; - } - if (status->active_sequence_num >= insert_point) { - status->active_sequence_num++; - } - } else { - // no free space, discard lowest priority notification and move everything down - for (uint8_t i = 0; i < insert_point; i++) { - status->queued_priorities[i] = status->queued_priorities[i + 1]; - status->queued_sequences[i] = status->queued_sequences[i + 1]; - } - if (status->active_sequence_num <= insert_point) { - status->active_sequence_num--; - } - } - } - - status->queued_priorities[insert_point] = new_notification->priority; - status->queued_sequences[insert_point] = new_notification->sequence; - updated_sequence = insert_point; } - if (status->active_sequence_num < updated_sequence) { + // no items with priority lower than the one we are trying to enqueue. skip + if (lowest_priority_index < 0) { + return; + } + + status->queued_priorities[lowest_priority_index] = new_notification->priority; + status->queued_sequences[lowest_priority_index] = new_notification->sequence; + updated_sequence = lowest_priority_index;; + + + // check whether we should preempt the current notification and play this new one + if (status->queued_priorities[status->active_sequence_num] < new_notification->priority) { status->active_sequence_num = updated_sequence; - restart_sequence(status, true); } - if (updated_sequence == BACKGROUND_SEQUENCE) { - restart_sequence(status, false); + + if (status->active_sequence_num == updated_sequence) { + restart_sequence(status, true); } } static bool pop_queued_sequence(NotifierLedStatus_t *status) { - if (status->active_sequence_num != BACKGROUND_SEQUENCE) { - // start the lower priority item + if (status->active_sequence_num > BACKGROUND_SEQUENCE) { + // set the last active slot as empty status->queued_priorities[status->active_sequence_num] = NOTIFY_PRIORITY_BACKGROUND; - status->active_sequence_num--; - return true; + + // search the highest priority item + int8_t highest_priority_index = BACKGROUND_SEQUENCE; + int8_t highest_priority = NOTIFY_PRIORITY_BACKGROUND; + + for (int8_t i = 1; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { + if (status->queued_priorities[i] > highest_priority) { + highest_priority_index = i; + highest_priority = status->queued_priorities[i]; + } + } + // set the next sequence to activate (or BACKGROUND_SEQUENCE when all slots are empty) + status->active_sequence_num = highest_priority_index; + return highest_priority_index != BACKGROUND_SEQUENCE; } // background sequence was completed return false; @@ -178,9 +165,7 @@ static bool pop_queued_sequence(NotifierLedStatus_t *status) */ static void advance_sequence(NotifierLedStatus_t *status) { - LedSequence_t *activeSequence = - status->active_sequence_num == BACKGROUND_SEQUENCE ? - &status->background_sequence : &status->queued_sequences[status->active_sequence_num]; + LedSequence_t *activeSequence = &status->queued_sequences[status->active_sequence_num]; uint8_t step = status->next_sequence_step; LedStep_t *currentStep = &activeSequence->steps[step]; @@ -244,8 +229,7 @@ static void run_led(NotifierLedStatus_t *status) status->next_run_time = currentTime; uint8_t step = status->next_sequence_step; - LedSequence_t *activeSequence = status->active_sequence_num == BACKGROUND_SEQUENCE ? - &status->background_sequence : &status->queued_sequences[status->active_sequence_num]; + LedSequence_t *activeSequence = &status->queued_sequences[status->active_sequence_num]; const Color_t color = status->step_phase_on ? activeSequence->steps[step].color : Color_Off; for (uint8_t i = status->led_set_start; i <= status->led_set_end; i++) { diff --git a/flight/libraries/optypes.c b/flight/libraries/optypes.c index b67b81c3f..3b2c7b728 100644 --- a/flight/libraries/optypes.c +++ b/flight/libraries/optypes.c @@ -27,6 +27,7 @@ #include const Color_t Color_Off = COLOR_OFF; +const Color_t Color_Black = COLOR_BLACK; const Color_t Color_Red = COLOR_RED; const Color_t Color_Lime = COLOR_LIME; const Color_t Color_Blue = COLOR_BLUE; diff --git a/flight/modules/Notify/notify.c b/flight/modules/Notify/notify.c index 8ccb3cdc4..aeb7526bf 100644 --- a/flight/modules/Notify/notify.c +++ b/flight/modules/Notify/notify.c @@ -24,24 +24,6 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/** - * Input objects: ExampleObject1, ExampleSettings - * Output object: ExampleObject2 - * - * This module executes in response to ExampleObject1 updates. When the - * module is triggered it will update the data of ExampleObject2. - * - * No threads are used in this example. - * - * UAVObjects are automatically generated by the UAVObjectGenerator from - * the object definition XML file. - * - * Modules have no API, all communication to other modules is done through UAVObjects. - * However modules may use the API exposed by shared libraries. - * See the OpenPilot wiki for more details. - * http://www.openpilot.org/OpenPilot_Application_Architecture - * - */ #include "openpilot.h" #include #include diff --git a/flight/tests/lednotification/unittest.cpp b/flight/tests/lednotification/unittest.cpp index 3d289ffec..853d4b9f8 100644 --- a/flight/tests/lednotification/unittest.cpp +++ b/flight/tests/lednotification/unittest.cpp @@ -16,6 +16,32 @@ void PIOS_WS2811_Update() {} class LedNotificationTest : public testing::Test {}; +int compare_int8(const void *a, const void *b) +{ + const int8_t *da = (const int8_t *)a; + const int8_t *db = (const int8_t *)b; + + return (*da > *db) - (*da < *db); +} + + +void sort_priorities(int8_t *queued_priorities) +{ + qsort(queued_priorities, MAX_BACKGROUND_NOTIFICATIONS, sizeof(int8_t), compare_int8); +} + +void set_highest_active(NotifierLedStatus_t *status) +{ + int8_t highest = NOTIFY_PRIORITY_BACKGROUND; + + for (int i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { + if (status->queued_priorities[i] > highest) { + status->active_sequence_num = i; + highest = status->queued_priorities[i]; + } + } +} + void insert(NotifierLedStatus_t *status, pios_notify_priority priority) { ExtLedNotification_t notification; @@ -41,12 +67,18 @@ TEST_F(LedNotificationTest, TestQueueOrder1) { insert(&status, NOTIFY_PRIORITY_LOW); insert(&status, NOTIFY_PRIORITY_CRITICAL); + set_highest_active(&status); - EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[0]); - EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[1]); - EXPECT_EQ(NOTIFY_PRIORITY_CRITICAL, status.queued_priorities[2]); - EXPECT_EQ(NOTIFY_PRIORITY_CRITICAL, status.queued_priorities[3]); - EXPECT_EQ(NOTIFY_PRIORITY_BACKGROUND, status.queued_priorities[4]); + + EXPECT_EQ(NOTIFY_PRIORITY_CRITICAL, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_CRITICAL, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_BACKGROUND, (status.queued_priorities[status.active_sequence_num])); } TEST_F(LedNotificationTest, TestQueueOrder2) { @@ -58,26 +90,40 @@ TEST_F(LedNotificationTest, TestQueueOrder2) { // 148 updated_sequence = insert_point; init(&status, NOTIFY_PRIORITY_LOW); + status.queued_priorities[0] = NOTIFY_PRIORITY_BACKGROUND; insert(&status, NOTIFY_PRIORITY_REGULAR); - EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[4]); - EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[3]); - EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[2]); - EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[1]); - EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[0]); + set_highest_active(&status); + + EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_BACKGROUND, (status.queued_priorities[status.active_sequence_num])); } TEST_F(LedNotificationTest, TestQueueOrder3) { NotifierLedStatus_t status; - // Fails because queued_priorities[0] _LOW and not _REGULAR. I _think_ this is a bug. + // Fails because queued_priorities[0] _LOW and not _REGULAR. I _thibnk_ this is a bug. init(&status, NOTIFY_PRIORITY_REGULAR); + status.queued_priorities[0] = NOTIFY_PRIORITY_BACKGROUND; insert(&status, NOTIFY_PRIORITY_LOW); - for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS; i++) { - EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[i]); + set_highest_active(&status); + + + for (uint8_t i = 0; i < MAX_BACKGROUND_NOTIFICATIONS - 1; i++) { + EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); } } @@ -91,9 +137,17 @@ TEST_F(LedNotificationTest, TestQueueOrder4) { insert(&status, NOTIFY_PRIORITY_REGULAR); insert(&status, NOTIFY_PRIORITY_LOW); - EXPECT_EQ(NOTIFY_PRIORITY_BACKGROUND, status.queued_priorities[4]); - EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[3]); - EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[2]); - EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, status.queued_priorities[1]); - EXPECT_EQ(NOTIFY_PRIORITY_LOW, status.queued_priorities[0]); + set_highest_active(&status); + + EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_REGULAR, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_LOW, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_BACKGROUND, (status.queued_priorities[status.active_sequence_num])); + pop_queued_sequence(&status); + EXPECT_EQ(NOTIFY_PRIORITY_BACKGROUND, (status.queued_priorities[status.active_sequence_num])); } From e88b8ccbdb1fec1b85fea3294236c8b2be297035 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Thu, 18 Sep 2014 20:05:44 +0200 Subject: [PATCH 10/27] OP-1222 FW_Wizard Ground shapes : Better labels, cleanup --- .../plugins/config/images/ground-shapes.svg | 2716 ++++++++++------- 1 file changed, 1632 insertions(+), 1084 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/images/ground-shapes.svg b/ground/openpilotgcs/src/plugins/config/images/ground-shapes.svg index b01fec06e..ee8cd7410 100644 --- a/ground/openpilotgcs/src/plugins/config/images/ground-shapes.svg +++ b/ground/openpilotgcs/src/plugins/config/images/ground-shapes.svg @@ -20,7 +20,7 @@ enable-background="new 0 0 792 1008" xml:space="preserve" inkscape:version="0.48.5 r10040" - sodipodi:docname="ground-shapes-wizard.svg" + sodipodi:docname="ground-shapes.svg.2014_09_18_19_55_33.0.svg" inkscape:export-filename="/home/laurent/Images/car.png" inkscape:export-xdpi="70.479134" inkscape:export-ydpi="70.479134"> \ No newline at end of file + d="M 164.97807,1032.3266 C 132.36283,1032.3266 105.93071,1058.7587 105.93071,1091.374 C 105.93071,1123.9892 132.36283,1150.4214 164.97807,1150.4214 L 523.74691,1150.8947 C 556.36217,1150.8947 582.79428,1124.4627 582.79428,1091.8473 C 582.79428,1059.2321 556.36217,1032.7999 523.74691,1032.7999 L 164.97807,1032.3266 z M 165.12756,1038.5054 L 523.59742,1038.9289 C 552.80971,1038.9289 576.49091,1062.6101 576.49091,1091.8224 C 576.49091,1121.0348 552.80971,1144.7159 523.59742,1144.7159 L 165.12756,1144.2924 C 135.91528,1144.2924 112.23408,1120.6112 112.23408,1091.3989 C 112.23408,1062.1866 135.91528,1038.5054 165.12756,1038.5054 z" + style="opacity:0.95864659;color:#000000;fill:#4e93f6;fill-opacity:1;fill-rule:nonzero;stroke:#131715;stroke-width:0.36675274;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /> \ No newline at end of file From a5ebf36425de260a8d709de86f3e7f0de0fe46eb Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 21 Sep 2014 16:38:52 +0200 Subject: [PATCH 11/27] OP-1499 - Replay the configuration sequence in case of gps disconnection, add retry logic in case of errors --- flight/modules/GPS/GPS.c | 4 ++- flight/modules/GPS/UBX.c | 8 ++++++ flight/modules/GPS/inc/ubx_autoconfig.h | 18 ++++++++---- flight/modules/GPS/ubx_autoconfig.c | 37 ++++++++++++++++++++++--- 4 files changed, 56 insertions(+), 11 deletions(-) diff --git a/flight/modules/GPS/GPS.c b/flight/modules/GPS/GPS.c index 9729c5189..2517aef98 100644 --- a/flight/modules/GPS/GPS.c +++ b/flight/modules/GPS/GPS.c @@ -245,7 +245,9 @@ static void gpsTask(__attribute__((unused)) void *parameters) if (gpsSettings.DataProtocol == GPSSETTINGS_DATAPROTOCOL_UBX) { char *buffer = 0; uint16_t count = 0; - ubx_autoconfig_run(&buffer, &count); + uint8_t status; + GPSPositionSensorStatusGet(&status); + ubx_autoconfig_run(&buffer, &count, status != GPSPOSITIONSENSOR_STATUS_NOGPS); // Something to send? if (count) { PIOS_COM_SendBuffer(gpsPort, (uint8_t *)buffer, count); diff --git a/flight/modules/GPS/UBX.c b/flight/modules/GPS/UBX.c index ba417b5ac..c883e7a39 100644 --- a/flight/modules/GPS/UBX.c +++ b/flight/modules/GPS/UBX.c @@ -515,6 +515,14 @@ uint32_t parse_ubx_message(struct UBXPacket *ubx, GPSPositionSensorData *GpsPosi GPSPositionSensorSet(GpsPosition); msgtracker.msg_received = NONE_RECEIVED; id = GPSPOSITIONSENSOR_OBJID; + } else { + uint8_t status; + GPSPositionSensorStatusGet(&status); + if (status == GPSPOSITIONSENSOR_STATUS_NOGPS) { + // Some ubx thing has been received so GPS is there + status = GPSPOSITIONSENSOR_STATUS_NOFIX; + GPSPositionSensorStatusSet(&status); + } } return id; } diff --git a/flight/modules/GPS/inc/ubx_autoconfig.h b/flight/modules/GPS/inc/ubx_autoconfig.h index e01391a7d..25a5857b0 100644 --- a/flight/modules/GPS/inc/ubx_autoconfig.h +++ b/flight/modules/GPS/inc/ubx_autoconfig.h @@ -33,12 +33,18 @@ // defines // TODO: NEO8 max rate is for Rom version, flash is limited to 10Hz, need to handle that. -#define UBX_MAX_RATE_VER8 18 -#define UBX_MAX_RATE_VER7 10 -#define UBX_MAX_RATE 5 +#define UBX_MAX_RATE_VER8 18 +#define UBX_MAX_RATE_VER7 10 +#define UBX_MAX_RATE 5 -#define UBX_REPLY_TIMEOUT (500 * 1000) -#define UBX_MAX_RETRIES 5 +// time to wait before reinitializing the fsm due to disconnection +#define UBX_CONNECTION_TIMEOUT (2000 * 1000) +// times between retries in case an error does occurs +#define UBX_ERROR_RETRY_TIMEOUT (1000 * 1000) +// timeout for ack reception +#define UBX_REPLY_TIMEOUT (500 * 1000) +// max retries in case of timeout +#define UBX_MAX_RETRIES 5 // types typedef enum { @@ -179,7 +185,7 @@ typedef union { } message; } __attribute__((packed)) UBXSentPacket_t; -void ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send); +void ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send, bool gps_connected); void ubx_autoconfig_set(ubx_autoconfig_settings_t config); int32_t ubx_autoconfig_get_status(); #endif /* UBX_AUTOCONFIG_H_ */ diff --git a/flight/modules/GPS/ubx_autoconfig.c b/flight/modules/GPS/ubx_autoconfig.c index 74aa89179..fbecfa9f7 100644 --- a/flight/modules/GPS/ubx_autoconfig.c +++ b/flight/modules/GPS/ubx_autoconfig.c @@ -46,6 +46,7 @@ typedef enum { typedef struct { initSteps_t currentStep; // Current configuration "fsm" status uint32_t lastStepTimestampRaw; // timestamp of last operation + uint32_t lastConnectedRaw; // timestamp of last time gps was connected UBXSentPacket_t working_packet; // outbound "buffer" ubx_autoconfig_settings_t currentSettings; int8_t lastConfigSent; // index of last configuration string sent @@ -279,15 +280,38 @@ static void enable_sentences(__attribute__((unused)) uint16_t *bytes_to_send) } } -void ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send) +void ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send, bool gps_connected) { *bytes_to_send = 0; *buffer = (char *)status->working_packet.buffer; - if (!status || !enabled) { + if (!status || !enabled || status->currentStep == INIT_STEP_DISABLED) { return; // autoconfig not enabled } + + // when gps is disconnected it will replay the autoconfig sequence. + if (!gps_connected) { + if (status->currentStep == INIT_STEP_DONE) { + // if some operation is in progress and it is not running into issues it maybe that + // the disconnection is only due to wrong message rates, so reinit only when done. + // errors caused by disconnection are handled by error retry logic + if (PIOS_DELAY_DiffuS(status->lastConnectedRaw) > UBX_CONNECTION_TIMEOUT) { + status->currentStep = INIT_STEP_START; + return; + } + } + } else { + // reset connection timer + status->lastConnectedRaw = PIOS_DELAY_GetRaw(); + } + switch (status->currentStep) { - case INIT_STEP_ERROR: // TODO: what to do? retries after a while? maybe gps was disconnected (this can be detected)? + case INIT_STEP_ERROR: + if (PIOS_DELAY_DiffuS(status->lastStepTimestampRaw) > UBX_ERROR_RETRY_TIMEOUT) { + status->currentStep = INIT_STEP_START; + status->lastStepTimestampRaw = PIOS_DELAY_GetRaw(); + } + return; + case INIT_STEP_DISABLED: case INIT_STEP_DONE: return; @@ -348,6 +372,7 @@ void ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send) status->retryCount++; if (status->retryCount > UBX_MAX_RETRIES) { status->currentStep = INIT_STEP_ERROR; + status->lastStepTimestampRaw = PIOS_DELAY_GetRaw(); return; } } @@ -374,12 +399,16 @@ void ubx_autoconfig_set(ubx_autoconfig_settings_t config) status->currentSettings = config; status->currentStep = INIT_STEP_START; enabled = true; + } else { + if (!status) { + status->currentStep = INIT_STEP_DISABLED; + } } } int32_t ubx_autoconfig_get_status() { - if (!status) { + if (!status || !enabled) { return UBX_AUTOCONFIG_STATUS_DISABLED; } switch (status->currentStep) { From 3c6a8e03958e8f7dc27900072b76356488e00eac Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 21 Sep 2014 23:32:52 +0200 Subject: [PATCH 12/27] OP-1379 - Prevent loosing any update to background notification and notifications with priority higher than current --- flight/pios/common/pios_notify.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flight/pios/common/pios_notify.c b/flight/pios/common/pios_notify.c index 5f47a18a6..9b0a1fc67 100644 --- a/flight/pios/common/pios_notify.c +++ b/flight/pios/common/pios_notify.c @@ -58,6 +58,13 @@ pios_notify_notification PIOS_NOTIFY_GetActiveNotification(bool clear) */ void PIOS_NOTIFICATION_Default_Ext_Led_Play(const LedSequence_t *sequence, pios_notify_priority priority) { + // alert and alarms are repeated if condition persists. bacground notification instead are set once, so try to prevent loosing any update + if (newNotification && priority != NOTIFY_PRIORITY_BACKGROUND) { + // prevent overwriting higher priority or background notifications + if (extLedNotification.priority == NOTIFY_PRIORITY_BACKGROUND || extLedNotification.priority > priority) { + return; + } + } extLedNotification.priority = priority; extLedNotification.sequence = *sequence; newNotification = true; From 0885fda9263a8c1da60c73c4d378d9643051cc8c Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Mon, 22 Sep 2014 00:56:49 +0200 Subject: [PATCH 13/27] OP-1499 - CFG-CFG mask was incorrect (nav is 0x02, not 0x01) --- flight/modules/GPS/ubx_autoconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/modules/GPS/ubx_autoconfig.c b/flight/modules/GPS/ubx_autoconfig.c index fbecfa9f7..bf9b41cf7 100644 --- a/flight/modules/GPS/ubx_autoconfig.c +++ b/flight/modules/GPS/ubx_autoconfig.c @@ -228,7 +228,7 @@ void config_save(uint16_t *bytes_to_send) { memset(status->working_packet.buffer, 0, sizeof(UBXSentHeader_t) + sizeof(ubx_cfg_cfg_t)); // mask LSB=ioPort|msgConf|infMsg|navConf|rxmConf|||||rinvConf|antConf|....|= MSB - status->working_packet.message.payload.cfg_cfg.saveMask = 0x01 | 0x08; // msgConf + navConf + status->working_packet.message.payload.cfg_cfg.saveMask = 0x02 | 0x08; // msgConf + navConf status->working_packet.message.payload.cfg_cfg.deviceMask = UBX_CFG_CFG_ALL_DEVICES_MASK; *bytes_to_send = prepare_packet(&status->working_packet, UBX_CLASS_CFG, UBX_ID_CFG_CFG, sizeof(ubx_cfg_cfg_t)); status->requiredAck.clsID = UBX_CLASS_CFG; From 78756f6873a8e40debb6d09d5baf39c58340b77f Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Wed, 24 Sep 2014 06:12:48 +0200 Subject: [PATCH 14/27] OP-1499 - Failed Autoconfig will raise an Error Alarm. When AC does start it will reset any previous ack. Force update to Autoconfig Status in GPSPositionSensor UAVO. Add a small pause between each config step --- flight/modules/GPS/GPS.c | 9 ++++++++- flight/modules/GPS/inc/ubx_autoconfig.h | 3 ++- flight/modules/GPS/ubx_autoconfig.c | 8 +++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/flight/modules/GPS/GPS.c b/flight/modules/GPS/GPS.c index 2517aef98..e8524fd2e 100644 --- a/flight/modules/GPS/GPS.c +++ b/flight/modules/GPS/GPS.c @@ -268,11 +268,17 @@ static void gpsTask(__attribute__((unused)) void *parameters) { #if defined(PIOS_INCLUDE_GPS_UBX_PARSER) && !defined(PIOS_GPS_MINIMAL) int32_t ac_status = ubx_autoconfig_get_status(); + static uint8_t lastStatus = 0; + gpspositionsensor.AutoConfigStatus = ac_status == UBX_AUTOCONFIG_STATUS_DISABLED ? GPSPOSITIONSENSOR_AUTOCONFIGSTATUS_DISABLED : ac_status == UBX_AUTOCONFIG_STATUS_DONE ? GPSPOSITIONSENSOR_AUTOCONFIGSTATUS_DONE : ac_status == UBX_AUTOCONFIG_STATUS_ERROR ? GPSPOSITIONSENSOR_AUTOCONFIGSTATUS_ERROR : GPSPOSITIONSENSOR_AUTOCONFIGSTATUS_RUNNING; + if (gpspositionsensor.AutoConfigStatus != lastStatus) { + GPSPositionSensorAutoConfigStatusSet(&gpspositionsensor.AutoConfigStatus); + lastStatus = gpspositionsensor.AutoConfigStatus; + } #endif res = parse_ubx_stream(c, gps_rx_buffer, &gpspositionsensor, &gpsRxStats); } @@ -292,7 +298,8 @@ static void gpsTask(__attribute__((unused)) void *parameters) // Check for GPS timeout timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS; - if ((timeNowMs - timeOfLastUpdateMs) >= GPS_TIMEOUT_MS) { + if ((timeNowMs - timeOfLastUpdateMs) >= GPS_TIMEOUT_MS || + (gpsSettings.DataProtocol == GPSSETTINGS_DATAPROTOCOL_UBX && gpspositionsensor.AutoConfigStatus == GPSPOSITIONSENSOR_AUTOCONFIGSTATUS_ERROR)) { // we have not received any valid GPS sentences for a while. // either the GPS is not plugged in or a hardware problem or the GPS has locked up. uint8_t status = GPSPOSITIONSENSOR_STATUS_NOGPS; diff --git a/flight/modules/GPS/inc/ubx_autoconfig.h b/flight/modules/GPS/inc/ubx_autoconfig.h index 25a5857b0..734c54537 100644 --- a/flight/modules/GPS/inc/ubx_autoconfig.h +++ b/flight/modules/GPS/inc/ubx_autoconfig.h @@ -45,7 +45,8 @@ #define UBX_REPLY_TIMEOUT (500 * 1000) // max retries in case of timeout #define UBX_MAX_RETRIES 5 - +// pause between each configuration step +#define UBX_STEP_WAIT_TIME (10 * 1000) // types typedef enum { UBX_AUTOCONFIG_STATUS_DISABLED = 0, diff --git a/flight/modules/GPS/ubx_autoconfig.c b/flight/modules/GPS/ubx_autoconfig.c index bf9b41cf7..1671b601a 100644 --- a/flight/modules/GPS/ubx_autoconfig.c +++ b/flight/modules/GPS/ubx_autoconfig.c @@ -287,7 +287,9 @@ void ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send, bool gps_connec if (!status || !enabled || status->currentStep == INIT_STEP_DISABLED) { return; // autoconfig not enabled } - + if (PIOS_DELAY_DiffuS(status->lastStepTimestampRaw) < UBX_STEP_WAIT_TIME) { + return; + } // when gps is disconnected it will replay the autoconfig sequence. if (!gps_connected) { if (status->currentStep == INIT_STEP_DONE) { @@ -318,6 +320,10 @@ void ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send, bool gps_connec case INIT_STEP_START: case INIT_STEP_ASK_VER: + // clear ack + ubxLastAck.clsID = 0x00; + ubxLastAck.msgID = 0x00; + status->lastStepTimestampRaw = PIOS_DELAY_GetRaw(); build_request(&status->working_packet, UBX_CLASS_MON, UBX_ID_MON_VER, bytes_to_send); status->currentStep = INIT_STEP_WAIT_VER; From 7e789ccc694f3a20a33aeddfe8f701c9fcbf07a0 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Thu, 25 Sep 2014 00:59:39 +0200 Subject: [PATCH 15/27] OP-1379 - Clear output pin at the end of dma cycle --- flight/pios/stm32f4xx/pios_ws2811.c | 1 + 1 file changed, 1 insertion(+) diff --git a/flight/pios/stm32f4xx/pios_ws2811.c b/flight/pios/stm32f4xx/pios_ws2811.c index b126a08d9..4b8e9d987 100644 --- a/flight/pios/stm32f4xx/pios_ws2811.c +++ b/flight/pios/stm32f4xx/pios_ws2811.c @@ -342,6 +342,7 @@ void PIOS_WS2811_Update() void PIOS_WS2811_DMA_irq_handler() { + pios_ws2811_pin_cfg->gpio->BSRRH = dmaSource[0]; pios_ws2811_cfg->timer->CR1 &= (uint16_t) ~TIM_CR1_CEN; DMA_ClearFlag(pios_ws2811_cfg->streamCh1, pios_ws2811_cfg->irq.flags); DMA_Cmd(pios_ws2811_cfg->streamCh2, DISABLE); From a0541f431c2b98198be86c1d4315d809a4460987 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Mon, 29 Sep 2014 21:12:37 +0200 Subject: [PATCH 16/27] OP-1222 Added vtail propeller --- .../config/images/fixedwing-shapes.svg | 246 ++++++++++-------- 1 file changed, 139 insertions(+), 107 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/images/fixedwing-shapes.svg b/ground/openpilotgcs/src/plugins/config/images/fixedwing-shapes.svg index 9b5a425b0..952b65bee 100644 --- a/ground/openpilotgcs/src/plugins/config/images/fixedwing-shapes.svg +++ b/ground/openpilotgcs/src/plugins/config/images/fixedwing-shapes.svg @@ -487,16 +487,20 @@ inkscape:window-height="928" id="namedview4099" showgrid="false" - inkscape:zoom="0.73144533" - inkscape:cx="784.15573" - inkscape:cy="958.96697" + inkscape:zoom="4.0911178" + inkscape:cx="396.11045" + inkscape:cy="611.35183" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" - inkscape:current-layer="elevon" + inkscape:current-layer="Layer_1" showborder="true" inkscape:showpageshadow="false" - inkscape:object-paths="true" /> \ No newline at end of file + style="fill:none;stroke:#010101;stroke-width:0.69520003;stroke-linecap:round;stroke-linejoin:round" /> \ No newline at end of file From 87790711c24fdbf5fa6059fbe8541bb031fd32fe Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Mon, 29 Sep 2014 22:35:33 +0200 Subject: [PATCH 17/27] OP-1222 Updated wizard shapes with Vtail frame --- .../fixedwing-shapes-wizard-no-numbers.svg | 2415 ++++++++++++---- .../resources/fixedwing-shapes-wizard.svg | 2468 ++++++++++++++--- 2 files changed, 3998 insertions(+), 885 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard-no-numbers.svg b/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard-no-numbers.svg index 8f250956c..18656681f 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard-no-numbers.svg +++ b/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard-no-numbers.svg @@ -14,9 +14,9 @@ id="Layer_1" x="0px" y="0px" - width="792" - height="2016" - viewBox="0 0 792 2016" + width="653.61542" + height="2094.717" + viewBox="0 0 653.61542 2094.717" enable-background="new 0 0 792 1008" xml:space="preserve" inkscape:version="0.48.5 r10040" @@ -258,22 +258,6 @@ x2="281.74301" y2="630.1615" />6 \ No newline at end of file + d="M 449.683,830.161 V 821.571 H 453.494 C 454.26,821.571 454.842,821.648 455.24,821.8 C 455.636,821.954 455.957,822.227 456.195,822.617 C 456.431,823.007 456.55,823.439 456.55,823.912 C 456.55,824.52 456.353,825.035 455.958,825.453 C 455.562,825.871 454.954,826.137 454.13,826.25 C 454.431,826.396 454.659,826.537 454.818,826.678 C 455.15,826.985 455.464,827.366 455.759,827.823 L 457.253,830.161 H 455.823 L 454.684,828.374 C 454.352,827.858 454.08,827.464 453.866,827.189 C 453.651,826.916 453.46,826.723 453.29,826.616 C 453.12,826.507 452.946,826.428 452.769,826.387 C 452.64,826.362 452.429,826.346 452.136,826.346 H 450.82 V 830.16 L 449.683,830.161 L 449.683,830.161 z M 450.819,825.362 H 453.26 C 453.781,825.362 454.186,825.306 454.481,825.201 C 454.774,825.094 454.997,824.922 455.149,824.683 C 455.299,824.448 455.378,824.192 455.378,823.912 C 455.378,823.506 455.232,823.172 454.937,822.91 C 454.642,822.647 454.175,822.515 453.541,822.515 H 450.822 L 450.819,825.362 L 450.819,825.362 z" + id="path4097-7" /> + + + +4 +6 + \ No newline at end of file From 1c7ab99e51ae2b7eb2338b55c438a9a2e7adf181 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Mon, 29 Sep 2014 22:58:51 +0200 Subject: [PATCH 18/27] OP-1222 Updated connection-diagram with Vtail frame --- .../resources/connection-diagrams.svg | 1900 ++++++++++++++++- 1 file changed, 1877 insertions(+), 23 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg b/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg index fefc1c59a..4ba99d2fd 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg +++ b/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg @@ -26,17 +26,17 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="593" - inkscape:window-height="439" + inkscape:window-width="1280" + inkscape:window-height="928" id="namedview4616" showgrid="false" - inkscape:zoom="0.1891554" - inkscape:cx="1013.827" - inkscape:cy="514.92134" - inkscape:window-x="331" - inkscape:window-y="337" - inkscape:window-maximized="0" - inkscape:current-layer="layer7" + inkscape:zoom="0.77062343" + inkscape:cx="919.09469" + inkscape:cy="317.10852" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:current-layer="g10948" fit-margin-top="15" fit-margin-left="15" fit-margin-right="15" @@ -48,7 +48,8 @@ inkscape:snap-bbox="true" inkscape:object-paths="true" inkscape:snap-bbox-midpoints="true" - inkscape:snap-bbox-edge-midpoints="true"> + inkscape:snap-bbox-edge-midpoints="true" + inkscape:object-nodes="true"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -28762,7 +29011,8 @@ id="layer13" inkscape:label="multirotors-frames" style="display:inline" - transform="translate(9.5291677,71.377308)"> + transform="translate(9.5291677,71.377308)" + sodipodi:insensitive="true"> + style="display:inline" + transform="translate(9.5291677,71.377308)"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + style="display:none" + sodipodi:insensitive="true"> + sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccc" /> @@ -33744,6 +35574,29 @@ + + + + + + + @@ -33751,7 +35604,8 @@ inkscape:groupmode="layer" id="layer33" inkscape:label="fixed-wing-one-servo" - style="display:none"> + style="display:none" + sodipodi:insensitive="true"> @@ -34825,7 +36679,7 @@ d="M 411.435,717.672 C 411.435,719.19078 410.20378,720.422 408.685,720.422 C 407.16621,720.422 405.935,719.19078 405.935,717.672 C 405.935,716.15321 407.16621,714.922 408.685,714.922 C 410.20378,714.922 411.435,716.15321 411.435,717.672 z" /> @@ -34953,7 +36807,7 @@ d="M 216.804,613.62 C 216.804,615.13878 215.57278,616.37 214.054,616.37 C 212.53522,616.37 211.304,615.13878 211.304,613.62 C 211.304,612.10121 212.53522,610.87 214.054,610.87 C 215.57278,610.87 216.804,612.10121 216.804,613.62 z" /> From 4ab043fb653611f0a80253174ac5b45520533d4b Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Mon, 29 Sep 2014 23:56:09 +0200 Subject: [PATCH 19/27] OP-1222 Removed Tx wire for Sbus Rx (3 wires) - All wing frames heading top (follow revo red arrow) --- .../resources/connection-diagrams.svg | 3895 ++++++++--------- 1 file changed, 1944 insertions(+), 1951 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg b/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg index 4ba99d2fd..6e42f8ac6 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg +++ b/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg @@ -12,8 +12,8 @@ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" id="svg12651" - height="839.08447" - width="1309.343" + height="1074.8231" + width="1398.5884" version="1.1" inkscape:version="0.48.5 r10040" sodipodi:docname="connection-diagrams.svg"> @@ -30,13 +30,13 @@ inkscape:window-height="928" id="namedview4616" showgrid="false" - inkscape:zoom="0.77062343" - inkscape:cx="919.09469" - inkscape:cy="317.10852" + inkscape:zoom="0.67825113" + inkscape:cx="942.97766" + inkscape:cy="537.41156" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" - inkscape:current-layer="g10948" + inkscape:current-layer="layer20" fit-margin-top="15" fit-margin-left="15" fit-margin-right="15" @@ -52,35 +52,35 @@ inkscape:object-nodes="true"> + originx="-32.46875px" + originy="239.45435px" /> @@ -104,7 +104,7 @@ @@ -118,7 +118,7 @@ @@ -145,7 +145,7 @@ style="overflow:visible"> @@ -159,7 +159,7 @@ style="overflow:visible"> @@ -181,7 +181,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10057"> @@ -189,7 +189,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10073"> @@ -221,7 +221,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10105"> @@ -250,7 +250,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10165"> @@ -258,7 +258,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10181"> @@ -274,7 +274,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10213"> @@ -290,7 +290,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10269"> @@ -298,7 +298,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10285"> @@ -314,7 +314,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10317"> @@ -330,7 +330,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4329"> @@ -338,7 +338,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4345"> @@ -354,7 +354,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4377"> @@ -386,7 +386,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4437"> @@ -394,7 +394,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4453"> @@ -410,7 +410,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4485"> @@ -434,7 +434,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4925"> @@ -442,7 +442,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4941"> @@ -458,7 +458,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4973"> @@ -487,7 +487,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7903"> @@ -495,7 +495,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7919"> @@ -511,7 +511,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7951"> @@ -540,7 +540,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5467"> @@ -548,7 +548,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5483"> @@ -556,7 +556,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5499"> @@ -564,7 +564,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5515"> @@ -572,7 +572,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5553"> @@ -588,7 +588,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5585"> @@ -604,7 +604,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5617"> @@ -620,7 +620,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5649"> @@ -636,7 +636,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5681"> @@ -652,7 +652,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5713"> @@ -668,7 +668,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5745"> @@ -684,7 +684,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5777"> @@ -713,7 +713,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7159"> @@ -721,7 +721,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7175"> @@ -737,7 +737,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7207"> @@ -753,7 +753,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7239"> @@ -761,7 +761,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7255"> @@ -777,7 +777,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7287"> @@ -793,7 +793,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7319"> @@ -801,7 +801,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7335"> @@ -817,7 +817,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7367"> @@ -833,7 +833,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7423"> @@ -841,7 +841,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7439"> @@ -857,7 +857,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7471"> @@ -873,7 +873,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7503"> @@ -881,7 +881,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7519"> @@ -897,7 +897,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7551"> @@ -913,7 +913,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7583"> @@ -921,7 +921,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7599"> @@ -937,7 +937,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7631"> @@ -966,7 +966,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5841"> @@ -974,7 +974,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5857"> @@ -982,7 +982,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5873"> @@ -990,7 +990,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5889"> @@ -998,7 +998,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5905"> @@ -1014,7 +1014,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5937"> @@ -1030,7 +1030,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5969"> @@ -1046,7 +1046,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6001"> @@ -1062,7 +1062,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6033"> @@ -1078,7 +1078,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6065"> @@ -1094,7 +1094,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6097"> @@ -1110,7 +1110,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6129"> @@ -1126,7 +1126,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6169"> @@ -1134,7 +1134,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6185"> @@ -1150,7 +1150,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6217"> @@ -1166,7 +1166,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6273"> @@ -1174,7 +1174,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6289"> @@ -1190,7 +1190,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6321"> @@ -1219,7 +1219,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5049"> @@ -1227,7 +1227,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5065"> @@ -1235,7 +1235,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5081"> @@ -1243,7 +1243,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5097"> @@ -1251,7 +1251,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5135"> @@ -1267,7 +1267,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5167"> @@ -1283,7 +1283,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5199"> @@ -1299,7 +1299,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5231"> @@ -1315,7 +1315,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5263"> @@ -1331,7 +1331,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5295"> @@ -1355,7 +1355,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5327"> @@ -1363,7 +1363,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5359"> @@ -1706,7 +1706,7 @@ @@ -1721,7 +1721,7 @@ inkscape:connector-curvature="0" id="path6056-4" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -1749,7 +1749,7 @@ inkscape:connector-curvature="0" id="path21212" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -1777,7 +1777,7 @@ inkscape:connector-curvature="0" id="path21220" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -1911,7 +1911,7 @@ inkscape:connector-curvature="0" id="path6056-7" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -1939,7 +1939,7 @@ inkscape:connector-curvature="0" id="path11149" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -1967,7 +1967,7 @@ inkscape:connector-curvature="0" id="path11157" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -2136,7 +2136,7 @@ inkscape:connector-curvature="0" id="path6056-0" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -2164,7 +2164,7 @@ inkscape:connector-curvature="0" id="path11726" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -2192,7 +2192,7 @@ inkscape:connector-curvature="0" id="path11734" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -2220,7 +2220,7 @@ inkscape:connector-curvature="0" id="path21220-7" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -2337,7 +2337,7 @@ inkscape:connector-curvature="0" id="path6056-77" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -2365,7 +2365,7 @@ inkscape:connector-curvature="0" id="path12589" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -2393,7 +2393,7 @@ inkscape:connector-curvature="0" id="path12597" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -2421,7 +2421,7 @@ inkscape:connector-curvature="0" id="path12605" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -2449,7 +2449,7 @@ inkscape:connector-curvature="0" id="path12613" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" - d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + d="M 8.7185878,4.0337352 L -2.2072895,0.01601326 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z" transform="matrix(-0.3,0,0,-0.3,0.69,0)" /> @@ -2566,7 +2566,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10073-9"> @@ -2599,7 +2599,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10105-5"> @@ -2651,7 +2651,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10165-8"> @@ -2659,7 +2659,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10181-4"> @@ -2692,7 +2692,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10213-1"> @@ -2725,7 +2725,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10269-1"> @@ -2733,7 +2733,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10285-2"> @@ -2766,7 +2766,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath10317-2"> @@ -2818,7 +2818,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5049-7"> @@ -2826,7 +2826,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5065-3"> @@ -2884,7 +2884,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5327-2"> @@ -3017,7 +3017,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5081-8"> @@ -3025,7 +3025,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5097-0"> @@ -3033,7 +3033,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5135-8"> @@ -3066,7 +3066,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5167-6"> @@ -3099,7 +3099,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5199-9"> @@ -3132,7 +3132,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5231-4"> @@ -3165,7 +3165,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5263-5"> @@ -3198,7 +3198,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5295-4"> @@ -3231,7 +3231,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5359-0"> @@ -3283,7 +3283,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5467-7"> @@ -3291,7 +3291,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5483-5"> @@ -3299,7 +3299,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5499-4"> @@ -3307,7 +3307,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5515-6"> @@ -3315,7 +3315,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5553-5"> @@ -3348,7 +3348,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5585-3"> @@ -3381,7 +3381,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5617-0"> @@ -3414,7 +3414,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5649-4"> @@ -3447,7 +3447,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5681-5"> @@ -3480,7 +3480,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5713-8"> @@ -3513,7 +3513,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5745-4"> @@ -3546,7 +3546,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5777-6"> @@ -3598,7 +3598,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5841-2"> @@ -3606,7 +3606,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5857-0"> @@ -3614,7 +3614,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5873-6"> @@ -3622,7 +3622,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5889-2"> @@ -3630,7 +3630,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5905-8"> @@ -3663,7 +3663,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5937-3"> @@ -3696,7 +3696,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5969-3"> @@ -3729,7 +3729,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6001-7"> @@ -3762,7 +3762,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6033-5"> @@ -3795,7 +3795,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6065-8"> @@ -3828,7 +3828,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6097-0"> @@ -3861,7 +3861,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6129-2"> @@ -3894,7 +3894,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6169-2"> @@ -3902,7 +3902,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6185-2"> @@ -3935,7 +3935,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6217-8"> @@ -3968,7 +3968,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6273-5"> @@ -3976,7 +3976,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6289-4"> @@ -4009,7 +4009,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6321-0"> @@ -4065,7 +4065,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7159-1"> @@ -4073,7 +4073,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7175-5"> @@ -4106,7 +4106,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7207-6"> @@ -4139,7 +4139,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7239-4"> @@ -4147,7 +4147,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7255-7"> @@ -4180,7 +4180,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7287-1"> @@ -4213,7 +4213,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7319-8"> @@ -4221,7 +4221,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7367-9"> @@ -4254,7 +4254,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7335-3"> @@ -4287,7 +4287,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7423-6"> @@ -4295,7 +4295,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7439-8"> @@ -4328,7 +4328,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7471-3"> @@ -4361,7 +4361,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7503-0"> @@ -4369,7 +4369,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7519-4"> @@ -4402,7 +4402,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7551-8"> @@ -4435,7 +4435,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7583-7"> @@ -4443,7 +4443,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7599-4"> @@ -4476,7 +4476,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7631-1"> @@ -4509,7 +4509,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4329-0"> @@ -4517,7 +4517,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4345-1"> @@ -4541,7 +4541,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4377-8"> @@ -4574,7 +4574,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4437-7"> @@ -4582,7 +4582,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4453-8"> @@ -4606,7 +4606,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4485-3"> @@ -4639,7 +4639,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4925-8"> @@ -4647,7 +4647,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4941-1"> @@ -4680,7 +4680,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath4973-3"> @@ -4732,7 +4732,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7903-1"> @@ -4740,7 +4740,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7919-4"> @@ -4773,7 +4773,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath7951-2"> @@ -4797,7 +4797,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath17117"> @@ -4805,7 +4805,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath17121"> @@ -4838,7 +4838,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath17132"> @@ -4871,7 +4871,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath17143"> @@ -4879,7 +4879,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath17147"> @@ -4903,7 +4903,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath17158"> @@ -4991,7 +4991,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5841-3"> @@ -4999,7 +4999,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5857-5"> @@ -5007,7 +5007,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5873-66"> @@ -5015,7 +5015,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5889-3"> @@ -5023,7 +5023,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5905-9"> @@ -5058,7 +5058,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5937-4"> @@ -5093,7 +5093,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath5969-7"> @@ -5128,7 +5128,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6001-5"> @@ -5163,7 +5163,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6033-9"> @@ -5198,7 +5198,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6065-5"> @@ -5233,7 +5233,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6097-7"> @@ -5268,7 +5268,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6129-8"> @@ -5303,7 +5303,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6169-9"> @@ -5311,7 +5311,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6185-0"> @@ -5346,7 +5346,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6217-2"> @@ -5381,7 +5381,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6273-8"> @@ -5389,7 +5389,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6289-3"> @@ -5424,7 +5424,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath6321-6"> @@ -5514,7 +5514,7 @@ id="bullet-char-template(57356)" transform="scale(4.8828125e-4,-4.8828125e-4)"> @@ -5522,7 +5522,7 @@ id="bullet-char-template(57354)" transform="scale(4.8828125e-4,-4.8828125e-4)"> @@ -5530,7 +5530,7 @@ id="bullet-char-template(10146)" transform="scale(4.8828125e-4,-4.8828125e-4)"> @@ -5538,7 +5538,7 @@ id="bullet-char-template(10132)" transform="scale(4.8828125e-4,-4.8828125e-4)"> @@ -5546,7 +5546,7 @@ id="bullet-char-template(10007)" transform="scale(4.8828125e-4,-4.8828125e-4)"> @@ -5554,7 +5554,7 @@ id="bullet-char-template(10004)" transform="scale(4.8828125e-4,-4.8828125e-4)"> @@ -5562,7 +5562,7 @@ id="bullet-char-template(9679)" transform="scale(4.8828125e-4,-4.8828125e-4)"> @@ -5570,7 +5570,7 @@ id="bullet-char-template(8226)" transform="scale(4.8828125e-4,-4.8828125e-4)"> @@ -5578,7 +5578,7 @@ id="bullet-char-template(8211)" transform="scale(4.8828125e-4,-4.8828125e-4)"> @@ -10281,16 +10281,6 @@ transform="matrix(-0.3,0,0,-0.3,0.69,0)" inkscape:connector-curvature="0" /> - - - - + + + + @@ -10548,7 +10548,7 @@ inkscape:label="background" style="display:none" sodipodi:insensitive="true" - transform="translate(9.5291677,71.377308)"> + transform="translate(-32.46875,315.85439)"> + transform="translate(-32.46875,315.85439)"> - - + transform="translate(-32.46875,315.85439)" + style="display:inline" + sodipodi:insensitive="true"> @@ -38088,7 +38081,7 @@ d="M 386.44699,686.89099 C 386.44699,688.40977 385.21577,689.64099 383.69699,689.64099 C 382.17821,689.64099 380.94699,688.40977 380.94699,686.89099 C 380.94699,685.37221 382.17821,684.14099 383.69699,684.14099 C 385.21577,684.14099 386.44699,685.37221 386.44699,686.89099 z" /> @@ -38154,7 +38147,7 @@ d="M 411.435,717.672 C 411.435,719.19078 410.20378,720.422 408.685,720.422 C 407.16621,720.422 405.935,719.19078 405.935,717.672 C 405.935,716.15321 407.16621,714.922 408.685,714.922 C 410.20378,714.922 411.435,716.15321 411.435,717.672 z" /> @@ -38162,39 +38155,39 @@ + sodipodi:nodetypes="cccc" /> - - + + @@ -38202,10 +38195,10 @@ id="layer2-9" inkscape:label="Eagle_speed_sensor" style="display:inline" - transform="matrix(0.77129601,0,0,0.77129601,-838.29825,-434.77767)" /> + transform="matrix(0.77129601,0,0,0.77129601,-880.29617,-190.30059)" /> + transform="matrix(0.77129601,0,0,0.77129601,-757.27445,90.740389)" /> From bf145ad76bd1cdb8c212c3c1138534aa1df9de2c Mon Sep 17 00:00:00 2001 From: Fredrik Larson Date: Tue, 30 Sep 2014 13:16:29 +1000 Subject: [PATCH 20/27] Name change --- ground/openpilotgcs/src/plugins/setupwizard/pages/escpage.ui | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/escpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/escpage.ui index c06ca1d7d..a0f30959c 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/escpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/escpage.ui @@ -26,8 +26,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">To set an optimal configuration of the output signals powering your motors, the wizard needs to know what type of Electronic Speed Controllers (ESCs) you will use and what their capabilities are.</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Please select one of the options below. If you are unsure about the capabilities of your ESCs, just leave the default option selected and continue the wizard.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">To read more regarding ESC refresh rates, please see </span><a href="http://wiki.openpilot.org/x/HIEu"><span style=" font-family:'Lucida Grande'; font-size:13pt; text-decoration: underline; color:#0000ff;">this article</span></a><span style=" font-size:10pt;"> in the OpenPilot Wiki</span></p></body></html> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p></body></html> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -113,7 +112,7 @@ p, li { white-space: pre-wrap; } QToolButton { border: none } - Turbo PWM + Rapid ESC From 8e581a2d18d124ee87e95fd3c73e671b243babeb Mon Sep 17 00:00:00 2001 From: Fredrik Larson Date: Tue, 30 Sep 2014 15:23:05 +1000 Subject: [PATCH 21/27] New buttons --- .../setupwizard/resources/bttn-rapid-dwn.png | Bin 0 -> 5705 bytes .../setupwizard/resources/bttn-rapid-up.png | Bin 0 -> 6527 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 ground/openpilotgcs/src/plugins/setupwizard/resources/bttn-rapid-dwn.png create mode 100644 ground/openpilotgcs/src/plugins/setupwizard/resources/bttn-rapid-up.png diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/bttn-rapid-dwn.png b/ground/openpilotgcs/src/plugins/setupwizard/resources/bttn-rapid-dwn.png new file mode 100644 index 0000000000000000000000000000000000000000..04d5eb559e5dff278a78f3003a44732db812cf73 GIT binary patch literal 5705 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 literal 0 HcmV?d00001 diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/bttn-rapid-up.png b/ground/openpilotgcs/src/plugins/setupwizard/resources/bttn-rapid-up.png new file mode 100644 index 0000000000000000000000000000000000000000..72ffa2cc73bf4a424d5ed638483d9e42b5af96e7 GIT binary patch literal 6527 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 literal 0 HcmV?d00001 From e54d7865af9ca4d9a49d40e25a4c344609c3f049 Mon Sep 17 00:00:00 2001 From: Fredrik Larson Date: Tue, 30 Sep 2014 15:24:34 +1000 Subject: [PATCH 22/27] Add to resources --- ground/openpilotgcs/src/plugins/setupwizard/wizardResources.qrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/wizardResources.qrc b/ground/openpilotgcs/src/plugins/setupwizard/wizardResources.qrc index c320a20e8..898f43f5f 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/wizardResources.qrc +++ b/ground/openpilotgcs/src/plugins/setupwizard/wizardResources.qrc @@ -29,6 +29,8 @@ resources/bttn-calculate-up.png resources/bttn-turbo-down.png resources/bttn-turbo-up.png + resources/bttn-rapid-up.png + resources/bttn-rapid-dwn.png resources/bttn-servo-digital-dwn.png resources/bttn-servo-digital-up.png resources/bttn-servo-standard-dwn.png From 459173300840c18368b086e6b637b0f593e98214 Mon Sep 17 00:00:00 2001 From: Fredrik Larson Date: Tue, 30 Sep 2014 15:37:08 +1000 Subject: [PATCH 23/27] Add new Buttons to Wizard --- ground/openpilotgcs/src/plugins/setupwizard/pages/escpage.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/escpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/escpage.ui index a0f30959c..a086e0f84 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/escpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/escpage.ui @@ -116,8 +116,8 @@ p, li { white-space: pre-wrap; } - :/setupwizard/resources/bttn-turbo-up.png - :/setupwizard/resources/bttn-turbo-down.png:/setupwizard/resources/bttn-turbo-up.png + :/setupwizard/resources/bttn-rapid-up.png + :/setupwizard/resources/bttn-rapid-dwn.png:/setupwizard/resources/bttn-rapid-up.png From 34628cd194eda0afd1f537f02f846bcebc8ead1d Mon Sep 17 00:00:00 2001 From: Fredrik Larson Date: Tue, 30 Sep 2014 15:40:02 +1000 Subject: [PATCH 24/27] Update rates --- ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp | 2 +- .../src/plugins/setupwizard/vehicleconfigurationhelper.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp index f19c6fd51..749ccc179 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp @@ -363,7 +363,7 @@ QString SetupWizard::getSummaryText() summary.append(tr("Standard ESC (50 Hz)")); break; case ESC_RAPID: - summary.append(tr("Rapid ESC (400 Hz)")); + summary.append(tr("Rapid ESC (500 Hz)")); break; default: summary.append(tr("Unknown")); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index f8e7c29a7..08c1bfa27 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -45,7 +45,7 @@ #include const qint16 VehicleConfigurationHelper::LEGACY_ESC_FREQUENCE = 50; -const qint16 VehicleConfigurationHelper::RAPID_ESC_FREQUENCE = 400; +const qint16 VehicleConfigurationHelper::RAPID_ESC_FREQUENCE = 500; const qint16 VehicleConfigurationHelper::ANALOG_SERVO_FREQUENCE = 50; const qint16 VehicleConfigurationHelper::DIGITAL_SERVO_FREQUENCE = 333; From 0556f6f6ad97d9e703cd5b7cb6646bae3257493f Mon Sep 17 00:00:00 2001 From: Fredrik Larson Date: Tue, 30 Sep 2014 15:47:01 +1000 Subject: [PATCH 25/27] uncrusty --- .../src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h | 1 - .../src/plugins/config/configstabilizationwidget.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h index 1821190c0..5e25d99d3 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h @@ -71,7 +71,6 @@ protected: private slots: virtual void setupUI(QString airframeType); virtual bool throwConfigError(QString airframeType); - }; #endif // CONFIGFIXEDWINGWIDGET_H diff --git a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp index e8dbadbee..9c8af326d 100644 --- a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp @@ -344,6 +344,7 @@ void ConfigStabilizationWidget::onBoardConnected() void ConfigStabilizationWidget::pidBankChanged(int index) { bool dirty = isDirty(); + updateObjectFromThrottleCurve(); foreach(QTabBar * tabBar, m_pidTabBars) { disconnect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(pidBankChanged(int))); From ffdfa62d2207b8dcb02becf7641cfad5c72ea8f1 Mon Sep 17 00:00:00 2001 From: Fredrik Larson Date: Tue, 30 Sep 2014 16:54:24 +1000 Subject: [PATCH 26/27] Bandwidth testing --- shared/uavobjectdefinition/attitudestate.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/uavobjectdefinition/attitudestate.xml b/shared/uavobjectdefinition/attitudestate.xml index 98ceaa3c7..0d5dc0c08 100644 --- a/shared/uavobjectdefinition/attitudestate.xml +++ b/shared/uavobjectdefinition/attitudestate.xml @@ -10,7 +10,7 @@ - + From 4c88d878d407d2d4a6a9a818bcc24d9d321b7b3e Mon Sep 17 00:00:00 2001 From: Fredrik Larson Date: Tue, 30 Sep 2014 23:32:26 +1000 Subject: [PATCH 27/27] add 500 as an option --- .../openpilotgcs/src/plugins/config/output.ui | 54 ++++++++++++++----- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/output.ui b/ground/openpilotgcs/src/plugins/config/output.ui index 575b03e58..a09aa8f88 100644 --- a/ground/openpilotgcs/src/plugins/config/output.ui +++ b/ground/openpilotgcs/src/plugins/config/output.ui @@ -282,8 +282,8 @@ - Setup "TurboPWM" here: usual value is 400 Hz for multirotor airframes. -Leave at 50Hz for fixed wing. + Setup "RapidESC" here: usual value is 500 Hz for multirotor airframes. + @@ -320,6 +320,11 @@ Leave at 50Hz for fixed wing. 400 + + + 500 + + @@ -340,8 +345,8 @@ Leave at 50Hz for fixed wing. - Setup "TurboPWM" here: usual value is 400 Hz for multirotor airframes. -Leave at 50Hz for fixed wing. + Setup "RapidESC" here: usual value is 500 Hz for multirotor airframes. + @@ -378,6 +383,11 @@ Leave at 50Hz for fixed wing. 400 + + + 500 + + @@ -420,8 +430,8 @@ Leave at 50Hz for fixed wing. - Setup "TurboPWM" here: usual value is 400 Hz for multirotor airframes. -Leave at 50Hz for fixed wing. + Setup "RapidESC" here: usual value is 500 Hz for multirotor airframes. + @@ -458,6 +468,11 @@ Leave at 50Hz for fixed wing. 400 + + + 500 + + @@ -478,8 +493,8 @@ Leave at 50Hz for fixed wing. - Setup "TurboPWM" here: usual value is 400 Hz for multirotor airframes. -Leave at 50Hz for fixed wing. + Setup "RapidESC" here: usual value is 500 Hz for multirotor airframes. + @@ -516,6 +531,11 @@ Leave at 50Hz for fixed wing. 400 + + + 500 + + @@ -546,8 +566,8 @@ Leave at 50Hz for fixed wing. - Setup "TurboPWM" here: usual value is 400 Hz for multirotor airframes. -Leave at 50Hz for fixed wing. + Setup "RapidESC" here: usual value is 500 Hz for multirotor airframes. + @@ -584,6 +604,11 @@ Leave at 50Hz for fixed wing. 400 + + + 500 + + @@ -604,8 +629,8 @@ Leave at 50Hz for fixed wing. - Setup "TurboPWM" here: usual value is 400 Hz for multirotor airframes. -Leave at 50Hz for fixed wing. + Setup "RapidESC" here: usual value is 500 Hz for multirotor airframes. + @@ -642,6 +667,11 @@ Leave at 50Hz for fixed wing. 400 + + + 500 + +