Kenpilot Posted March 28, 2024 Posted March 28, 2024 Building the A10 CMSP and for the display, I copied the sketch from DCS Bios and its giving me an error code when I try to compile the sketch. error: 'onCmsp1Change' was not declared in this scope DcsBios::StringBuffer<19> cmsp1Buffer(0x1000, onCmsp1Change); error: 'onCmsp2Change' was not declared in this scope DcsBios::StringBuffer<19> cmsp2Buffer(0x1014, onCmsp2Change); I'm not familiar with the coding and language in the sketches, I just copy and paste, so please be gentle. Thanks! Windows 10 ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO intel i7-8700k (Not overclocked) 16 GB Ram EVGA GeForce GTX 108ti SC Black Edition SSD Trackir
Vinc_Vega Posted March 28, 2024 Posted March 28, 2024 (edited) Hi Ken, to output the data, you cannot use the simplified code fragments. Unfortunately, it's a bit trickier. Within the sketch header you have to declare the display driver and then initialize it in the setup loop. If you don't know how to do this, please provide us with your display description (kind of driver) and how it is connected to your microcontroller (the wiring). For a simple 2x16 character LCD module the ->LiquidCrystal library<- should do most things for us. Please try the examples to ensure that the display works correctly for you. That kind of display mostly is initialized by the "lcd" object and you may print to either the first (0) or the second (1) line. The Arduino code in the DcsBios section than should look something like this: // ----- print CMSP Display Line 1 to the LCD display ----- void onCmsp1Change(char* newValue) { lcd.setCursor(0,0); lcd.print(newValue); } DcsBios::StringBuffer<19> cmsp1Buffer(0x1000, onCmsp1Change); // ----- print CMSP Display Line 2 to the LCD display ----- void onCmsp2Change(char* newValue) { lcd.setCursor(0,1); lcd.print(newValue); } DcsBios::StringBuffer<19> cmsp2Buffer(0x1014, onCmsp2Change); Regards, Vinc Edited March 28, 2024 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
No1sonuk Posted March 28, 2024 Posted March 28, 2024 You need the whole box of code: void onCmsp1Change(char* newValue) { /* your code here */ } DcsBios::StringBuffer<19> cmsp1Buffer(A_10C_CMSP1_A, onCmsp1Change); The "void..." etc. part is what the "DcsBios::StringBuffer<19> cmsp1Buffer(0x1000, onCmsp1Change);" is looking for. BTW, it looks like you're using an old version of the library - did you see mine has "A_10C_CMSP1_A" in it? That's a new thing to make code updates easier.
Vinc_Vega Posted March 28, 2024 Posted March 28, 2024 (edited) @No1sonuk How can we tell Bort to use the new library? Edit: I found no way to tell Bort to use the Addresses, instead of that control-reference seems to use those names: .../Saved Games/DCS.openbeta/Scripts/DCS-BIOS/doc/control-reference.html Regards, Vinc Edited March 28, 2024 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
No1sonuk Posted March 28, 2024 Posted March 28, 2024 @Vinc_Vega It's apparently not possible. Or at least, I didn't find a way to do it - I've raised an issue with the Bort dev. 1
Kenpilot Posted May 24, 2024 Author Posted May 24, 2024 Well I'm back at trying to get my CMSP display up and running. The display I'm using is here: https://www.microcenter.com/product/632704/inland-1602-i2c-lcd-display-module Any help with a sketch that will display the A10 CMSP using this display would be greatly appreciated! Vinc sent me this sketch but it's not displaying anything. The sketch compiles and uploads just fine but nothing is displayed. /* Tell DCS-BIOS to use a serial connection and use interrupt-driven communication. The main program will be interrupted to prioritize processing incoming data. This should work on any Arduino that has an ATMega328 controller (Uno, Pro Mini, many others). */ #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" // include the library code: #include <LiquidCrystal.h> // initialize the library by associating any needed LCD interface pin // with the arduino pin number it is connected to const int rs = 12, en = 11, d4 = 10, d5 = 9, d6 = 8, d7 = 7; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); /* paste code snippets from the reference documentation here */ // ----- print the first line to the LCD display ----- void onCmsp1Change(char* newValue) { lcd.setCursor(0,0); lcd.print(newValue); } DcsBios::StringBuffer<19> cmsp1Buffer(0x1000, onCmsp1Change); // ----- print the second line to the LCD display ----- void onCmsp2Change(char* newValue) { lcd.setCursor(0,1); lcd.print(newValue); } DcsBios::StringBuffer<19> cmsp2Buffer(0x1014, onCmsp2Change); void setup() { DcsBios::setup(); lcd.begin(20, 2); lcd.clear(); } void loop() { DcsBios::loop(); } Windows 10 ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO intel i7-8700k (Not overclocked) 16 GB Ram EVGA GeForce GTX 108ti SC Black Edition SSD Trackir
Vinc_Vega Posted May 24, 2024 Posted May 24, 2024 Hi Ken, as already told, you have to adjust the sketch to use it with the I2C interface of your display. Here is a link to the library https://www.arduino.cc/reference/en/libraries/liquidcrystal-i2c/ First try to upload the examples to get familiar with the display. If everything works fine, rework the sketch accordingly. Regards, Vinc Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Kenpilot Posted May 24, 2024 Author Posted May 24, 2024 2 hours ago, Vinc_Vega said: Hi Ken, as already told, you have to adjust the sketch to use it with the I2C interface of your display. Here is a link to the library https://www.arduino.cc/reference/en/libraries/liquidcrystal-i2c/ First try to upload the examples to get familiar with the display. If everything works fine, rework the sketch accordingly. Regards, Vinc I understand you've already told me that, and I looked at the library, but I don't know anything about coding and I'm very new to Arduino. I know how to download libraries and copy and past DCS Bios sketches, that's about it unfortunately. I'm slowly learning about coding, but it's going to take me a while before I'm writing my own sketches. Windows 10 ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO intel i7-8700k (Not overclocked) 16 GB Ram EVGA GeForce GTX 108ti SC Black Edition SSD Trackir
Vinc_Vega Posted May 24, 2024 Posted May 24, 2024 (edited) Hi Ken, Here is a link to a description, from where you can start on with your display type. https://community.microcenter.com/kb/articles/649-inland-1602-i2c-module Follow the instruction for wiring and upload the “Hello World” sketch to see if everything works as expected. If you read “Hello World” and "123456!" at your display, go on and adjust the header of the CSMP sketch. The libraries and the LiqidCrystal lcd object have to be changed from #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" // include the library code: #include <LiquidCrystal.h> // initialize the library by associating any needed LCD interface pin // with the arduino pin number it is connected to const int rs = 12, en = 11, d4 = 10, d5 = 9, d6 = 8, d7 = 7; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); to include the I2C library (Wire.h) and the to be installed LiquidCrystal_I2C library. #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" // include the library code: #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27,20,2); // set the LCD address to 0x27 for a 20 chars and 2 line display Depending on the I2C backpack, the address may have to be changed from 0x27 to 0x20. If both addresses do not work, upload an I2C scanner sketch and read out the correct display address at your Arduino IDE serial monitor. https://gist.github.com/tfeldmann/5411375 Let the DcsBios code snippets as they are /* paste code snippets from the reference documentation here */ // ----- print the first line to the LCD display ----- void onCmsp1Change(char* newValue) { lcd.setCursor(0,0); lcd.print(newValue); } DcsBios::StringBuffer<19> cmsp1Buffer(0x1000, onCmsp1Change); // ----- print the second line to the LCD display ----- void onCmsp2Change(char* newValue) { lcd.setCursor(0,1); lcd.print(newValue); } DcsBios::StringBuffer<19> cmsp2Buffer(0x1014, onCmsp2Change); Within the SETUP section you finally need to adjust the initialization procedure void setup() { DcsBios::setup(); lcd.begin(20, 2); lcd.clear(); } to the initialization of the above linked “Hello World” sketch void setup() { DcsBios::setup(); lcd.init(); // initialize the lcd lcd.init(); lcd.backlight(); lcd.clear(); } btw. I have no clue why they twice use lcd.init() The LOOP section remains as it is. void loop() { DcsBios::loop(); } That already should do it. Regards, Vinc Edited May 24, 2024 by Vinc_Vega spell checking Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Kenpilot Posted May 24, 2024 Author Posted May 24, 2024 Thanks Vinc, I will definitely give all of this a shot and hopefully I can figure it out! As always, thanks for your time and assistance!! Windows 10 ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO intel i7-8700k (Not overclocked) 16 GB Ram EVGA GeForce GTX 108ti SC Black Edition SSD Trackir
Kenpilot Posted May 29, 2024 Author Posted May 29, 2024 It works!! But the entire display doesn't show on a 16x2 display. Do people use these displays and able to display the entire CMSP readout? If so, how? I'm guessing I'll need a 20x2 instead. Windows 10 ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO intel i7-8700k (Not overclocked) 16 GB Ram EVGA GeForce GTX 108ti SC Black Edition SSD Trackir
Vinc_Vega Posted May 30, 2024 Posted May 30, 2024 (edited) @Kenpilot Try to change the code in the header to that of a 16x02 display. LiquidCrystal_I2C lcd(0x27,16,2); Regards, Vinc Edited May 30, 2024 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Kenpilot Posted May 30, 2024 Author Posted May 30, 2024 1 minute ago, Vinc_Vega said: @Kenpilot Try to change the code in the header to that of a 16x02 display. LiquidCrystal_I2C lcd(0x27,16,2); Regards, Vinc Awesome, I'll try that. Thanks Vinc! Windows 10 ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO intel i7-8700k (Not overclocked) 16 GB Ram EVGA GeForce GTX 108ti SC Black Edition SSD Trackir
No1sonuk Posted May 30, 2024 Posted May 30, 2024 Pretty sure the labels are 4 characters separated by a space, meaning a 20x2 is needed.
Vinc_Vega Posted May 30, 2024 Posted May 30, 2024 Just now, No1sonuk said: Pretty sure the labels are 4 characters separated by a space, meaning a 20x2 is needed. In that case the spaces could be removed from the string. Than they should fit into the 16 character lines Regards, Vinc 1 Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
No1sonuk Posted May 30, 2024 Posted May 30, 2024 1 minute ago, Vinc_Vega said: In that case the spaces could be removed from the string. Than they should fit into the 16 character lines Regards, Vinc Would need to remember to remove the same characters from the second line string as well.
Kenpilot Posted May 30, 2024 Author Posted May 30, 2024 Thanks guys, I'm just going to get a 20x2 display and use it. Thanks for all the help!! Windows 10 ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO intel i7-8700k (Not overclocked) 16 GB Ram EVGA GeForce GTX 108ti SC Black Edition SSD Trackir
Recommended Posts