This was working until 7ish pm est 1/16/17

This was working until 7ish pm est 1/16/17. I reverted back to my last working build and it still is giving me the following errors: ERROR: bad parameter types for method, ERROR: at pumptimer:48, ERROR: from main:54


/* PUMP TIMER ---------------------------------------------------------------*/
cancelbtn <- hardware.pinA

pumptimer <- null

function pumptimer(){

//PUMP TIMER TURNS PUMP OFF
if (hardware.pin1.read() == 0) //READS HIGH WATER SENSOR
pumptimer = imp.wakeup((pumpruntime),function(){ //PUMP TIMER
if (hardware.pin7.read() == 1){ //READS PUMP STATE (DEBOUNCE)
hardware.pin7.write(0) //TURNS PUMP OFF
server.log("Pump Timer Ended") //WRITES TO THE DEVICE LOG
agent.send("pump", "OFF, TIMER") //SENDS "OFF TIMER" TO WEBUI
}})

//PHYSICAL CANCEL BUTTON
button <- Button(hardware.pinA, DIGITAL_IN_PULLUP, Button.NORMALLY_HIGH,//READS PHYSICAL CANCEL BUTTON
function() {
if (pumptimer!=null){
if (hardware.pin7.read() == 1){ //READS PUMP STATE (DEBOUNCE)
imp.cancelwakeup(pumptimer)
hardware.pin7.write(0) //TURNS PUMP OFF
server.log("Pump Timer Cancel Button Pressed") //WRITES TO THE DEVICE LOG
agent.send("pump", "CANCELED, BUTTON") //SENDS "CANCELED BUTTON" TO WEBUI
}}})

//WEBUI CANCEL
agent.on("pumpoff", function(seconds) //READS WEBUI CANCEL
if (pumptimer!=null){
imp.cancelwakeup(pumptimer)
hardware.pin7.write(0) //TURNS PUMP OFF
agent.send("pump", "CANCELED, WEBUI") //SENDS "CANCELED WEBUI" TO WEBUI
})

//WEBUI OVERRIDE
agent.on("pumpon", function(seconds) //READS WEBUI OVERRIDE
if (pumptimer!=null){
imp.cancelwakeup(pumptimer)
hardware.pin7.write(1) //TURNS PUMP ON
agent.send("pump", "OVERRIDE, WEBUI") //SENDS "OVERRIDE WEBUI" TO WEBUI
})

//HIGH WATER LEVEL SENSOR
if (hardware.pin1.read() == 1) //READS HIGH WATER LEVEL SENSOR
if (pumptimer!=null)
if (hardware.pin7.read() == 0){ //READS PUMP STATE (DEBOUNCE)
imp.cancelwakeup(pumptimer)
hardware.pin7.write(1) //TURNS PUMP ON
server.log("Pump Timer Started") //WRITES TO THE DEVICE LOG
agent.send("pump", "ON, SENSOR") //SENDS "ON, SENSOR" TO WEBUI
}
}
pumptimer()


Comments

  • You are using "pumptimer" as the name for your timer handle AND your function. Very risky.
  • As @coverdriven says, try renaming your function and seeing what happens - but also we'd need complete code to debug, there's obviously some stuff missing as many of the pins are not set up by the code above.

    (and note that the last OS update was back in November)
Sign In or Register to comment.