Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions Tools/AP_Periph/AP_Periph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,29 @@ void AP_Periph_FW::update()
node_stats.update();
#endif

static uint32_t last_led_ms;
uint32_t now = AP_HAL::millis();
if (now - last_led_ms > 1000) {
last_led_ms = now;

#ifdef HAL_GPIO_PIN_LED
static uint32_t last_led_ms;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we drop this into a flash_led method, please?

static uint32_t next_led_ms = 1000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
static uint32_t next_led_ms = 1000;
static uint32_t current_led_interval_ms = 1000;

if (now - last_led_ms > next_led_ms) {
last_led_ms = now;
if (!no_iface_finished_dna) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this mean the code will be non-functional, depending on whether it has dna'd or not?

static uint8_t led_phase = 0;
if (debug_option_is_set(DebugOptions::FIND_NODE)) {
next_led_ms = (led_phase < 10) ? 100 : 500;
led_phase = (led_phase + 1) % 12;
} else {
next_led_ms = 1000;
}
palToggleLine(HAL_GPIO_PIN_LED);
}
}
#endif

static uint32_t last_1_s;
if (now - last_1_s > 1000) {
last_1_s = now;
#if 0
#if AP_PERIPH_GPS_ENABLED
hal.serial(0)->printf("GPS status: %u\n", (unsigned)gps.status());
Expand Down
1 change: 1 addition & 0 deletions Tools/AP_Periph/AP_Periph.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ class AP_Periph_FW {
SHOW_STACK = 0,
AUTOREBOOT = 1,
ENABLE_STATS = 2,
FIND_NODE = 3,
};

// check if an option is set
Expand Down
2 changes: 1 addition & 1 deletion Tools/AP_Periph/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const AP_Param::Info AP_Periph_FW::var_info[] = {
// @Param: DEBUG
// @DisplayName: Debug
// @Description: Debug
// @Bitmask: 0:Show free stack space, 1:Auto Reboot after 15sec, 2:Enable sending stats
// @Bitmask: 0:Show free stack space, 1:Auto Reboot after 15sec, 2:Enable sending stats, 3: Locate Node by LED flash pattern
// @User: Advanced
GSCALAR(debug, "DEBUG", 0),

Expand Down