Post your best Lua script examples here

User avatar
By xtal
#38868 I have the following Header table that displays a java counter..that consides with Resfresh
The counter is functioning , I think properly, The displayed count has a glitch.
if set for 7-0 6-7-6-5-4-3-2-1-0-6-7 etc the glitch 6->7 is shorter than the down interval 1 second
if set for 15-0 14-15-14-13-12~~5-4-3-2-1-0-14-15-14-13 etc the glitch 14->15 is shorter than the down interval 1 second...

Does anybody have any clues how to rid the glitch ?

Code: Select allString Header()  { 
  String h1 = "<!DOCTYPE HTML>\n<html lang='en-US'>\n<head><meta http-equiv='refresh' content=";
  h1 += RFH;           // Page refresh Time
  h1 += "></head>";
/*------------------------counter script -----------------------------------------------------------------------------*/ 
  h1 += "<script type = 'text/javascript'>\nvar timeInSecs;\nvar ticker;";
  h1 += "function startTimer(secs){ timeInSecs = parseInt(secs)-1; ticker = setInterval('tick()',1000); }";
  h1 += "function tick() { var secs = timeInSecs; if (secs>0) {timeInSecs--;} else {clearInterval(ticker); startTimer(";
  h1 += rfh;
  h1 += ");}";
  h1 += "document.getElementById('countdown').innerHTML = secs;} startTimer(";
  h1 += rfh;
  h1 += "); </script>";
/*-------------------------------------------------------------------------------------------------------------------*/ 
  h1 += "<body><div><table bgcolor='Lawngreen' border='1' cellpadding='5'>";
  h1 += "<th><h1>ESP8266</h1></th><th>";
/*---- String zver = "<h1>ESP8266 SDK 1.4.0 Version!</h1>";   //  Header Line  */ 
  h1 += zver;    //zver = "<h1>ESP8266 SDK "
  h1 += bver;    //bver = "1.4.0"
  h1 += cver;    //cver = " Version!</h1>"
  h1 += "</th><td><IMG SRC=";
  h1 += s_img;
  h1 += " LEFT='1' WIDTH='120' HEIGHT='60' BORDER='1'></td>";
  h1 += "<th id='countdown'>";
 
  h1 += rfh;                         // the refresh display
 
  h1 += "</th>";
  h1 += "<tr><th>";
  h1 += vtx;
  h1 +="</th><th>BAUD = ";
  h1 += baud;
  h1 += "</th><th>";
 // h1 += Sze;
  h1 += ((Pass++/2)+1) ;
  h1 += "</th><th>";
  h1 += Sze;
  h1 += "</th></tr></table><div><br>";
  LH = h1.length();
  return h1;
User avatar
By xtal
#38874 I'm thinking it must be time lag count down vs reload....

Count goes to 0 then 1 second later
Count goes to 7 [ I'm not seeing this ] then 1 second later
Count goes to 6 < header is now reloading >
Count goes back to 7 or whatever max count is

I have no clue how to compensate for this ? ANYBODY have a suggestion ?
thx in advance