You are reading a single comment by @DrAzzy and its replies. Click here to read the full conversation.
  • 
    Clock = require("clock").Clock;
    
    clk=new Clock("Thu, 17 Sep 2015 23:35:52");
    
      systemStatus={
        light:{
          clear:-1,
          red:-1,
          green:-1,
          blue:-1
        },
        temperature:-1,
        pressure: -1,
        RFDevs:[0,0,0],
        door_upstairs:0,
        door_downstairs:0,
        fridge:0,
        lastMotion:0,
        fargo:new Uint8Array(8)
      };
    
    function getMirrorString() {
      var s=systemStatus;
      var tstr="?door_up="+s.door_upstairs+"&door_­down="+s.door_downstairs+"&fridge="+s.fr­idge;
      tstr+=(s.light.clear>=0?"&clear="+s.ligh­t.clear+"&red="+s.light.red+"&green="+s.­light.green+"&blue="+s.light.blue:"");
      tstr+=(s.pressure>0?"&pressure="+s.press­ure:"")+"&LastMove="+safeGetTime()-s.las­tMotion;
    }
    
    function safeGetTime(){
      if (clk) {
        return clk.getDate().getTime();
      } else {
        return -1;
      }
    }
    
    
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v80.334 Copyright 2015 G.Williams
    >echo(0);
    =undefined
    >getMirrorString()
    WARNING: jsvGetString overflowed
    =undefined
    > 
    
    
About

Avatar for DrAzzy @DrAzzy started