Skip to content

Commit

Permalink
merge suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
arg7 committed Sep 16, 2024
2 parents 927fe53 + f69b7f4 commit 8eec26b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions libraries/AP_HAL_ESP32/AP_HAL_ESP32.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@


#include "HAL_ESP32_Class.h"

#ifndef NDEBUG
#define DBG_PRINTF(fmt, args ...) do { printf(fmt, ## args); } while(0)
#else
#define DBG_PRINTF(fmt, args ...)
#endif
8 changes: 5 additions & 3 deletions libraries/AP_HAL_ESP32/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <AP_Scheduler/AP_Scheduler.h>
#include <stdio.h>

#include "esp_rom_sys.h"

//#define SCHEDULERDEBUG 1

using namespace ESP32;
Expand Down Expand Up @@ -84,7 +86,7 @@ void Scheduler::init()
#define SLOWCPU 1

// pin main thread to Core 0, and we'll also pin other heavy-tasks to core 1, like wifi-related.
if (xTaskCreatePinnedToCore(_main_thread, "APM_MAIN", Scheduler::MAIN_SS, this, Scheduler::MAIN_PRIO, &_main_task_handle,FASTCPU) != pdPASS) {
if (xTaskCreatePinnedToCore(_main_thread, "APM_MAIN", Scheduler::MAIN_SS, this, Scheduler::MAIN_PRIO, &_main_task_handle, FASTCPU) != pdPASS) {
//if (xTaskCreate(_main_thread, "APM_MAIN", Scheduler::MAIN_SS, this, Scheduler::MAIN_PRIO, &_main_task_handle) != pdPASS) {
hal.console->printf("FAILED to create task _main_thread on FASTCPU\n");
} else {
Expand Down Expand Up @@ -116,7 +118,7 @@ void Scheduler::init()
hal.console->printf("OK created task _uart_thread on FASTCPU\n");
}

// we put thos on the SLOW core as it mounts the sd card, and that often isn't conencted.
// we put those on the SLOW core as it mounts the sd card, and that often isn't conencted.
if (xTaskCreatePinnedToCore(_io_thread, "SchedulerIO:APM_IO", IO_SS, this, IO_PRIO, &_io_task_handle,SLOWCPU) != pdPASS) {
hal.console->printf("FAILED to create task _io_thread on SLOWCPU\n");
} else {
Expand Down Expand Up @@ -535,7 +537,7 @@ void Scheduler::print_main_loop_rate(void)
// null pointer in here...
const float actual_loop_rate = AP::scheduler().get_filtered_loop_rate_hz();
const uint16_t expected_loop_rate = AP::scheduler().get_loop_rate_hz();
hal.console->printf("loop_rate: actual: %fHz, expected: %uHz\n", actual_loop_rate, expected_loop_rate);
printf("loop_rate: actual: %fHz, expected: %uHz\n", actual_loop_rate, expected_loop_rate);
}
}

Expand Down

0 comments on commit 8eec26b

Please sign in to comment.