|
25 | 25 | #include "jsflash.h" // load and save to flash |
26 | 26 | #include "jswrap_interactive.h" // jswrap_interactive_setTimeout |
27 | 27 | #include "jswrap_object.h" // jswrap_object_keys_or_property_names |
| 28 | +#include "jswrap_timer.h" // jstOnRunInterruptJSEvent |
28 | 29 | #include "jsnative.h" // jsnSanityTest |
29 | 30 | #include "jswrap_storage.h" // for Packet Transfer IO |
30 | 31 | #ifdef USE_FILESYSTEM |
@@ -2204,21 +2205,6 @@ void jsiHandleIOEventForConsole(uint8_t *eventData, int eventLen) { |
2204 | 2205 | jsiSetBusy(BUSY_INTERACTIVE, false); |
2205 | 2206 | } |
2206 | 2207 |
|
2207 | | -/** This is called if a EV_RUN_INTERRUPT_JS is received, or when a EXEC_RUN_INTERRUPT_JS is set. |
2208 | | -It executes JavaScript code that was pushed to the queue by a require("timer").add({type:"EXEC", fn:myFunction... */ |
2209 | | -static void jsiOnRunInterruptJSEvent(const uint8_t *eventData, unsigned int eventLen) { |
2210 | | - for (unsigned int i=0;i<eventLen;i++) { |
2211 | | - uint8_t timerIdx = eventData[i]; |
2212 | | - JsVar *timerFns = jsvObjectGetChildIfExists(execInfo.hiddenRoot, JSI_TIMER_RUN_JS_NAME); |
2213 | | - if (timerFns) { |
2214 | | - JsVar *fn = jsvGetArrayItem(timerFns, timerIdx); |
2215 | | - if (jsvIsFunction(fn)) |
2216 | | - jsvUnLock(jspExecuteFunction(fn, execInfo.root, 0, NULL)); |
2217 | | - jsvUnLock2(timerFns, fn); |
2218 | | - } |
2219 | | - } |
2220 | | -} |
2221 | | - |
2222 | 2208 | void jsiIdle() { |
2223 | 2209 | // This is how many times we have been here and not done anything. |
2224 | 2210 | // It will be zeroed if we do stuff later |
@@ -2264,7 +2250,7 @@ void jsiIdle() { |
2264 | 2250 | jsvUnLock(usartClass); |
2265 | 2251 | #endif |
2266 | 2252 | } else if (eventType == EV_RUN_INTERRUPT_JS) { |
2267 | | - jsiOnRunInterruptJSEvent(eventData, eventLen); |
| 2253 | + jstOnRunInterruptJSEvent(eventData, eventLen); |
2268 | 2254 | } else if (eventType == EV_CUSTOM) { |
2269 | 2255 | jstOnCustomEvent(eventFlags, eventData, eventLen); |
2270 | 2256 | jswOnCustomEvent(eventFlags, eventData, eventLen); |
@@ -3021,13 +3007,4 @@ void jsiDebuggerLine(JsVar *line) { |
3021 | 3007 | } |
3022 | 3008 | #endif // USE_DEBUGGER |
3023 | 3009 |
|
3024 | | -/** This is called from the parser if EXEC_RUN_INTERRUPT_JS is set. |
3025 | | -It executes JavaScript code that was pushed to the queue by require("timer").add({type:"EXEC", fn:myFunction... */ |
3026 | | -void jsiRunInterruptingJS() { |
3027 | | - uint8_t data[IOEVENT_MAX_LEN]; |
3028 | | - memset(data, 0, sizeof(data)); |
3029 | | - unsigned int len; |
3030 | | - if (jshPopIOEventOfType(EV_RUN_INTERRUPT_JS, data, &len)) |
3031 | | - jsiOnRunInterruptJSEvent(data, sizeof(data)); |
3032 | | -} |
3033 | 3010 |
|
0 commit comments