Reduce OCC polling interval to recommended timing

Increase service process stack sizes
Move power button press message to correct location
parent ac1d6e75
......@@ -9,6 +9,7 @@
#if (WITH_ZEPHYR)
#define KESTREL_SERVICE_THREAD_PRIORITY K_PRIO_PREEMPT(0)
#define THERMAL_SERVICE_THREAD_PRIORITY K_PRIO_COOP(-1)
#endif
#if (WITH_ZEPHYR)
......
......@@ -24,14 +24,14 @@ static struct gpio_callback host_power_button_callback_data;
static struct gpio_callback host_reset_button_callback_data;
#define KESTREL_INIT_THREAD_PRIORITY K_PRIO_PREEMPT(CONFIG_NUM_PREEMPT_PRIORITIES - 1)
static K_THREAD_STACK_DEFINE(kestrel_init_thread_stack, 16384);
static K_THREAD_STACK_DEFINE(kestrel_init_thread_stack, 65536);
static struct k_thread kestrel_init_thread_data;
static struct k_sem kestrel_init_thread_lock;
static K_THREAD_STACK_DEFINE(kestrel_service_thread_stack, 16384);
static K_THREAD_STACK_DEFINE(kestrel_service_thread_stack, 65536);
static struct k_thread kestrel_service_thread_data;
static K_THREAD_STACK_DEFINE(thermal_service_thread_stack, 16384);
static K_THREAD_STACK_DEFINE(thermal_service_thread_stack, 65536);
static struct k_thread thermal_service_thread_data;
#define KESTREL_IDLE_THREAD_PRIORITY K_PRIO_PREEMPT(CONFIG_NUM_PREEMPT_PRIORITIES - 1)
......@@ -85,12 +85,15 @@ static void thermal_service_thread(void)
k_mutex_unlock(&occ_access_mutex);
k_usleep(100000);
// The OCC can only be safely polled at around a 1s rate
// If this limit is not adhered to, odd responses
// start to come out of the SBE FIFOs...
k_usleep(1000000);
}
else
{
host_cpu_temperature_sensor_count = 0;
k_usleep(100000);
k_usleep(1000000);
}
}
}
......@@ -102,8 +105,6 @@ void host_power_button_pressed(const struct device *dev, struct gpio_callback *c
int want_power_on = 0;
int want_power_off = 0;
LOG_INF("Host power button pressed");
// Deactivate interrupts on entering critical section
int key = irq_lock();
......@@ -119,6 +120,8 @@ void host_power_button_pressed(const struct device *dev, struct gpio_callback *c
if ((k_uptime_get() - last_press) > BUTTON_PRESS_DEBOUNCE_DELAY_MS) {
// The debounce delay has passed since last press, handle request
LOG_INF("Host power button pressed");
if (want_power_on) {
power_on_host();
}
......@@ -235,7 +238,7 @@ void main(void)
thermal_service_thread_id = k_thread_create(&thermal_service_thread_data, thermal_service_thread_stack,
K_THREAD_STACK_SIZEOF(thermal_service_thread_stack),
(k_thread_entry_t)thermal_service_thread,
NULL, NULL, NULL, KESTREL_SERVICE_THREAD_PRIORITY, 0, K_NO_WAIT);
NULL, NULL, NULL, THERMAL_SERVICE_THREAD_PRIORITY, 0, K_NO_WAIT);
k_thread_name_set(thermal_service_thread_id, "thermal_service");
// Run late setup
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment