Ok, so I’ve got a backup hex file just in case and I decided to fiddle around the code a bit. Not being a micro controller programmer I am a bit lost but finding my way.
Can someone briefly explain the following line of code: bfill.emit_p(PSTR(“$D”), 0);
I want to know what is “$D” and where it comes from. If I want to add something to the output EG. another variable value “sid” how do I address the value of sid?
Have you programmed in C or Java? The $D is similar to printf”%d”) in C, which means printing out an integer number. In any case, that part of the code uses Jeelab’s EtherCard library, and you may want to check their documentations and forum for answers to specific questions.
I would like to play with the Opensprinkler code. I modified some minor things successfully however I got stuck. I need some debug info but printf command will not work. A printf (“echo” \n) has been put into main loop, however no output on linux console neither redirecting to a file works. Any hint?
Do you have OpenSprinkler or OSPi/OSBo? To do debug with OpenSprinkler, you should uncomment the following line in defines.h: https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/defines.h#L283
which enables the SERIAL_DEBUG macro. Then you can either use Arduino’s standard Serial interface, such as Serial.print and Serial.println to print values, or use the macro defined DEBUG_PRINT() to print debug data. To use serial debug, you need a serial monitor, such as gtkterms in Linux, or Arduino’s Serial monitor to display the serial data.
I have OSPi. Debug is enabled by default. I could not see debug info in console, neither was able to forward it into a file. However if I start the program directly and not using the init script the debug lines appear. It is good enough so far.