I'm using LED Control library for use with DCS BIOS for a flight simulator I'm building. I have gotten the display to work and properly display the desired data, however its filling from the opposite direction than what I want. For example '7---' '50--'. I would like for it start from the right and fill left as the digits increase. Ie. '---7' '--50'
Here is my code currently:
// Include DcsBios and LedControl libraries for 7-segment panel with Max7219 chip
#define DCSBIOS_IRQ_SERIAL
#include <LedControl.h>
#include <DcsBios.h>
/* Create function to configure a 7-segment panel. Pins DIN(12) CLK(11) CS(10) (1)panel */
LedControl lc = LedControl(12, 11, 10);
// IFEI Fuel Flow 7-Seg output
void onIfeiFfRChange(char* newValue) {
/* your code here */
lc.setChar(0, 3, 'F', false);
lc.setChar(0, 0, newValue[2], false);
lc.setChar(0, 1, newValue[1], false);
lc.setChar(0, 2, newValue[0], false);
}
DcsBios::StringBuffer<3> ifeiFfRBuffer(0x7480, onIfeiFfRChange);
void onIfeiFfLChange(char* newValue) {
/* your code here */
lc.setChar(0, 5, newValue[2], false);
lc.setChar(0, 6, newValue[1], false);
lc.setChar(0, 7, newValue[0], false);
lc.setChar(0, 4, 'F', false);
}
DcsBios::StringBuffer<3> ifeiFfLBuffer(0x747c, onIfeiFfLChange);
void setup() {
// put your setup code here, to run once:
DcsBios::setup();
// MAX7219 INITIALISATION
lc.shutdown(0, false); //turn on the display
lc.setIntensity(0, 8); //set the brightness
lc.clearDisplay(0); //clear the display
// custom boot code before connection
lc.setChar(0, 7, '-', false);
lc.setChar(0, 6, '-', false);
lc.setChar(0, 5, '-', false);
lc.setChar(0, 4, 'F', false);
lc.setChar(0, 3, 'F', false);
lc.setChar(0, 2, '-', false);
lc.setChar(0, 1, '-', false);
lc.setChar(0, 0, '-', false);
}
void loop() {
// put your main code here, to run repeatedly:
DcsBios::loop();
}