Open olikraus opened 9 years ago
Bitlash user defined functions are able to accept string constant arguments. In your
user function, cast the result of getarg(n) to char* and off you go. So ug8_text(22,33,"foo")
would work just fine for text placement.
Reported by bill.roy@palmeta.com
on 2012-04-19 13:48:28
Hi Bill
Thanks for clarification!
Reported by olikraus
on 2012-04-19 14:44:54
If you like, it is pretty easy to get printf-formatted output using the built-in bitlash
printf() formatter via the func_printf_handler hook, something like this:
//////////
//
// Send one byte of generated output to the text display system
// Used in func_xyprintf() below.
//
void display_put_char(byte) {
// call your function to display one byte of generated output
// do bookkeeping for the position of the next char here too
...
}
//////////
//
// xyprintf(): print formatted output at [x,y]
//
// Examples:
// xyprintf(0, 0, "Hello, world!");
// xyprintf(22, 5, "Time: %5d", millis);
//
numvar func_xyprintf(void) {
// call your function to save the text rendering position
// set_xy(getarg(0), getarg(1));
...
// generate formatted output
setOutputHandler(&display_put_char); // redirect output to handler above
func_printf_handler(3,4); // format=arg(3), optional args start at 4
resetOutputHandler(); // restore normal serial output
return 0;
}
Reported by bill.roy@palmeta.com
on 2012-04-19 15:25:41
wow, but i guess i have to implement some basic functionailty first.
Reported by olikraus
on 2012-04-19 15:46:18
i never found time to implement this :-(
Closing this for now...
Reported by olikraus
on 2014-01-22 19:57:47
WontFix
Originally reported on Google Code with ID 63
Reported by
olikraus
on 2012-04-16 11:11:42