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/cw-example/cw.c | |
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/cw-example/cw.c')
-rw-r--r-- | src/cw-example/cw.c | 15 |
1 files changed, 7 insertions, 8 deletions
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 |