Commit 5f803468 authored by Projects's avatar Projects

Fixed xQueueReceive() ticks-to-wait parameter in tasks.

parent 347afa14
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
#include <em_gpio.h> #include <em_gpio.h>
#include <em_timer.h> #include <em_timer.h>
#define BUZZER_PWM_FREQ 10000
void buzzer_init(void) void buzzer_init(void)
{ {
// Configure buzzer pin as push/pull output // Configure buzzer pin as push/pull output
......
...@@ -105,7 +105,7 @@ void clock_main(void* params) { ...@@ -105,7 +105,7 @@ void clock_main(void* params) {
// Event loop // Event loop
while(1) { while(1) {
if(xQueueReceive(appQueue, &evt, 0)) { if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) if(evt.data.button == BUT_TR)
......
...@@ -132,7 +132,7 @@ void compass_main(void *params) ...@@ -132,7 +132,7 @@ void compass_main(void *params)
/*main loop*/ /*main loop*/
while(1) { while(1) {
if(xQueueReceive(appQueue, &evt, 0)) { if(xQueueReceive(appQueue, &evt, 100 / portTICK_RATE_MS)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) if(evt.data.button == BUT_TR)
......
...@@ -69,14 +69,14 @@ static void widget_event(struct ui_widget *w, const struct event *evt) ...@@ -69,14 +69,14 @@ static void widget_event(struct ui_widget *w, const struct event *evt)
// short vibration // short vibration
vibra_enable(); vibra_enable();
vTaskDelay(100); vTaskDelay(400 / portTICK_RATE_MS);
vibra_disable(); vibra_disable();
break; break;
case RTC_TICK: case RTC_TICK:
// tick-tock with a buzzer // tick-tock with a buzzer
buzzer_enable(); buzzer_enable();
vTaskDelay(100); vTaskDelay(400 / portTICK_RATE_MS);
buzzer_disable(); buzzer_disable();
// ok, we do not need redrawing // ok, we do not need redrawing
w->flags &= ~WF_DIRTY; w->flags &= ~WF_DIRTY;
...@@ -137,7 +137,7 @@ void example_main(void* params) { ...@@ -137,7 +137,7 @@ void example_main(void* params) {
// "0" in the line below, if you set it to a positive value then // "0" in the line below, if you set it to a positive value then
// you may have a block of code that is executed when no event arrives // you may have a block of code that is executed when no event arrives
// for details, see below (else block) // for details, see below (else block)
if(xQueueReceive(appQueue, &evt, 0)) { if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) { switch(evt.type) {
// decide which events are relevant and should be handled // decide which events are relevant and should be handled
// you may save some cycles if you list them here instead of // you may save some cycles if you list them here instead of
......
...@@ -126,7 +126,7 @@ void game_main(void *params) ...@@ -126,7 +126,7 @@ void game_main(void *params)
/*main loop*/ /*main loop*/
while(1) { while(1) {
if(xQueueReceive(appQueue, &evt, 0)) { if(xQueueReceive(appQueue, &evt, 30 / portTICK_RATE_MS)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) { if(evt.data.button == BUT_TR) {
...@@ -173,7 +173,7 @@ void game_main(void *params) ...@@ -173,7 +173,7 @@ void game_main(void *params)
win_y1 = S_WIN_Y1; win_y1 = S_WIN_Y1;
vibra_enable(); vibra_enable();
buzzer_enable(); buzzer_enable();
vTaskDelay(100); vTaskDelay(300 / portTICK_RATE_MS);
vibra_disable(); vibra_disable();
buzzer_disable(); buzzer_disable();
} else { } else {
......
...@@ -153,7 +153,7 @@ void gpscoord_main(void *params) ...@@ -153,7 +153,7 @@ void gpscoord_main(void *params)
ui_update(NULL); ui_update(NULL);
while (1) { while (1) {
if (xQueueReceive(appQueue, &evt, 0)) { if (xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch (evt.type) { switch (evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if (evt.data.button == BUT_TR) if (evt.data.button == BUT_TR)
......
...@@ -195,7 +195,7 @@ void menu_main(void* params) { ...@@ -195,7 +195,7 @@ void menu_main(void* params) {
// Once it is deactivated - display the menu // Once it is deactivated - display the menu
while(1) { while(1) {
if(xQueueReceive(appQueue, &evt, 0)) { if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TL) { if(evt.data.button == BUT_TL) {
......
...@@ -60,7 +60,7 @@ void reset_main(void *params) ...@@ -60,7 +60,7 @@ void reset_main(void *params)
ui_update(NULL); ui_update(NULL);
while(1) { while(1) {
if (xQueueReceive(appQueue, &evt, 0)) { if (xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch (evt.type) { switch (evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if (evt.data.button == BUT_TR) if (evt.data.button == BUT_TR)
......
...@@ -175,7 +175,7 @@ void set_date_main(void* params) { ...@@ -175,7 +175,7 @@ void set_date_main(void* params) {
// event loop // event loop
while(1) { while(1) {
if(xQueueReceive(appQueue, &evt, 0)) { if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TL) { if(evt.data.button == BUT_TL) {
......
...@@ -165,7 +165,7 @@ void set_gmt_ofs_main(void* params) { ...@@ -165,7 +165,7 @@ void set_gmt_ofs_main(void* params) {
// event loop // event loop
while(1) { while(1) {
if(xQueueReceive(appQueue, &evt, 0)) { if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TL) { if(evt.data.button == BUT_TL) {
......
...@@ -140,7 +140,7 @@ void set_time_main(void* params) { ...@@ -140,7 +140,7 @@ void set_time_main(void* params) {
// event loop // event loop
while(1) { while(1) {
if(xQueueReceive(appQueue, &evt, 0)) { if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TL) { if(evt.data.button == BUT_TL) {
......
...@@ -90,7 +90,7 @@ void usb_ms_main(void* params) { ...@@ -90,7 +90,7 @@ void usb_ms_main(void* params) {
while(1) { while(1) {
if(xQueueReceive(appQueue, &evt, 1)) { if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) { switch(evt.type) {
case BUTTON_PRESSED: case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) { if(evt.data.button == BUT_TR) {
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <stdbool.h> #include <stdbool.h>
///> Number of ticks between battery status polling ///> Number of ticks between battery status polling
#define BATTERY_TASK_PERIOD 4000 #define BATTERY_TASK_PERIOD (4000 / portTICK_RATE_MS)
///> Timer handle ///> Timer handle
static xTimerHandle timer_handle; static xTimerHandle timer_handle;
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <drivers/light_sensor.h> #include <drivers/light_sensor.h>
///> Number of ticks between backlight adjustments ///> Number of ticks between backlight adjustments
#define BLIGHT_TASK_PERIOD 3000 #define BLIGHT_TASK_PERIOD (5000 / portTICK_RATE_MS)
///> Entry that stores an appropriate backlight level value ///> Entry that stores an appropriate backlight level value
///> depending on the light sensor readings. ///> depending on the light sensor readings.
......
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