uLisp v3.0c won't compile for Micro:bit


#1

I’m using Arduino 1.8.10 and the ulisp-arm code.

void serialbegin (int address, int baud) {
#if defined(ARDUINO_SAM_DUE)
  if (address == 1) Serial1.begin((long)baud*100);
  else if (address == 2) Serial2.begin((long)baud*100);
  else if (address == 3) Serial3.begin((long)baud*100);
#elif !defined(_VARIANT_BBC_MICROBIT_)
  if (address == 1) Serial1.begin((long)baud*100);
#endif
  else error(WITHSERIAL, PSTR("port not supported"), number(address));
}

With a Micro:Bit only the else error(WITHSERIAL… is compiled with
that #elif !defined(VARIANT_BBC_MICROBIT).
The function beneath it, serialend(), doesn’t have the error checking.


#2

Thanks - I’ll log that as a bug to be fixed next release.


#3

The fix is to change that routine to:


void serialbegin (int address, int baud) {
  #if defined(ARDUINO_SAM_DUE)
  if (address == 1) Serial1.begin((long)baud*100);
  else if (address == 2) Serial2.begin((long)baud*100);
  else if (address == 3) Serial3.begin((long)baud*100);
  #elif !defined(_VARIANT_BBC_MICROBIT_)
  if (address == 1) Serial1.begin((long)baud*100);
  #else
  if (false);
  #endif
  else error(WITHSERIAL, PSTR("port not supported"), number(address));
}

#4

That does work but… it looks awful. ;-)


#5

I agree - suggest a better alternative!


#6