Skip to content

Commit

Permalink
uncommented auto-crash-stopper from modifying the sample rate
Browse files Browse the repository at this point in the history
  • Loading branch information
cmayor314 authored Jun 18, 2022
1 parent f87efd3 commit 99b180e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fft_dashboard_tab_subflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,7 @@
"type": "function",
"z": "6805408c9bb2bde9",
"name": "ADJECT (adjust) - 1+AB",
"func": "var timeBetweenPayloads = context.get('timeBetweenPayloads')||0;\nvar fftcalcdelay = context.get('fftcalcdelay')||0;\nvar currentBufferSize = context.get('currentBufferSize')||0;\n\nif ('undefined' != typeof msg.setNewBufferSize)\n{ \n if (0 != msg.payload) //zero (0) indicates an invalid buffer size\n {\n currentBufferSize = msg.setNewBufferSize;\n }\n context.set('currentBufferSize',currentBufferSize);\n}\n \nif ('undefined' != typeof msg.timeBetweenPayloads)\n{\n timeBetweenPayloads = Number(msg.timeBetweenPayloads);\n context.set('timeBetweenPayloads',timeBetweenPayloads);\n}\n\nif ('undefined' != typeof msg.fftcalcdelay)\n{\n fftcalcdelay = Number(msg.fftcalcdelay);\n context.set('fftcalcdelay',msg.fftcalcdelay);\n}\n\n\nnode.status({\"text\":\"cBS:\"+currentBufferSize\n +\" - tBP:\"+ timeBetweenPayloads+\"mS\"\n +\" - fftCD:\"+fftcalcdelay+\"mS\"});\n \nmsg.currentBufferSize = currentBufferSize;\nmsg.timeBetweenPayloads = timeBetweenPayloads;\nmsg.fftcalcdelay = fftcalcdelay;\n\nif (2*fftcalcdelay > timeBetweenPayloads)\n{\n //either slow down the data rate, or decrease the FFT sample size\n \n //slow down the data rate - send to the data rate limiter\n msg.rate = 2*fftcalcdelay+1; //plus one so we don't set a rate to zero\n node.warn({\"text\":\"WARN: downstream sample rate has been artificially\"\n +\" adjusted. Beware Aliasing.\"})\n \n //decrease the FFT sample size - send to the sample size selection\n msg.payload = currentBufferSize/2;\n return [msg,msg,msg];\n}\n\nif ('object' != typeof msg.payload)\n return [null,null,null];\nelse\n return [msg,null,null];\n",
"func": "var timeBetweenPayloads = context.get('timeBetweenPayloads')||0;\nvar fftcalcdelay = context.get('fftcalcdelay')||0;\nvar currentBufferSize = context.get('currentBufferSize')||0;\n\nif ('undefined' != typeof msg.setNewBufferSize)\n{ \n if (0 != msg.payload) //zero (0) indicates an invalid buffer size\n {\n currentBufferSize = msg.setNewBufferSize;\n }\n context.set('currentBufferSize',currentBufferSize);\n}\n \nif ('undefined' != typeof msg.timeBetweenPayloads)\n{\n timeBetweenPayloads = Number(msg.timeBetweenPayloads);\n context.set('timeBetweenPayloads',timeBetweenPayloads);\n}\n\nif ('undefined' != typeof msg.fftcalcdelay)\n{\n fftcalcdelay = Number(msg.fftcalcdelay);\n context.set('fftcalcdelay',msg.fftcalcdelay);\n}\n\n\nnode.status({\"text\":\"cBS:\"+currentBufferSize\n +\" - tBP:\"+ timeBetweenPayloads+\"mS\"\n +\" - fftCD:\"+fftcalcdelay+\"mS\"});\n \nmsg.currentBufferSize = currentBufferSize;\nmsg.timeBetweenPayloads = timeBetweenPayloads;\nmsg.fftcalcdelay = fftcalcdelay;\n\nif (2*fftcalcdelay > timeBetweenPayloads)\n{\n //either slow down the data rate, or decrease the FFT sample size\n \n //slow down the data rate - send to the data rate limiter\n /*\n msg.rate = 2*fftcalcdelay+1; //plus one so we don't set a rate to zero\n node.warn({\"text\":\"WARN: downstream sample rate has been artificially\"\n +\" adjusted. Beware Aliasing.\"})\n //DANGER WILL ROBINSON, ALIASING LEADS TO MADNESS\n */\n \n //decrease the FFT sample size - send to the sample size selection\n msg.payload = currentBufferSize/2;\n //return [msg,msg,msg]; //uncomment if using the sampling rate gateway\n \n return [msg,msg,null]; //do not update the sampling rate gateway\n}\n\nif ('object' != typeof msg.payload)\n return [null,null,null];\nelse\n return [msg,null,null];\n",
"outputs": 3,
"noerr": 0,
"initialize": "",
Expand Down

0 comments on commit 99b180e

Please sign in to comment.