New Compilation Directive Request

hippy

Ex-Staff (retired)
Programs can be written which will compile for different PICAXE variants without user editing using '#ifdef picaxeXX'; would it be possible to have automatic compilation for the firmware version of PICAXE connected ?<code><pre><font size=2 face='Courier'> w1 = w1+1
#ifdef picaxe18x
#ifdef firmware86
I2CWRITE (b0)
#else
I2CWRITE w1,(b0)
#endif
#else
i2cVal = b0
Gosub I2cBitBangOneByteWrite
#endif

#ifdef firmware25
b0 = b0 MIN 10
#else
IF b0 &lt; 10 THEN
b0 = 10
END IF
#endif </font></pre></code> The '#ifdef firmwareNN' would only be true if a PICAXE is connected, if it is of the right variant, and if its firmware version is greater or equal to that specified.

It would require the Programming Editor to do a silent probe ( maybe show a pop-up so the user knows why a delay is happening ) for an attached PICAXE and its firmware version just prior to compilation but once done could be retained until switching to a new editing window when it could be assumed the cable may have been moved between targets so that would have no impacts on subsequent compilation times.

If the user swaps cables and the download fails for want of the correct firmware, then that's something that has to be lived with, but in most cases this is not how people would work.

This would allow writers of example code and code libraries to not only have a single program for any PICAXE, but also take advantage of recent firmware capabilities when the user has them, and warn about or overcome problems with older firmware versions. The probe of the attached hardware could also set the compilation PICAXE type making demo code, &quot;Open File, click to Download&quot;.

Additional '#enhanced' / '#original' to force the compiler type and '#terminal on/off' to control opening the Terminal Window after download would also be very useful.

All these would really help cut down on the manual changes needed to Option settings when switching between multiple PICAXE boards and their programs in a single application.
 
Top