Alternate firmware for the Silicon Chip DAB+ radio
(Original articles published in Jan-March 2019 editions of Silicon Chip Magazine)
-----------------------------------------------------
Before copying to your micromite, please read and take note of the extensive comments
near the beginning of the unCRUNCHED basic programme. They explain how to configure
your hardware and software so that the radio will work.

In particular, you will need to CRUNCH the programme to reduce its size so that it will
fit in the limited micromite flash memory. If you normally use MMBASIC on a Windows
computer for crunching and transferring programmes to your micromite, you will discover
that the MMBASIC CRUNCH function is less than awesome, and that the alternative radio
firmware IS TOO LARGE to transfer to the micromite EVEN WHEN MMBASIC CRUNCHES IT.

I have provided a bash/linux/OSX script for crunching MMBASIC programmes. My script
will crunch the output to about 15% smaller than MMBASIC's internal crunch function
will achieve. I have also supplied a pre-crunched version in this zip archive. You
can load the pre-CRUNCHED version into MMBASIC and transfer to the micromite, and
this will work OK, even if MMBASIC can't crunch the full-size version.
-----------------------------------------------------
The exec summary:

The alternate dab radio firmware assumes you have an SDMMC flash card permanently
plugged into either the micromite plus board, or to the SDMMC card slot in the
LCD panel.

Configure your micromite by issuing the following commands via the micromite
command line:

  option lcdpanel SSD1963_5, landscape, 48
  gui test lcdpanel
  option touch 1, 40, 39
  gui calibrate
  gui test touch
  option sdcard 47 (adjust to suit the interface you've plugged the SDMMC card into)
  option keyboard us
  option display 65, 130 (recommended but adjust to suit)
  option baudrate 230400 (recommended but adjust to suit)
  option controls 110 (if you increase the number of presets, increase this number)

Normally, the software will run stand alone and you won't have a terminal connected.
However if you would like to modify/debug the software, then there is a constant called
'D' defined at the beginning of the crunched basic programme. It will be set to 0 to
turn off all debugging messages. You can choose to set the value to 1, 2 or 3 to output
an increasingly extensive set of debugging messages.

Look for the following line to enable debugging output:
  const D=0 'Recommend keeping as 0 unless you are specifically debugging/modifying code

Normally, the software won't run if a working DAB radio card is not connected to the
micromite plus board. Another constant called 'SA' can be set to '1' if you want to
play with the software on a stand alone micromite plus board, without DAB hardware.

Look for the following line to enable stand alone mode
  const SA=0 'set to 1 to enable stand alone mode

I have made a few hardware changes which are described in the source code. The two
constants 'Pv' and 'IrLed' should be set to 1 to enable the support software.
The 'Pv' constant enables pin 35 as a voltage monitor interrupt that will mute the
radio when the +5V line sags. The 'IrLed' constant enables pin 34 as an LED output,
to flash when IR commands are received. The 'IrBuzz' constant enables the buzzer on
the micromite when IR commands are received (ie it beeps at you)

Look for the following lines to enable these software features:
  const Pv=0
  const IrLed=0
  const IrBuzz=0

You will almost certainly have a different IR remote control than I do, or will
almost certainly have it configured differently to mine. In this version of the
alternate software, the IR codes are all defined in a separate configuration file
called "InfraRed.csv". You should be able to edit this in a spreadsheet programme such
as Excel or a text editor. This file is required to be in the root of the SDMMC card.
Modify the file to suit your particular IR remote configuration, but do NOT change the
order of the rows, and DO NOT CHANGE the column headings in the column heading row!
-----------------------------------------------------
If you installed an earlier version of this software, the Config0.csv file format
in this version has changed and the original configuration will be unrecognised. It
won't crash the radio, it will only fail to recognise your old configuration.
After reconfiguring in this version, the configuration will automatically save and
the radio will behave in a similar manner to earlier versions.
