hi,
in code trying following. set process going in background wifi signal strength other things need result. trouble start using runshellcommandasync stops doing of other things in background. i.e stops updating output thingspeak. rest of code works when comment out first couple of lines.
just after pointer going wrong using runsasync process
thanks
in code trying following. set process going in background wifi signal strength other things need result. trouble start using runshellcommandasync stops doing of other things in background. i.e stops updating output thingspeak. rest of code works when comment out first couple of lines.
just after pointer going wrong using runsasync process
thanks
code: [select]
void loop() // main program loop
{
process getwifistrength; // create new shell process
getwifistrength.runshellcommandasynchronously("/usr/bin/pretty-wifi-info.lua | grep signal"); // run process in background wifi signal strength
if(config.controllermode==2) // if value stored in eeprom controllermode = 2
{
lastwinterpumptime = millis(); // reset timer before entering loop
wintermodeloop(); // enter persistant winter mode loop prevent pump bearings seizing up.
}
testpanelcritical(); // test if panel on maximum temperature
testfrostprotection(); // test if system nearing freezing point
testiffrozen(); // if system has frozen stop pumping
testtropicalmode(); // test if system above user selected temperature , panel lower thant pool temperature 2 degrees
testnormaloperation(); // normal loop. i.e panel hotter pool x
ifnoneapply(); // if none of above apply sit collecting heat
// if (getwifistrength.available()) // once process complete
// {
// wifistrength = getwifistrength.parseint(); // parse returned wifi strength integer
// console.println(wifistrength);
// }
}/code]
one problem see creating process object @ top of loop, , starting it. then, additional processing, finally, check see if there output available. then, whether or not got output process, exit loop() function. process object (local loop()) on stack , goes out of scope once loop() exits. on next pass, start on again: allocate process object on stack, start new process, , maybe output process @ bottom of loop. spending of time creating , abandoning processes, , looking @ output.
another issue use of parseint() - potentially blocking function. maybe holding things if characters available (which gets if statement controlling parseint) not enough satisfy parseint() call? or perhaps command returning invalid response cannot parsed properly?
at minimum, think should declare process object globally can survive multiple passes through loop() function. odds start on 1 pass, , not have answer until later pass. you'll need logic control when need start or restart process: perhaps want periodically? or maybe logic simple start once in setup(), in loop() see if still running: if not, check output, , restart it?
another issue use of parseint() - potentially blocking function. maybe holding things if characters available (which gets if statement controlling parseint) not enough satisfy parseint() call? or perhaps command returning invalid response cannot parsed properly?
at minimum, think should declare process object globally can survive multiple passes through loop() function. odds start on 1 pass, , not have answer until later pass. you'll need logic control when need start or restart process: perhaps want periodically? or maybe logic simple start once in setup(), in loop() see if still running: if not, check output, , restart it?
Arduino Forum > Products > Arduino Yún (Moderator: fabioc84) > Can't figure out how to get a process to runasyncronously
arduino
Comments
Post a Comment