Some fixes

This commit is contained in:
Nathanaël Restori 2012-09-18 17:47:05 +02:00
parent e19729c905
commit 5859a34545
3 changed files with 40 additions and 40 deletions

View File

@ -73,8 +73,8 @@ void setup() {
if (file) { if (file) {
Serial.print("Creating data.tsv"); Serial.print("Creating data.tsv");
file.println("#Time\t\tT [°C]\tP [Pa]\tAlt [m]\tHr [%]\tLx \ file.println("#Time\t\tT [°C]\tP [Pa]\tAlt [m]\tHr [%]\tLx "
[lux]"); "[lux]");
file.close(); file.close();
Serial.println("DONE"); Serial.println("DONE");
} else { } else {

View File

@ -42,43 +42,43 @@ static uint8_t mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
static IPAddress ip = IPAddress(192, 168, 1, 210); static IPAddress ip = IPAddress(192, 168, 1, 210);
static IPAddress timeserver = IPAddress(192, 43, 244, 18); static IPAddress timeserver = IPAddress(192, 43, 244, 18);
P(indexHtml) = "<!DOCTYPE html><html><head><meta charset='utf-8'/\ P(indexHtml) = "<!DOCTYPE html><html><head><meta charset='utf-8'/"
><title>Station Météo</title><style>html, body{ba\ "><title>Station Météo</title><style>html, body{ba"
ckground: #000;color: #fff;}body{font-family: 'De\ "ckground: #000;color: #fff;}body{font-family: 'De"
jaVu Sans', Verdana, Arial, sans-serif;font-size:\ "jaVu Sans', Verdana, Arial, sans-serif;font-size:"
100%;margin: 0;padding: 0;}#home{background: #00\ " 100%;margin: 0;padding: 0;}#home{background: #00"
0;color: #fff;margin: 1em;padding: 0;}#home h1{co\ "0;color: #fff;margin: 1em;padding: 0;}#home h1{co"
lor: #f7c000;font-size: 2em;margin: 1em;text-alig\ "lor: #f7c000;font-size: 2em;margin: 1em;text-alig"
n: center;}#home p{background: #111;border: 1px s\ "n: center;}#home p{background: #111;border: 1px s"
olid #444;font-size: 1.5em;list-style-type: none;\ "olid #444;font-size: 1.5em;list-style-type: none;"
padding: 0;width: 100%;text-align: center;}#home \ "padding: 0;width: 100%;text-align: center;}#home "
table{background: #111;border: 1px solid #444;fon\ "table{background: #111;border: 1px solid #444;fon"
t-size: 1.5em;list-style-type: none;padding: 0;wi\ "t-size: 1.5em;list-style-type: none;padding: 0;wi"
dth: 100%;text-align: center;}#footer{background:\ "dth: 100%;text-align: center;}#footer{background:"
#000;color: #888;font-size: 0.8em;margin: 1em;te\ " #000;color: #888;font-size: 0.8em;margin: 1em;te"
xt-align: center;padding: 0;}</style></head><body\ "xt-align: center;padding: 0;}</style></head><body"
><div id='home'><h1>Station Météo</h1><table><tr>\ "><div id='home'><h1>Station Météo</h1><table><tr>"
<th>Temps</th><th>T [°C]</th><th>P [Pa]</th><th>A\ "<th>Temps</th><th>T [°C]</th><th>P [Pa]</th><th>A"
lt [m]</th><th>Hr [%]</th><th>Lx [lux]</th></tr><\ "lt [m]</th><th>Hr [%]</th><th>Lx [lux]</th></tr><"
tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0<\ "tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0<"
/td><td>0</td></tr></table><p><label>Intervale de\ "/td><td>0</td></tr></table><p><label>Intervale de"
mise à jour (en secondes) : </label><input id='i\ " mise à jour (en secondes) : </label><input id='i"
nterval' type='number' value=2/></p></div><div id\ "nterval' type='number' value='2'/></p></div><div "
='footer'> par Nathanaël Restori </div><script>fu\ "id='footer'> par Nathanaël Restori </div><script>"
nction updateInfo(){var xhr=new XMLHttpRequest();\ "function updateInfo(){var xhr=new XMLHttpRequest("
xhr.open('GET', '/sensors.json');xhr.onreadystate\ ");xhr.open('GET', '/sensors.json');xhr.onreadysta"
change=function(){if (xhr.readyState==4 && xhr.st\ "techange=function(){if (xhr.readyState==4 && xhr."
atus==200){var response=JSON.parse(xhr.responseTe\ "status==200){var response=JSON.parse(xhr.response"
xt);var rows=document.getElementsByTagName('tr');\ "Text);var rows=document.getElementsByTagName('tr'"
var cell=rows[1].firstChild;var index=0;while (ce\ ");var cell=rows[1].firstChild;var index=0;while ("
ll){cell.firstChild.nodeValue=response.sensors[in\ "cell){cell.firstChild.nodeValue=response.sensors["
dex].data;cell=cell.nextSibling;index++;}}};xhr.s\ "index].data;cell=cell.nextSibling;index++;}}};xhr"
end(null);}updateInfo();var updateID=setInterval(\ ".send(null);}updateInfo();var updateID=setInterva"
updateInfo, 2000);var interval=document.getElemen\ "l(updateInfo, 2000);var interval=document.getElem"
tById('interval');interval.addEventListener('chan\ "entById('interval');interval.addEventListener('ch"
ge', function(e){clearInterval(updateID);updateID\ "ange', function(e){clearInterval(updateID);update"
=setInterval(updateInfo, e.target.value*1000);}, \ "ID=setInterval(updateInfo, e.target.value*1000);}"
true);</script></body></html>"; ", true);</script></body></html>";
// no-cost stream operator as described at // no-cost stream operator as described at
// http://sundial.org/arduino/?page_id=119 // http://sundial.org/arduino/?page_id=119

View File

@ -74,7 +74,7 @@
</table> </table>
<p> <p>
<label>Intervale de mise à jour (en secondes) : </label> <label>Intervale de mise à jour (en secondes) : </label>
<input id='interval' type='number' value=2 /> <input id='interval' type='number' value='2' />
</p> </p>
</div> </div>
<div id='footer'> <div id='footer'>