diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-12-07 21:29:48 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-12-07 21:29:48 +0100 |
commit | 2a656f2c6313645eaa9f26e5123fa630b96b0363 (patch) | |
tree | cbf5658a5bd49a5266be7d1d059cd6e350c938ce /src | |
parent | 63545495ed0dd1fe6e03cb2b4a5673695d5b7103 (diff) | |
download | glutte-o-matic-2a656f2c6313645eaa9f26e5123fa630b96b0363.tar.gz glutte-o-matic-2a656f2c6313645eaa9f26e5123fa630b96b0363.tar.bz2 glutte-o-matic-2a656f2c6313645eaa9f26e5123fa630b96b0363.zip |
Fix stack overflow, it resembles CW now
Diffstat (limited to 'src')
-rw-r--r-- | src/cw-example/FreeRTOSConfig.h | 2 | ||||
-rw-r--r-- | src/cw-example/cw.c | 15 | ||||
-rw-r--r-- | src/cw-example/main.c | 8 |
3 files changed, 15 insertions, 10 deletions
diff --git a/src/cw-example/FreeRTOSConfig.h b/src/cw-example/FreeRTOSConfig.h index 0096216..11427d8 100644 --- a/src/cw-example/FreeRTOSConfig.h +++ b/src/cw-example/FreeRTOSConfig.h @@ -99,7 +99,7 @@ #define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8
-#define configCHECK_FOR_STACK_OVERFLOW 0 // Default: 2
+#define configCHECK_FOR_STACK_OVERFLOW 2 // Default: 2
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_MALLOC_FAILED_HOOK 0 // Default: 1
#define configUSE_APPLICATION_TASK_TAG 0
diff --git a/src/cw-example/cw.c b/src/cw-example/cw.c index f69c365..02e65d3 100644 --- a/src/cw-example/cw.c +++ b/src/cw-example/cw.c @@ -208,15 +208,11 @@ size_t cw_fill_buffer(int16_t *buf, size_t bufsize) { static float nco_phase = 0.0f; - char msg[40]; if (cw_fill_msg_status == 0) { int waiting = uxQueueMessagesWaitingFromISR(cw_queue); - if (waiting > 0) { - sprintf(msg, "we have %d\n", waiting); - debug_print(msg); - } - if (uxQueueMessagesWaitingFromISR(cw_queue) > 0 && +#if 1 + if (waiting > 0 && xQueueReceiveFromISR(cw_queue, &cw_fill_msg_current, NULL)) { // Convert msg to audio samples and transmit cw_fill_msg_status = 1; @@ -225,10 +221,13 @@ size_t cw_fill_buffer(int16_t *buf, size_t bufsize) else { return 0; } +#else + return 0; +#endif } -#if 0 - const int samples_per_dit = (cw_samplerate * 1000) / +#if 1 + const int samples_per_dit = (cw_samplerate * 10) / cw_fill_msg_current.dit_duration; // Angular frequency of NCO diff --git a/src/cw-example/main.c b/src/cw-example/main.c index 456d4fe..2b19177 100644 --- a/src/cw-example/main.c +++ b/src/cw-example/main.c @@ -29,6 +29,12 @@ struct cw_msg_s { int dit_duration; }; +void vApplicationStackOverflowHook( TaskHandle_t xTask, + signed char *pcTaskName ) +{ + while (1) {}; +} + int main(void) { init(); @@ -40,7 +46,7 @@ int main(void) { xTaskCreate( detect_button_press, "TaskButton", - configMINIMAL_STACK_SIZE, + 4*configMINIMAL_STACK_SIZE, (void*) NULL, tskIDLE_PRIORITY + 2UL, NULL); |