From 55b291eb500d21b86205760c5954217f0b892b01 Mon Sep 17 00:00:00 2001 From: Ian Gray Date: Sun, 16 Jan 2022 14:47:41 +0000 Subject: [PATCH 1/3] Support update of Button text --- data/js/controls.js | 1 + data/js/controls.min.js | 2 +- src/ESPUI.cpp | 4 ++++ src/ESPUI.h | 1 + src/dataControlsJS.h | 4 ++-- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/data/js/controls.js b/data/js/controls.js index 9339c08..2d22e28 100644 --- a/data/js/controls.js +++ b/data/js/controls.js @@ -537,6 +537,7 @@ function start() { case UPDATE_BUTTON: $("#btn" + data.id).val(data.value); + $("#btn" + data.id).text(data.value); if(data.hasOwnProperty('elementStyle')) { $("#btn" + data.id).attr("style", data.elementStyle); } diff --git a/data/js/controls.min.js b/data/js/controls.min.js index 38b95e3..a14985c 100644 --- a/data/js/controls.min.js +++ b/data/js/controls.min.js @@ -37,7 +37,7 @@ slider_move($("#id"+data.id),data.value,"100",false);if(data.hasOwnProperty('ele break;case UPDATE_NUMBER:$("#num"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#num"+data.id).attr("style",data.elementStyle);} break;case UPDATE_TEXT_INPUT:$("#text"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#text"+data.id).attr("style",data.elementStyle);} break;case UPDATE_SELECT:$("#select"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#select"+data.id).attr("style",data.elementStyle);} -break;case UPDATE_BUTTON:$("#btn"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#btn"+data.id).attr("style",data.elementStyle);} +break;case UPDATE_BUTTON:$("#btn"+data.id).val(data.value);$("#btn"+data.id).text(data.value);if(data.hasOwnProperty('elementStyle')){$("#btn"+data.id).attr("style",data.elementStyle);} break;case UPDATE_PAD:case UPDATE_CPAD:break;case UPDATE_GAUGE:$("#gauge"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#gauge"+data.id).attr("style",data.elementStyle);} break;case UPDATE_ACCEL:break;default:console.error("Unknown type or event");break;} if(data.type>=UPDATE_OFFSET&&data.type=UPDATE_OFFSET&&data.type";case UI_NUMBER:return"
";default:return"";}}
 )=====";
 
-const uint8_t JS_CONTROLS_GZIP[3872] PROGMEM = { 31,139,8,0,160,63,227,97,2,255,197,27,107,115,218,72,242,187,127,133,172,108,5,113,96,30,121,109,22,44,167,8,38,9,183,196,246,217,120,179,117,217,156,75,136,193,168,44,36,173,36,140,189,14,255,253,122,122,30,154,17,2,179,120,247,238,75,140,122,122,122,122,186,123,166,95,19,55,12,146,212,184,236,95,245,79,250,195,126,103,112,245,241,178,111,191,104,52,218,174,24,56,239,13,78,59,199,0,107,10,216,217,113,103,216,187,58,253,240,225,162,55,180,155,42,110,239,215,97,239,228,152,209,104,42,240,97,127,216,27,216,10,224,12,40,230,232,33,40,91,164,127,213,165,144,23,58,82,151,97,189,200,176,222,95,14,135,167,39,246,75,29,143,67,155,141,151,25,230,160,243,30,152,120,165,35,50,96,179,241,42,195,187,248,210,31,118,63,245,206,237,215,58,170,132,55,27,175,21,236,65,255,24,96,111,114,184,12,218,108,188,201,48,79,46,63,191,7,216,143,58,38,135,54,27,63,42,226,2,57,130,66,206,46,135,246,91,29,91,25,105,54,222,102,51,62,158,119,206,62,217,63,113,64,231,248,152,65,174,206,78,251,39,20,149,15,116,7,189,206,57,71,110,54,126,82,86,236,188,183,155,57,133,48,152,162,144,139,222,160,215,5,106,57,157,8,112,83,209,202,233,217,176,79,229,159,83,139,0,55,21,181,124,238,3,32,167,21,132,53,21,157,124,238,252,106,55,115,250,64,88,83,85,197,176,119,102,55,243,154,64,96,83,209,195,199,206,229,199,158,221,204,233,129,67,155,138,26,58,221,46,181,141,156,10,56,180,249,86,21,204,89,231,188,51,60,5,53,254,148,151,141,28,81,134,228,73,56,62,253,114,34,207,193,160,247,97,40,237,253,188,255,241,211,80,90,117,183,119,50,4,35,17,2,233,94,13,47,207,255,117,121,218,191,232,73,82,221,171,222,231,222,121,103,144,157,171,238,213,89,15,102,157,247,127,129,169,47,36,240,75,111,216,185,56,251,212,25,40,228,175,46,46,79,62,12,78,191,104,107,116,59,231,231,167,67,121,10,186,87,157,65,255,223,157,115,80,205,27,9,58,238,156,255,44,45,186,123,117,114,122,210,179,95,188,126,221,190,117,98,227,58,118,162,233,177,147,58,118,64,22,70,39,142,157,123,171,140,35,83,39,233,184,46,241,237,137,227,39,4,65,137,239,141,73,220,13,131,212,11,230,225,60,225,67,147,121,224,166,94,24,24,110,232,135,113,215,119,146,196,194,159,253,113,249,129,255,176,79,230,179,17,137,37,188,157,44,188,212,157,42,120,78,66,84,153,181,98,146,206,227,192,132,127,126,159,135,94,66,204,54,71,225,34,20,8,100,70,98,199,31,203,225,76,158,2,35,34,41,137,99,239,150,196,18,41,147,175,64,90,144,212,73,162,169,227,167,18,73,202,91,224,36,243,96,226,135,11,133,14,19,191,24,119,157,56,14,179,249,66,21,98,216,241,189,63,156,216,11,36,2,85,76,139,255,166,90,17,136,99,39,190,49,219,99,50,113,230,126,42,128,102,123,185,220,163,90,88,144,81,18,186,55,109,229,55,168,36,32,110,74,198,121,141,196,228,247,57,73,210,211,216,35,65,234,80,208,25,137,103,94,146,192,47,171,252,176,220,147,152,137,115,75,62,10,99,128,33,63,116,29,255,34,13,99,231,154,212,18,146,246,83,50,179,76,146,68,115,15,109,38,49,171,255,188,56,61,169,37,41,236,232,218,155,220,91,210,148,202,229,182,66,56,134,245,195,88,161,237,129,182,209,154,96,197,49,154,158,182,214,117,225,90,25,241,182,55,177,228,212,125,59,152,251,126,249,33,163,133,76,69,78,156,144,12,171,220,102,50,204,150,252,234,141,191,1,147,12,252,245,91,158,95,39,78,65,4,63,88,227,208,157,207,64,114,229,154,51,30,91,230,63,204,114,45,156,76,224,128,252,96,153,207,226,112,1,223,211,116,230,91,166,89,110,115,85,212,92,63,132,181,193,192,25,21,149,52,156,192,11,208,194,60,233,129,157,196,176,194,26,245,81,234,18,23,214,136,201,44,188,37,236,96,153,120,98,14,174,99,66,2,179,188,130,10,124,106,120,49,25,23,96,49,166,145,11,163,110,156,132,6,231,128,50,249,252,217,219,55,47,95,183,11,102,101,91,215,160,129,245,224,250,158,123,211,226,146,171,46,181,77,79,157,96,236,147,95,188,196,27,121,190,151,222,119,1,112,13,2,122,0,61,238,231,5,240,252,249,190,144,121,109,234,141,199,36,40,63,72,133,208,3,144,217,43,87,146,68,135,157,247,110,225,199,192,75,82,18,192,85,99,222,202,53,93,92,211,172,22,243,82,69,169,163,97,45,188,96,28,46,106,212,32,233,42,181,40,140,211,125,219,52,191,127,47,30,121,219,88,55,242,234,213,75,169,95,188,91,191,144,209,5,252,38,169,101,46,146,86,189,110,86,242,19,167,97,146,6,206,140,84,204,214,234,32,165,90,49,235,11,16,121,123,73,128,223,157,137,115,26,123,194,96,195,32,140,72,96,11,201,90,228,54,165,215,118,144,132,62,129,249,215,64,146,97,26,20,111,11,155,91,103,155,41,185,3,254,164,174,179,51,147,217,127,26,207,73,123,217,206,88,195,211,180,13,111,136,8,36,243,103,76,163,70,40,108,3,53,10,40,162,192,252,33,181,29,52,177,199,40,80,244,113,238,50,130,129,218,24,239,34,58,74,108,105,183,163,112,124,143,48,23,190,72,12,198,38,124,35,69,175,165,247,17,225,222,81,79,0,90,5,119,16,5,165,206,40,9,156,219,34,48,48,10,71,35,85,135,192,230,113,153,188,107,135,43,53,239,236,11,241,192,142,16,78,73,199,161,159,212,38,97,220,115,128,121,226,19,186,61,251,8,239,122,240,100,119,76,116,15,20,189,149,115,29,28,185,92,93,182,21,49,91,114,22,232,32,99,53,13,83,199,23,235,29,89,250,242,62,9,174,211,233,65,179,44,15,31,56,175,0,238,238,185,23,222,192,177,90,139,14,27,25,197,196,185,105,11,81,103,105,82,235,255,187,67,38,119,122,221,193,145,38,119,149,157,118,188,205,252,85,25,176,180,178,149,191,75,98,226,135,206,24,78,134,142,141,9,100,75,26,118,234,165,62,97,86,227,59,35,226,163,25,206,28,47,248,68,28,176,33,97,133,25,66,158,30,166,125,45,241,197,114,48,249,153,37,89,18,196,114,28,249,137,201,130,50,200,131,252,150,144,50,186,7,159,148,225,250,26,134,159,134,159,7,22,59,159,58,19,44,73,93,153,244,144,159,69,55,55,74,3,179,130,104,16,227,160,99,76,195,185,59,69,217,183,178,59,163,252,64,106,81,76,168,218,143,89,140,71,69,57,79,83,122,221,129,35,181,56,137,42,189,13,65,41,85,164,2,58,221,133,6,247,109,75,230,149,245,189,137,100,249,241,221,177,27,9,156,170,32,203,208,29,31,25,204,145,165,249,191,148,59,253,189,149,240,162,201,206,178,139,156,49,219,244,229,89,117,87,217,21,209,80,101,135,44,250,79,103,145,38,144,79,103,82,163,178,194,102,252,116,54,49,181,125,58,159,58,153,21,70,71,79,103,148,102,231,79,231,83,163,178,194,166,251,116,54,89,113,224,233,140,230,232,108,60,221,88,222,122,252,240,197,52,6,190,64,191,110,237,175,196,1,43,100,135,157,247,171,52,245,192,195,137,34,244,64,135,190,119,116,232,24,97,48,3,74,100,30,217,37,192,97,251,144,18,173,152,229,146,49,141,201,196,46,81,10,10,188,116,196,63,240,154,169,152,135,117,231,232,176,14,36,11,35,26,185,230,216,187,53,188,49,46,165,17,59,172,195,8,157,75,231,217,64,160,166,19,128,175,17,25,119,217,183,5,249,111,24,181,168,154,150,101,140,219,44,211,137,60,182,178,3,216,19,207,135,96,205,146,106,163,105,10,166,152,63,88,233,212,75,128,159,52,133,20,132,110,204,44,219,182,13,145,48,221,247,65,26,30,176,187,20,210,121,52,38,19,225,102,85,53,0,26,79,0,59,118,20,135,179,8,66,230,161,51,50,210,208,96,19,233,47,43,192,106,138,1,233,27,216,228,59,22,199,237,211,253,212,24,18,204,176,224,19,98,2,199,39,49,37,49,117,82,74,211,24,135,36,49,130,48,53,200,29,36,74,70,235,183,223,48,25,40,176,185,2,147,98,165,65,169,126,136,108,97,70,151,69,18,140,109,6,162,226,125,150,64,204,227,166,92,7,58,106,155,125,102,74,11,35,76,234,168,222,216,79,179,178,39,116,183,103,150,12,52,1,187,36,160,204,34,232,128,128,176,197,8,197,62,18,48,12,42,0,112,88,103,52,143,204,213,29,125,238,111,187,29,111,92,180,149,138,105,120,65,52,79,153,10,248,182,18,239,15,72,112,203,15,98,151,104,10,51,47,48,117,183,185,194,75,231,215,191,143,23,106,32,26,63,52,177,48,87,152,116,238,88,60,152,99,21,19,206,60,102,126,59,43,23,208,176,119,246,63,18,46,164,252,209,35,210,197,130,250,227,183,161,44,52,125,229,246,247,205,94,169,96,9,103,208,6,14,224,182,196,129,139,219,107,107,117,110,213,68,88,230,63,116,3,204,245,0,90,120,240,19,251,179,147,78,107,113,56,135,163,65,147,123,160,8,59,166,133,177,161,55,131,95,245,102,163,209,40,226,180,22,205,147,169,245,112,215,74,147,234,125,43,147,6,156,228,92,121,111,23,206,21,190,149,22,69,171,64,96,95,191,253,197,235,137,58,63,85,159,168,75,151,217,184,44,83,99,233,224,113,103,183,177,32,154,187,30,148,238,19,102,219,106,248,151,229,46,220,224,196,210,192,208,233,34,56,139,195,8,46,222,123,171,196,51,191,139,244,222,39,165,50,115,149,42,33,97,192,48,204,45,88,157,81,204,146,12,220,55,196,229,224,115,26,230,187,70,171,249,231,88,75,158,204,27,11,59,214,208,66,214,180,147,186,199,66,142,43,90,226,180,180,187,0,102,41,136,85,19,204,222,84,106,117,255,187,45,241,212,147,210,2,199,171,16,3,198,118,182,1,157,210,46,108,41,41,48,198,67,228,46,253,139,120,203,145,218,201,12,88,50,190,18,8,60,149,181,21,98,187,48,199,147,250,213,156,253,41,156,233,148,118,97,43,203,155,179,70,122,107,21,141,21,54,232,146,215,206,252,154,252,69,236,231,105,237,178,1,118,73,51,184,104,95,137,234,40,214,94,45,243,50,184,9,194,69,96,208,240,131,198,175,24,116,154,226,182,95,238,201,26,24,140,31,217,218,51,134,231,207,229,200,161,94,11,101,241,132,40,200,229,47,145,181,98,136,156,128,248,154,16,212,105,5,18,200,38,148,115,172,218,182,118,253,65,18,199,152,209,123,55,236,170,59,144,61,77,222,81,61,224,61,76,241,153,53,44,5,36,235,78,10,136,236,69,10,0,107,62,138,47,217,107,44,183,5,39,89,153,158,227,152,21,165,97,203,139,130,240,93,22,241,94,225,22,50,222,5,211,10,183,42,155,146,63,206,216,38,142,214,242,177,220,163,137,26,102,168,7,220,79,92,225,23,164,96,132,22,97,149,4,140,103,94,95,27,223,184,3,212,83,49,230,121,104,2,199,160,1,237,70,112,63,94,136,201,50,32,165,123,48,35,73,226,92,19,91,41,224,170,141,46,198,31,107,53,241,4,141,217,37,208,179,133,31,226,112,60,169,89,207,144,21,108,19,31,87,110,153,21,248,139,77,32,142,221,254,211,66,208,189,109,94,50,60,183,147,156,179,101,54,112,142,190,106,19,235,193,58,206,149,85,168,83,217,176,6,243,57,155,22,73,183,89,68,20,24,10,151,160,37,129,141,43,56,163,45,214,96,46,104,147,162,185,143,218,168,236,45,22,82,235,185,108,184,234,37,99,184,61,49,157,227,63,117,178,35,10,83,168,209,131,108,228,80,230,81,241,114,178,200,68,47,180,106,110,65,222,147,82,218,81,172,20,213,90,199,73,228,62,206,74,228,106,188,104,14,101,61,225,201,22,132,39,235,8,211,74,223,122,210,91,136,47,26,173,35,77,139,178,235,73,251,91,144,246,215,145,198,58,234,122,218,241,22,180,227,2,218,90,67,93,164,18,92,241,9,164,71,4,13,13,127,217,252,165,5,173,35,228,47,51,240,171,162,1,60,37,238,13,109,237,230,155,81,137,3,171,220,18,253,78,211,136,40,93,100,65,68,111,116,11,74,94,240,40,45,253,193,68,70,14,233,25,217,150,154,89,130,176,137,141,60,78,4,17,68,54,46,138,185,57,218,141,85,218,107,216,122,132,188,168,241,178,215,63,74,181,54,107,67,123,201,177,151,184,49,73,121,241,16,145,236,181,94,67,121,204,229,142,108,197,123,104,46,76,119,37,16,25,209,13,68,190,227,18,171,254,159,223,142,43,245,235,170,137,94,146,85,144,177,50,142,229,154,86,129,63,82,189,45,133,112,71,180,92,242,250,243,90,71,182,102,34,141,233,116,6,93,199,247,71,142,123,115,65,32,156,220,183,77,170,21,147,217,171,42,30,49,41,227,86,8,98,41,236,77,69,97,178,208,112,246,214,175,91,229,171,182,151,75,241,108,64,22,32,50,57,99,37,226,33,139,37,237,71,131,211,119,166,129,97,40,173,128,230,2,209,10,45,130,182,76,179,173,70,231,246,22,81,255,10,77,117,88,82,197,133,22,176,249,98,146,116,132,146,162,127,17,159,138,123,205,118,148,194,94,169,252,253,187,116,200,5,229,65,222,148,62,106,104,133,194,109,232,190,219,68,54,123,50,193,94,116,128,77,109,126,110,161,119,160,121,214,184,210,61,93,219,247,204,117,98,118,239,100,99,161,173,184,175,205,82,46,182,21,217,251,80,210,24,212,100,69,181,23,195,165,23,144,93,74,23,33,125,177,57,159,5,137,192,160,106,164,8,78,60,54,82,246,30,133,86,216,139,195,115,108,170,76,95,139,46,13,171,182,155,135,117,0,29,78,227,58,45,195,115,147,146,245,55,20,111,117,181,86,85,205,40,84,181,44,19,171,247,216,183,201,149,3,179,118,254,46,91,79,216,91,55,36,41,100,64,219,77,176,218,134,13,233,156,44,247,244,38,6,229,67,220,32,91,85,183,243,93,144,39,11,75,250,8,133,82,118,235,32,53,32,196,104,20,76,47,8,241,228,17,224,111,80,15,19,144,38,138,25,220,149,16,176,118,111,236,73,25,227,10,6,254,123,176,136,157,136,202,87,118,242,40,157,35,51,255,200,66,172,194,226,94,92,7,139,42,235,86,226,141,69,26,252,0,166,18,44,179,41,85,3,61,51,237,26,153,106,19,178,8,147,57,89,180,1,201,36,195,83,216,148,39,94,48,202,246,72,249,76,30,23,8,111,223,153,21,75,212,103,155,230,59,233,230,225,242,44,179,158,231,30,51,102,62,203,11,56,12,157,21,150,77,236,18,78,26,133,119,37,182,182,88,58,12,186,116,83,98,41,250,6,146,109,15,67,55,108,150,109,88,91,24,248,97,29,183,165,236,123,229,98,19,251,15,28,201,39,127,79,4,87,194,220,103,12,107,205,95,166,35,245,145,133,161,43,137,50,103,42,74,42,68,229,90,194,93,211,247,34,172,179,251,252,217,79,111,94,55,218,89,127,248,177,213,217,171,132,109,25,200,97,107,60,196,59,243,128,47,56,182,101,65,71,214,56,240,119,230,0,223,60,108,203,129,142,172,113,48,218,200,65,157,153,131,197,139,100,204,152,222,153,192,85,102,56,19,47,158,149,214,112,201,31,60,108,201,38,199,46,102,212,21,140,158,254,76,121,100,102,79,89,4,51,86,79,57,243,214,194,198,149,179,168,6,211,218,169,212,111,0,118,70,17,185,100,204,60,216,77,3,254,58,119,118,169,217,104,40,189,108,126,209,224,110,244,224,171,104,65,30,189,195,1,195,75,184,16,3,41,234,151,24,222,180,194,115,229,34,16,177,69,182,9,30,13,162,115,111,141,32,206,191,105,175,220,102,38,110,21,203,65,188,51,207,54,203,82,151,162,189,193,69,139,33,180,192,225,201,5,147,21,104,166,174,176,165,68,66,187,178,198,170,72,249,87,3,5,220,40,213,168,66,94,120,8,38,29,31,150,116,254,4,35,162,6,196,89,201,22,214,170,71,133,75,179,112,79,172,60,241,174,231,49,65,154,188,67,202,223,179,192,128,235,240,135,13,21,25,172,40,80,252,128,185,42,105,140,29,57,233,47,253,193,192,120,223,51,58,6,130,141,77,194,198,229,89,135,224,111,80,60,11,98,57,91,248,97,212,233,255,75,128,147,53,139,152,108,201,216,152,128,23,187,223,87,15,164,67,59,191,36,14,103,180,4,205,152,68,144,100,242,72,197,30,65,166,38,165,199,92,93,4,146,45,162,21,206,83,250,238,64,34,71,40,197,130,255,145,243,95,24,192,100,47,155,57,0,0 };
+const uint8_t JS_CONTROLS_GZIP[3878] PROGMEM = { 31,139,8,0,88,15,228,97,2,255,197,27,107,115,218,72,242,187,127,133,172,108,5,113,96,30,121,109,22,44,167,8,38,9,183,196,246,217,120,179,117,217,156,75,136,193,168,44,36,173,36,140,189,14,255,253,122,122,30,154,17,2,179,120,247,238,75,140,122,122,122,122,186,123,166,95,19,55,12,146,212,184,236,95,245,79,250,195,126,103,112,245,241,178,111,191,104,52,218,174,24,56,239,13,78,59,199,0,107,10,216,217,113,103,216,187,58,253,240,225,162,55,180,155,42,110,239,215,97,239,228,152,209,104,42,240,97,127,216,27,216,10,224,12,40,230,232,33,40,91,164,127,213,165,144,23,58,82,151,97,189,200,176,222,95,14,135,167,39,246,75,29,143,67,155,141,151,25,230,160,243,30,152,120,165,35,50,96,179,241,42,195,187,248,210,31,118,63,245,206,237,215,58,170,132,55,27,175,21,236,65,255,24,96,111,114,184,12,218,108,188,201,48,79,46,63,191,7,216,143,58,38,135,54,27,63,42,226,2,57,130,66,206,46,135,246,91,29,91,25,105,54,222,102,51,62,158,119,206,62,217,63,113,64,231,248,152,65,174,206,78,251,39,20,149,15,116,7,189,206,57,71,110,54,126,82,86,236,188,183,155,57,133,48,152,162,144,139,222,160,215,5,106,57,157,8,112,83,209,202,233,217,176,79,229,159,83,139,0,55,21,181,124,238,3,32,167,21,132,53,21,157,124,238,252,106,55,115,250,64,88,83,85,197,176,119,102,55,243,154,64,96,83,209,195,199,206,229,199,158,221,204,233,129,67,155,138,26,58,221,46,181,141,156,10,56,180,249,86,21,204,89,231,188,51,60,5,53,254,148,151,141,28,81,134,228,73,56,62,253,114,34,207,193,160,247,97,40,237,253,188,255,241,211,80,90,117,183,119,50,4,35,17,2,233,94,13,47,207,255,117,121,218,191,232,73,82,221,171,222,231,222,121,103,144,157,171,238,213,89,15,102,157,247,127,129,169,47,36,240,75,111,216,185,56,251,212,25,40,228,175,46,46,79,62,12,78,191,104,107,116,59,231,231,167,67,121,10,186,87,157,65,255,223,157,115,80,205,27,9,58,238,156,255,44,45,186,123,117,114,122,210,179,95,188,126,221,190,117,98,227,58,118,162,233,177,147,58,118,64,22,70,39,142,157,123,171,140,35,83,39,233,184,46,241,237,137,227,39,4,65,137,239,141,73,220,13,131,212,11,230,225,60,225,67,147,121,224,166,94,24,24,110,232,135,113,215,119,146,196,194,159,253,113,249,129,255,176,79,230,179,17,137,37,188,157,44,188,212,157,42,120,78,66,84,153,181,98,146,206,227,192,132,127,126,159,135,94,66,204,54,71,225,34,20,8,100,70,98,199,31,203,225,76,158,2,35,34,41,137,99,239,150,196,18,41,147,175,64,90,144,212,73,162,169,227,167,18,73,202,91,224,36,243,96,226,135,11,133,14,19,191,24,119,157,56,14,179,249,66,21,98,216,241,189,63,156,216,11,36,2,85,76,139,255,166,90,17,136,99,39,190,49,219,99,50,113,230,126,42,128,102,123,185,220,163,90,88,144,81,18,186,55,109,229,55,168,36,32,110,74,198,121,141,196,228,247,57,73,210,211,216,35,65,234,80,208,25,137,103,94,146,192,47,171,252,176,220,147,152,137,115,75,62,10,99,128,33,63,116,29,255,34,13,99,231,154,212,18,146,246,83,50,179,76,146,68,115,15,109,38,49,171,255,188,56,61,169,37,41,236,232,218,155,220,91,210,148,202,229,182,66,56,134,245,195,88,161,237,129,182,209,154,96,197,49,154,158,182,214,117,225,90,25,241,182,55,177,228,212,125,59,152,251,126,249,33,163,133,76,69,78,156,144,12,171,220,102,50,204,150,252,234,141,191,1,147,12,252,245,91,158,95,39,78,65,4,63,88,227,208,157,207,64,114,229,154,51,30,91,230,63,204,114,45,156,76,224,128,252,96,153,207,226,112,1,223,211,116,230,91,166,89,110,115,85,212,92,63,132,181,193,192,25,21,149,52,156,192,11,208,194,60,233,129,157,196,176,194,26,245,81,234,18,23,214,136,201,44,188,37,236,96,153,120,98,14,174,99,66,2,179,188,130,10,124,106,120,49,25,23,96,49,166,145,11,163,110,156,132,6,231,128,50,249,252,217,219,55,47,95,183,11,102,101,91,215,160,129,245,224,250,158,123,211,226,146,171,46,181,77,79,157,96,236,147,95,188,196,27,121,190,151,222,119,1,112,13,2,122,0,61,238,231,5,240,252,249,190,144,121,109,234,141,199,36,40,63,72,133,208,3,144,217,43,87,146,68,135,157,247,110,225,199,192,75,82,18,192,85,99,222,202,53,93,92,211,172,22,243,82,69,169,163,97,45,188,96,28,46,106,212,32,233,42,181,40,140,211,125,219,52,191,127,47,30,121,219,88,55,242,234,213,75,169,95,188,91,191,144,209,5,252,38,169,101,46,146,86,189,110,86,242,19,167,97,146,6,206,140,84,204,214,234,32,165,90,49,235,11,16,121,123,73,128,223,157,137,115,26,123,194,96,195,32,140,72,96,11,201,90,228,54,165,215,118,144,132,62,129,249,215,64,146,97,26,20,111,11,155,91,103,155,41,185,3,254,164,174,179,51,147,217,127,26,207,73,123,217,206,88,195,211,180,13,111,136,8,36,243,103,76,163,70,40,108,3,53,10,40,162,192,252,33,181,29,52,177,199,40,80,244,113,238,50,130,129,218,24,239,34,58,74,108,105,183,163,112,124,143,48,23,190,72,12,198,38,124,35,69,175,165,247,17,225,222,81,79,0,90,5,119,16,5,165,206,40,9,156,219,34,48,48,10,71,35,85,135,192,230,113,153,188,107,135,43,53,239,236,11,241,192,142,16,78,73,199,161,159,212,38,97,220,115,128,121,226,19,186,61,251,8,239,122,240,100,119,76,116,15,20,189,149,115,29,28,185,92,93,182,21,49,91,114,22,232,32,99,53,13,83,199,23,235,29,89,250,242,62,9,174,211,233,65,179,44,15,31,56,175,0,238,238,185,23,222,192,177,90,139,14,27,25,197,196,185,105,11,81,103,105,82,235,255,187,67,38,119,122,221,193,145,38,119,149,157,118,188,205,252,85,25,176,180,178,149,191,75,98,226,135,206,24,78,134,142,141,9,100,75,26,118,234,165,62,97,86,227,59,35,226,163,25,206,28,47,248,68,28,176,33,97,133,25,66,158,30,166,125,45,241,197,114,48,249,153,37,89,18,196,114,28,249,137,201,130,50,200,131,252,150,144,50,186,7,159,148,225,250,26,134,159,134,159,7,22,59,159,58,19,44,73,93,153,244,144,159,69,55,55,74,3,179,130,104,16,227,160,99,76,195,185,59,69,217,183,178,59,163,252,64,106,81,76,168,218,143,89,140,71,69,57,79,83,122,221,129,35,181,56,137,42,189,13,65,41,85,164,2,58,221,133,6,247,109,75,230,149,245,189,137,100,249,241,221,177,27,9,156,170,32,203,208,29,31,25,204,145,165,249,191,148,59,253,189,149,240,162,201,206,178,139,156,49,219,244,229,89,117,87,217,21,209,80,101,135,44,250,79,103,145,38,144,79,103,82,163,178,194,102,252,116,54,49,181,125,58,159,58,153,21,70,71,79,103,148,102,231,79,231,83,163,178,194,166,251,116,54,89,113,224,233,140,230,232,108,60,221,88,222,122,252,240,197,52,6,190,64,191,110,237,175,196,1,43,100,135,157,247,171,52,245,192,195,137,34,244,64,135,190,119,116,232,24,97,48,3,74,100,30,217,37,192,97,251,144,18,173,152,229,146,49,141,201,196,46,81,10,10,188,116,196,63,240,154,169,152,135,117,231,232,176,14,36,11,35,26,185,230,216,187,53,188,49,46,165,17,59,172,195,8,157,75,231,217,64,160,166,19,128,175,17,25,119,217,183,5,249,111,24,181,168,154,150,101,140,219,44,211,137,60,182,178,3,216,19,207,135,96,205,146,106,163,105,10,166,152,63,88,233,212,75,128,159,52,133,20,132,110,204,44,219,182,13,145,48,221,247,65,26,30,176,187,20,210,121,52,38,19,225,102,85,53,0,26,79,0,59,118,20,135,179,8,66,230,161,51,50,210,208,96,19,233,47,43,192,106,138,1,233,27,216,228,59,22,199,237,211,253,212,24,18,204,176,224,19,98,2,199,39,49,37,49,117,82,74,211,24,135,36,49,130,48,53,200,29,36,74,70,235,183,223,48,25,40,176,185,2,147,98,165,65,169,126,136,108,97,70,151,69,18,140,109,6,162,226,125,150,64,204,227,166,92,7,58,106,155,125,102,74,11,35,76,234,168,222,216,79,179,178,39,116,183,103,150,12,52,1,187,36,160,204,34,232,128,128,176,197,8,197,62,18,48,12,42,0,112,88,103,52,143,204,213,29,125,238,111,187,29,111,92,180,149,138,105,120,65,52,79,153,10,248,182,18,239,15,72,112,203,15,98,151,104,10,51,47,48,117,183,185,194,75,231,215,191,143,23,106,32,26,63,52,177,48,87,152,116,238,88,60,152,99,21,19,206,60,102,126,59,43,23,208,176,119,246,63,18,46,164,252,209,35,210,197,130,250,227,183,161,44,52,125,229,246,247,205,94,169,96,9,103,208,6,14,224,182,196,129,139,219,107,107,117,110,213,68,88,230,63,116,3,204,245,0,90,120,240,19,251,179,147,78,107,113,56,135,163,65,147,123,160,8,59,166,133,177,161,55,131,95,245,102,163,209,40,226,180,22,205,147,169,245,112,215,74,147,234,125,43,147,6,156,228,92,121,111,23,206,21,190,149,22,69,171,64,96,95,191,253,197,235,137,58,63,85,159,168,75,151,217,184,44,83,99,233,224,113,103,183,177,32,154,187,30,148,238,19,102,219,106,248,151,229,46,220,224,196,210,192,208,233,34,56,139,195,8,46,222,123,171,196,51,191,139,244,222,39,165,50,115,149,42,33,97,192,48,204,45,88,157,81,204,146,12,220,55,196,229,224,115,26,230,187,70,171,249,231,88,75,158,204,27,11,59,214,208,66,214,180,147,186,199,66,142,43,90,226,180,180,187,0,102,41,136,85,19,204,222,84,106,117,255,187,45,241,212,147,210,2,199,171,16,3,198,118,182,1,157,210,46,108,41,41,48,198,67,228,46,253,139,120,203,145,218,201,12,88,50,190,18,8,60,149,181,21,98,187,48,199,147,250,213,156,61,207,217,42,6,22,49,119,101,94,39,181,11,231,89,106,157,245,218,91,171,104,172,246,65,151,188,118,230,215,228,47,146,125,158,214,46,27,96,247,56,131,139,14,151,40,160,98,121,214,50,47,131,155,32,92,4,6,141,80,104,136,139,113,169,41,28,194,114,79,150,201,96,252,200,214,94,58,60,127,46,71,14,245,114,41,11,57,68,205,46,127,207,172,21,67,228,4,196,215,132,160,78,43,144,64,54,161,156,99,213,182,181,27,18,242,60,198,140,222,222,97,183,225,129,108,123,242,166,235,1,111,115,138,207,172,167,41,32,89,3,83,64,100,187,82,0,88,127,82,124,201,118,100,185,45,56,201,42,249,28,199,172,40,61,93,94,55,132,239,178,8,9,11,183,144,241,46,152,86,184,85,217,148,252,113,198,54,113,180,150,143,229,30,205,229,48,137,61,224,174,228,10,191,32,75,35,180,78,171,228,104,60,57,251,218,248,198,125,164,158,173,49,231,68,79,61,131,6,244,172,115,87,95,136,201,146,36,165,193,48,35,73,226,92,19,91,169,241,170,189,48,198,31,235,70,241,28,142,217,37,208,179,133,171,226,112,60,169,89,91,145,213,116,19,31,87,110,153,21,248,139,125,34,142,221,254,211,66,208,29,114,94,50,60,253,147,156,179,101,54,112,142,238,108,19,235,193,58,206,149,85,232,229,186,97,13,230,150,54,45,146,110,179,136,168,65,20,46,65,171,6,27,87,112,70,91,172,193,188,212,38,69,115,55,182,81,217,91,44,164,150,124,217,112,213,75,198,112,123,98,198,199,127,234,100,71,20,166,80,163,7,217,200,161,204,163,226,229,100,29,138,94,104,213,220,130,188,109,165,116,172,88,181,170,181,142,147,200,125,156,149,200,213,120,209,28,202,122,194,147,45,8,79,214,17,166,197,192,245,164,183,16,95,52,90,71,154,214,109,215,147,246,183,32,237,175,35,141,165,214,245,180,227,45,104,199,5,180,181,158,187,200,54,184,226,19,200,160,8,26,26,254,178,249,99,12,90,106,200,95,102,224,87,69,143,120,74,220,27,218,253,205,247,171,18,7,86,185,37,250,157,166,17,81,26,205,130,136,222,11,23,148,188,224,81,90,250,155,138,140,28,210,51,178,45,53,179,28,98,19,27,121,156,8,34,136,108,92,212,123,115,180,27,171,180,215,176,245,8,121,81,6,102,15,132,148,130,110,214,169,246,146,99,47,113,99,146,242,250,34,34,217,107,189,134,242,222,203,29,217,138,247,208,92,152,238,74,32,50,162,27,136,124,199,37,86,253,63,191,29,87,234,215,85,19,189,36,43,50,99,241,28,43,58,173,2,127,164,122,91,10,225,142,104,185,228,37,234,181,142,108,205,68,26,211,233,12,186,142,239,143,28,247,230,130,64,56,185,111,155,84,43,38,179,87,85,60,98,82,198,173,16,196,82,216,155,138,194,100,161,225,236,173,95,183,202,87,109,47,151,226,101,129,172,81,100,114,198,98,197,67,22,75,218,143,6,167,239,76,3,195,80,90,36,205,5,162,21,90,39,109,153,102,91,141,206,237,45,162,254,21,154,234,176,164,138,11,45,96,243,197,36,233,8,37,69,255,34,62,21,247,154,237,40,181,191,82,249,251,119,233,144,11,42,136,188,111,125,212,208,106,137,219,208,125,183,137,108,246,170,130,61,250,0,155,218,252,34,67,111,82,243,196,114,165,193,186,182,53,154,107,214,236,222,236,198,90,92,113,235,155,165,92,108,43,178,61,162,164,49,168,201,138,106,47,134,75,47,32,187,148,46,66,250,168,115,62,11,18,129,65,213,72,17,156,120,108,164,236,201,10,45,194,23,135,231,216,119,153,190,22,141,28,86,144,55,15,235,0,58,156,198,117,90,169,231,38,37,75,116,40,222,234,106,57,171,154,81,168,106,89,38,22,248,177,181,147,171,24,102,29,255,93,182,158,176,231,112,72,82,200,128,118,164,96,181,13,27,210,57,89,238,233,125,14,202,135,184,65,182,42,128,231,27,37,79,22,150,244,17,10,165,236,214,65,106,64,136,209,40,152,94,16,226,201,35,192,159,169,30,38,32,77,20,51,184,43,33,96,237,222,216,147,50,198,21,12,252,247,96,17,59,17,149,175,108,246,81,58,71,102,254,29,134,88,133,197,189,184,14,22,85,214,173,196,123,143,52,248,1,76,37,88,102,83,170,6,122,102,218,88,50,213,62,101,17,38,115,178,104,3,146,73,134,167,176,41,79,188,96,148,237,145,242,153,60,46,16,222,225,51,43,150,40,225,54,205,119,210,205,195,229,89,102,109,209,61,102,204,124,150,23,112,24,58,43,44,155,216,37,156,52,10,239,74,108,109,177,116,24,116,233,166,196,82,244,153,36,219,30,134,110,216,79,219,176,182,48,240,195,58,110,75,217,247,202,197,38,246,31,56,146,79,254,228,8,174,132,185,207,24,214,250,195,76,71,234,59,12,67,87,18,101,206,84,148,84,136,202,181,132,187,166,79,74,88,243,247,249,179,159,222,188,110,180,179,22,242,99,171,179,135,11,219,50,144,195,214,120,136,119,230,1,31,121,108,203,130,142,172,113,224,239,204,1,62,139,216,150,3,29,89,227,96,180,145,131,58,51,7,139,23,201,152,49,189,51,129,171,204,112,38,94,60,43,173,225,146,191,137,216,146,77,142,93,204,168,43,24,61,253,153,242,200,204,158,178,8,102,172,158,114,230,173,133,141,43,103,81,13,166,181,83,169,223,0,236,140,34,114,201,152,121,176,155,6,252,117,238,236,82,179,209,80,218,221,252,162,193,221,232,193,87,209,130,60,122,135,3,134,151,112,33,6,82,212,47,49,188,105,133,231,202,69,32,98,139,108,19,60,26,68,231,222,26,65,156,127,211,94,185,205,76,220,42,150,131,120,243,158,109,150,165,46,69,123,131,139,22,67,104,129,195,147,11,38,43,208,76,93,97,75,137,132,118,101,141,85,145,242,15,11,10,184,81,170,81,133,188,240,16,76,58,62,44,233,252,9,70,68,13,136,179,146,45,172,85,143,10,151,102,225,158,88,121,226,93,207,99,130,52,121,19,149,63,121,129,1,215,225,111,31,42,50,88,81,160,248,1,115,85,210,24,59,114,210,95,250,131,129,241,190,103,116,12,4,27,155,132,141,203,179,14,193,223,160,120,22,196,114,182,240,195,168,211,255,186,0,39,107,22,49,217,146,177,49,1,47,118,191,175,30,72,135,54,135,73,28,206,104,9,154,49,137,32,201,228,145,138,61,130,76,77,74,143,185,186,8,36,91,68,43,156,167,244,105,130,68,142,80,138,5,255,105,231,191,84,243,29,73,190,57,0,0 };

From bc34078f4256b36149e5f31cba68b87b3232998f Mon Sep 17 00:00:00 2001
From: Ian Gray 
Date: Thu, 20 Jan 2022 20:43:04 +0000
Subject: [PATCH 2/3] Fix bug with multiple clients

If two clients were connected at the same time, the chunked updates
from one could cause the other to recieve UI_EXTEND messages. This
is fixed by passing the client in to jsonDom.
---
 src/ESPUI.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ESPUI.cpp b/src/ESPUI.cpp
index 814387a..87570a0 100644
--- a/src/ESPUI.cpp
+++ b/src/ESPUI.cpp
@@ -445,7 +445,7 @@ void onWsEvent(
         if (msg.startsWith(F("uiok:")))
         {
             int idx = msg.substring(msg.indexOf(':') + 1).toInt();
-            ESPUI.jsonDom(idx);
+            ESPUI.jsonDom(idx, client);
         } else 
         {
             uint16_t id = msg.substring(msg.lastIndexOf(':') + 1).toInt();

From 9cd15db1ad8bcb62f3e361d38c410c7fdf3efd5e Mon Sep 17 00:00:00 2001
From: Ian Gray 
Date: Thu, 20 Jan 2022 21:50:06 +0000
Subject: [PATCH 3/3] Add Time control

Adds a new invisible control that can fetch the current time from a
connected client. Documentation is in the README.
---
 README.md               | 29 +++++++++++++++++++++++++++++
 data/js/controls.js     | 11 +++++++++++
 data/js/controls.min.js |  6 +++---
 src/ESPUI.cpp           | 11 +++++++++++
 src/ESPUI.h             |  4 ++++
 src/dataControlsJS.h    |  8 ++++----
 6 files changed, 62 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index ee04e88..98bf7f0 100644
--- a/README.md
+++ b/README.md
@@ -466,6 +466,35 @@ This can be applied to every element to force a single column layout, or to indi
 
 Note that this will have no effect on small screens.
 
+### Advanced: Getting the Time
+
+ESPUI can create an invisible control that can be used to fetch the current time from the client when they are connected to the UI. This could be used to intermittently provide an accurate time source to your ESP. Remember that clients cannot be relied upon to be correct or truthful. If this is not a concern, you can do the following:
+
+```
+//Add the invisible "Time" control
+auto timeId = ESPUI.addControl(Time, "", "", None, 0, timeCallback);
+```
+
+After creating the UI, sending an update to the Time control will cause it to fetch the current time from the client and then fire its callback with the result.
+
+```
+//Request an update to the time
+ESPUI.updateTime(timeId);
+//Will trigger timeCallback
+``` 
+
+In `timeCallback` you can then print the control's value as normal:
+
+```
+void timeCallback(Control *sender, int type) {
+  if(type == TM_VALUE) { 
+    Serial.println(sender->value);
+  }
+}
+```
+
+The returned string will be an [ISO string](https://www.w3schools.com/jsref/jsref_toisostring.asp) as returned by the Javascript `new Date().toISOString()`. The format is `YYYY-MM-DDTHH:mm:ss.sssZ` so for example: `2022-01-20T21:44:22.913Z`.
+
 # Notes for Development
 
 If you want to work on the HTML/CSS/JS files, do make changes in the _data_
diff --git a/data/js/controls.js b/data/js/controls.js
index 2d22e28..2b5ff1c 100644
--- a/data/js/controls.js
+++ b/data/js/controls.js
@@ -57,6 +57,9 @@ const UPDATE_ACCEL = 118;
 const UI_SEPARATOR = 19;
 const UPDATE_SEPARATOR = 119;
 
+const UI_TIME = 20;
+const UPDATE_TIME = 120;
+
 const UP = 0;
 const DOWN = 1;
 const LEFT = 2;
@@ -555,6 +558,11 @@ function start() {
       case UPDATE_ACCEL:
         break;
 
+      case UPDATE_TIME:
+        var rv = new Date().toISOString();
+        websock.send("time:" + rv + ":" + data.id);
+        break;
+
       default:
         console.error("Unknown type or event");
         break;
@@ -724,6 +732,9 @@ var addToHTML = function(data) {
         html = "
" + "
" + data.label + "

"; break; + case UI_TIME: + //Invisible element + break; } parent.append(html); diff --git a/data/js/controls.min.js b/data/js/controls.min.js index a14985c..60ee074 100644 --- a/data/js/controls.min.js +++ b/data/js/controls.min.js @@ -1,4 +1,4 @@ -const UI_INITIAL_GUI=200;const UI_RELOAD=201;const UPDATE_OFFSET=100;const UI_EXTEND_GUI=210;const UI_TITEL=0;const UI_PAD=1;const UPDATE_PAD=101;const UI_CPAD=2;const UPDATE_CPAD=102;const UI_BUTTON=3;const UPDATE_BUTTON=103;const UI_LABEL=4;const UPDATE_LABEL=104;const UI_SWITCHER=5;const UPDATE_SWITCHER=105;const UI_SLIDER=6;const UPDATE_SLIDER=106;const UI_NUMBER=7;const UPDATE_NUMBER=107;const UI_TEXT_INPUT=8;const UPDATE_TEXT_INPUT=108;const UI_GRAPH=9;const ADD_GRAPH_POINT=10;const CLEAR_GRAPH=109;const UI_TAB=11;const UPDATE_TAB=111;const UI_SELECT=12;const UPDATE_SELECT=112;const UI_OPTION=13;const UPDATE_OPTION=113;const UI_MIN=14;const UPDATE_MIN=114;const UI_MAX=15;const UPDATE_MAX=115;const UI_STEP=16;const UPDATE_STEP=116;const UI_GAUGE=17;const UPDATE_GAUGE=117;const UI_ACCEL=18;const UPDATE_ACCEL=118;const UI_SEPARATOR=19;const UPDATE_SEPARATOR=119;const UP=0;const DOWN=1;const LEFT=2;const RIGHT=3;const CENTER=4;const C_TURQUOISE=0;const C_EMERALD=1;const C_PETERRIVER=2;const C_WETASPHALT=3;const C_SUNFLOWER=4;const C_CARROT=5;const C_ALIZARIN=6;const C_DARK=7;const C_NONE=255;var graphData=new Array();var hasAccel=false;var sliderContinuous=false;function colorClass(colorId){colorId=Number(colorId);switch(colorId){case C_TURQUOISE:return"turquoise";case C_EMERALD:return"emerald";case C_PETERRIVER:return"peterriver";case C_WETASPHALT:return"wetasphalt";case C_SUNFLOWER:return"sunflower";case C_CARROT:return"carrot";case C_ALIZARIN:return"alizarin";case C_DARK:case C_NONE:return"dark";default:return"";}} +const UI_INITIAL_GUI=200;const UI_RELOAD=201;const UPDATE_OFFSET=100;const UI_EXTEND_GUI=210;const UI_TITEL=0;const UI_PAD=1;const UPDATE_PAD=101;const UI_CPAD=2;const UPDATE_CPAD=102;const UI_BUTTON=3;const UPDATE_BUTTON=103;const UI_LABEL=4;const UPDATE_LABEL=104;const UI_SWITCHER=5;const UPDATE_SWITCHER=105;const UI_SLIDER=6;const UPDATE_SLIDER=106;const UI_NUMBER=7;const UPDATE_NUMBER=107;const UI_TEXT_INPUT=8;const UPDATE_TEXT_INPUT=108;const UI_GRAPH=9;const ADD_GRAPH_POINT=10;const CLEAR_GRAPH=109;const UI_TAB=11;const UPDATE_TAB=111;const UI_SELECT=12;const UPDATE_SELECT=112;const UI_OPTION=13;const UPDATE_OPTION=113;const UI_MIN=14;const UPDATE_MIN=114;const UI_MAX=15;const UPDATE_MAX=115;const UI_STEP=16;const UPDATE_STEP=116;const UI_GAUGE=17;const UPDATE_GAUGE=117;const UI_ACCEL=18;const UPDATE_ACCEL=118;const UI_SEPARATOR=19;const UPDATE_SEPARATOR=119;const UI_TIME=20;const UPDATE_TIME=120;const UP=0;const DOWN=1;const LEFT=2;const RIGHT=3;const CENTER=4;const C_TURQUOISE=0;const C_EMERALD=1;const C_PETERRIVER=2;const C_WETASPHALT=3;const C_SUNFLOWER=4;const C_CARROT=5;const C_ALIZARIN=6;const C_DARK=7;const C_NONE=255;var graphData=new Array();var hasAccel=false;var sliderContinuous=false;function colorClass(colorId){colorId=Number(colorId);switch(colorId){case C_TURQUOISE:return"turquoise";case C_EMERALD:return"emerald";case C_PETERRIVER:return"peterriver";case C_WETASPHALT:return"wetasphalt";case C_SUNFLOWER:return"sunflower";case C_CARROT:return"carrot";case C_ALIZARIN:return"alizarin";case C_DARK:case C_NONE:return"dark";default:return"";}} var websock;var websockConnected=false;function requestOrientationPermission(){} function saveGraphData(){localStorage.setItem("espuigraphs",JSON.stringify(graphData));} function restoreGraphData(id){var savedData=localStorage.getItem("espuigraphs",graphData);if(savedData!=null){savedData=JSON.parse(savedData);return savedData[id];} @@ -39,7 +39,7 @@ break;case UPDATE_TEXT_INPUT:$("#text"+data.id).val(data.value);if(data.hasOwnPr break;case UPDATE_SELECT:$("#select"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#select"+data.id).attr("style",data.elementStyle);} break;case UPDATE_BUTTON:$("#btn"+data.id).val(data.value);$("#btn"+data.id).text(data.value);if(data.hasOwnProperty('elementStyle')){$("#btn"+data.id).attr("style",data.elementStyle);} break;case UPDATE_PAD:case UPDATE_CPAD:break;case UPDATE_GAUGE:$("#gauge"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#gauge"+data.id).attr("style",data.elementStyle);} -break;case UPDATE_ACCEL:break;default:console.error("Unknown type or event");break;} +break;case UPDATE_ACCEL:break;case UPDATE_TIME:var rv=new Date().toISOString();websock.send("time:"+rv+":"+data.id);break;default:console.error("Unknown type or event");break;} if(data.type>=UPDATE_OFFSET&&data.type
"+data.label+"

"+ elementHTML(data.type,data.id,data.value,data.label,elementStyle)+ "";break;case UI_SEPARATOR:html="
"+ -"
"+data.label+"

";break;} +"
"+data.label+"

";break;case UI_TIME:break;} parent.append(html);}else{var parent=$("#id"+data.parentControl);parent.append(elementHTML(data.type,data.id,data.value,data.label,elementStyle));}} var elementHTML=function(type,id,value,label,elementStyle){switch(type){case UI_LABEL:return""+value+"";case UI_BUTTON:return"