On CBC when trying to compile, error below. This program compiles fine on OS X.
Compilling /mnt/user/co/motor02.c
/tmp/cc5F4Tof.o: In function 'black_pressed';
motor02.c:(.text+0x2b4): undefined reference to 'defer'
collect2: Id returned 1 exit status
Compile failed.
Related. Doing any background process, for example to test a button or sensor, seems to significantly slow down main routine code. For example two motor off() calls in a row, the second will occur significantly later than first. So was expecting defer() to improve this, however above compile error. The defer() call is in this subprocess function.
Thx for input!
Defer is actually not implemented on the CBCv2. It is a relic from the XBC. It is pretty simple to implement it, however:
It may be necessary to wrap it in the following preprocessor macro:
I haven't tested this yet, but that should do the trick. Let me know if you have any success.
Thanks.
Braden McDorman
Developer of the KIPR Link, KISS IDE, KIPR's 2D Simulator, and CBCJVM.
Reach me at bmcdorman(cat)kipr(dog)org where (cat)=@ and (dog)=. if you need assistance of any kind.
I've used msleep(5) to simulate a defer(). Probably not as good as Braden's suggestion, but seems to work.
-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS
Unfortunately, due to the way the "console" is implemented in cbcui, it isn't possible to clear. The "clearing" done right now is kind of a hack, as you've noticed. I don't think there is a function that gives you more control than cbc_printf. There are ways to start a program over ssh, which would give you correct output on a remote terminal, since ssh is a full blown terminal emulator, but that is beyond the scope of what KIPR supports.
ahsan