//This function updates the backlight, applies screen strings if they have //changed, and applies menu hints. Up to now, variables topLCDLine and //bottomLCDLine have been set to the desired strings. This keeps the LCD from //being cleared and set excessively (which causes ugly blinking). void outputLCD() { updateBacklight(); if (changedString(topLCDLine)) { clearLCDLine(0); displayLCDCenteredString(0,topLCDLine.curr); } if (changedString(bottomLCDLine)) { clearLCDLine(1); displayLCDCenteredString(1,bottomLCDLine.curr); } #ifdef MENU_WRAP //Wrap if (sysState.curr != AUTONOMOUS && sysError==ERR_NONE) { displayLCDString(0,0, "<"); displayLCDString(0,15,">"); } #else //No wrap if (sysState.curr != AUTONOMOUS && sysError==ERR_NONE) { if (menuItemIndex>0) displayLCDString(0,0, "<"); //If not at the first item, show prev arrow if (menuItemIndex<(int)M_NO_ITEMS-1) displayLCDString(0,15,">"); //If not at the last item, show next arrow } #endif setLastString(&topLCDLine); setLastString(&bottomLCDLine); }
int __stdcall Eval(duk_context *ctx, char* js ){ #pragma EXPORT int rv = 0; if(ctx == 0) return -1; //safe to call eval to avoid fatal panic handler on syntax error duk_push_string(ctx, js); startTime = GetTickCount(); if (duk_peval(ctx) != 0) { setLastString(duk_safe_to_string(ctx, -1)); rv = -1; } else { setLastString(duk_safe_to_string(ctx, -1)); } duk_pop(ctx); return rv; }
int __stdcall AddFile(duk_context *ctx, char* pth){ #pragma EXPORT int rv; char* l; if(ctx == 0) return -1; startTime = GetTickCount(); rv = duk_peval_file(ctx, pth); //0 = success if(rv != 0){ setLastString(duk_safe_to_string(ctx, -1)); //error message.. } duk_pop(ctx); /* ignore result */ return rv; }