Regnad517 Posted December 28, 2017 Posted December 28, 2017 I think this is my last obstacle as far as programming. I got this very nice 6 digit 7 segment tm1637 https://www.amazon.com/RobotDyn-6-Digit-7-segment-Display-76x19mm/dp/B071GN8ZGT?th=1 I have only been able to find 1 library for it https://github.com/TinyTronics/TM1637_6D That library only supports int variables. Im trying to use this as the ILS but want the Char variable options in advanced for matching game numbers. I tried modifying the 4 digit 7 seg library I have and made progress, but the 6 digit writes data right to left so 108 shows up as 801, etc... and cannot set a cursor start point due to the right to left. Any ideas? Thanks again.
33rd_Elvis Posted December 29, 2017 Posted December 29, 2017 Hi, i had the same problem. After a long search problem solved. If you write lc.setChar(0,i,newValue,false); You must invate ! this in the case who´s write. Exemple lc.setChar(0,i,newValue[!i],false); //String inString = ""; void onVhfamFreq1Change(char* newValue) { for(int i=0;i<2;i++) { lc.setChar(0,i+4,newValue[!i],false); } } DcsBios::StringBuffer<2> vhfamFreq1StrBuffer(0x1190, onVhfamFreq1Change); void onVhfamFreq4Change(char* newValue) { for(int i=0;i<2;i++) { lc.setChar(0,i,newValue[!i],false); } }My english is not good but i hope help you:) Aircrafts: F-16C | TF-51 | M2000C | F/A-18C | AV-8B | Viggen | KA-50 | A-10C | UH-1 | Mi-8 | Maps: Caucasus | Persian Gulf | NTTR | Normandy | Syria System: AMD Ryzen 3700X | 32GB Ram | AMD Radeon RX 5700 XT | Win10 64Bit | 1TB 970 EVO M.2 SSD Equipment: TrackIR 5_Trackclip Pro |TM Warthog HOTAS | Oculus Rift S
Regnad517 Posted December 29, 2017 Author Posted December 29, 2017 Elvis, are you doing this with the 6digit library or the 4 digit library? I will play a little with each but figured Id ask
33rd_Elvis Posted December 30, 2017 Posted December 30, 2017 I think you can use this librarie for 4 or 6 digit tube. You must test it. I use 4 digit tube. Aircrafts: F-16C | TF-51 | M2000C | F/A-18C | AV-8B | Viggen | KA-50 | A-10C | UH-1 | Mi-8 | Maps: Caucasus | Persian Gulf | NTTR | Normandy | Syria System: AMD Ryzen 3700X | 32GB Ram | AMD Radeon RX 5700 XT | Win10 64Bit | 1TB 970 EVO M.2 SSD Equipment: TrackIR 5_Trackclip Pro |TM Warthog HOTAS | Oculus Rift S
Regnad517 Posted December 30, 2017 Author Posted December 30, 2017 Well I'm not proud, but got it working with a crap ton of if else statements. lol Couldn't get your suggestion to compile Elvis but thanks for the effort.
33rd_Elvis Posted December 30, 2017 Posted December 30, 2017 You can kontakt IAN. He make´s dcs bios. Send him an PM. I think he can help you. ;-) Aircrafts: F-16C | TF-51 | M2000C | F/A-18C | AV-8B | Viggen | KA-50 | A-10C | UH-1 | Mi-8 | Maps: Caucasus | Persian Gulf | NTTR | Normandy | Syria System: AMD Ryzen 3700X | 32GB Ram | AMD Radeon RX 5700 XT | Win10 64Bit | 1TB 970 EVO M.2 SSD Equipment: TrackIR 5_Trackclip Pro |TM Warthog HOTAS | Oculus Rift S
Regnad517 Posted December 30, 2017 Author Posted December 30, 2017 (edited) Ian has helped me many many times already. I think I will be satisfied with this, at least it is working. Not as pretty as Ian would do it, but its working lol Thanks I spoke too soon - I can get Khz working on its own, and I can get Mhz working on its own, but cannot figure out how to get them both working together on this particular LED since it doesn't write normally or with place holders and I cannot nest a void statement within an if statement. Grrrrr Gonna sleep on it Edited December 30, 2017 by Regnad517
Regnad517 Posted January 2, 2018 Author Posted January 2, 2018 (edited) So I am back at this - IAN, can you look at this and tell me if there is a workaround. I do know this code will not compile but it hopefully gives you an idea of what I am trying to Accomplish void onIlsMhzChange(unsigned int newValue) { if (newValue==0) { void onIlsKhzChange(char* newValue) { if (newValue==1) { int8_t ListDisp[6] = {8,0,1,5,9,0}; int8_t ListDispPoint[6] = {POINT_OFF,POINT_OFF,POINT_OFF,POINT_ON,POINT_OFF,POINT_OFF}; String millisstring; tm1637_6D.display(ListDisp, ListDispPoint); } } DcsBios::StringBuffer<2> ilsKhzStrBuffer(0x1172, onIlsKhzChange); } } DcsBios::IntegerBuffer ilsMhzBuffer(0x1168, 0x0060, 5, onIlsMhzChange); The idea is first I check for the char for the Mhz, if its 0 than the char should be 108. Great I got that fine, but then I need it to also check for the Khz while passing the 108 value. I understand there will be a crap ton of if else statements, but am willing to do that for this 6digit to work. Edited January 2, 2018 by Regnad517
Regnad517 Posted January 4, 2018 Author Posted January 4, 2018 OK - 3 posts in a row - I GOT IT WORKING Not the prettiest way in the world but what I did was modified the 4 digit 1637 library to hold 6 coloms. Then I simply edited the DCS Bios A10C.lua for the ILS values so they write reversed (108 = 801, 109 = 901, etc...) All is working perfectly!
BravoYankee4 Posted January 4, 2018 Posted January 4, 2018 Great. Could you please sum it up with some details?
Regnad517 Posted January 7, 2018 Author Posted January 7, 2018 (edited) Yeah Sure. First off I had to modify the library for the 4Digit 7Seg library file to be 6 Coloms rather than 4. Unfortunately since the 6 Digit display writes right to left there is still some confusion on cursor placement. I wrote a quick little display 1,2,3,4,5,6 to see which cursor placement each went in Here is the code I had to change in the library (Line 40) #define TM1637_MAX_COLOM 6 // number of coloms (digits) Since there are only 4 values for the Mhz i did simple if, else statements For the Khz, I went into the A10c.lua file found in your Saved Games directory of the user profile and changed the Khz values to be reversed defineSetCommandTumb("ILS_KHZ", 53, 3003, 249, 0.1, {0.0, 0.9}, {"01", "51", "03", "53", "05", "55", "07", "57", "09", "59"}, false, "ILS Panel", "ILS Frequency KHz") Here is the final code that works perfectly /* Mega and Uno pinout is the same * GRND = GRND * VCC = 5V * D10 = Digital input pin - this code uses pin 3 * CLK = Digital input pin - this code uses pin 2 */ #define DCSBIOS_DEFAULT_SERIAL #include "TM1637_6D.h" #include <Wire.h> #include "SevenSegmentTM1637.h" #define CLK 2 //pins definitions for TM1637 and can be changed to other ports #define DIO 3 SevenSegmentTM1637 am(2,3); // CLK pin first, D10 pin second TM1637_6D tm1637_6D(CLK,DIO); #include "DcsBios.h" // DCS-Bios Mhz Call void onIlsMhzChange(unsigned int newValue) { // Convert int values to char values reversed if (newValue==0){ am.setCursor(0,0); am.print(801); } else if (newValue==1){ am.setCursor(0,0); am.print(901); } else if (newValue==2){ am.setCursor(0,0); am.print("011"); } else if (newValue==3){ am.setCursor(0,0); am.print(111); } } DcsBios::IntegerBuffer ilsMhzBuffer(0x1168, 0x0060, 5, onIlsMhzChange); // DCS-Bios Khz call with modified A10C.lua void onIlsKhzChange(char* newValue) { am.setCursor(0,3); am.print(newValue); } DcsBios::StringBuffer<2> ilsKhzStrBuffer(0x1172, onIlsKhzChange); // End DCS-Bios Code void setup() { DcsBios::setup(); am.init(); am.clear(); } void loop() { DcsBios::loop(); } Ive also since added the 6 digit library to the code to add a decimal point between the Mhz and the Khz I have no doubt that someone could have wrote code much better than mine, but pretty proud I got it working on my own :thumbup: Edited January 7, 2018 by Regnad517
Regnad517 Posted January 28, 2018 Author Posted January 28, 2018 Well I finally got around to fixing this as well. Hated the idea of having to modify the A10.lua so I dug in and finally figured it out. Here is the new code I am using for this /* Mega and Uno pinout is the same * GRND = GRND * VCC = 5V * D10 = Digital input pin - this code uses pin 3 * CLK = Digital input pin - this code uses pin 2 */ #define DCSBIOS_DEFAULT_SERIAL #include <Wire.h> #include "SevenSegmentTM1637.h" SevenSegmentTM1637 am(2,3); // CLK pin first, D10 pin second #include "DcsBios.h" // DCS-Bios Code void onIlsMhzChange(char* newValue) { am.setCursor(0,0); am.print(newValue[0]); am.setCursor(0,1); am.print(newValue[1]); am.setCursor(0,2); am.print(newValue[2]); } DcsBios::StringBuffer<3> ilsMhzStrBuffer(0x116e, onIlsMhzChange); void onIlsKhzChange(char* newValue) { am.setCursor(0,3); am.print(newValue[1]); am.setCursor(0,4); am.print(newValue[0]); } DcsBios::StringBuffer<2> ilsKhzStrBuffer(0x1172, onIlsKhzChange); // End DCS-Bios Code void setup() { DcsBios::setup(); am.init(); am.clear(); } void loop() { DcsBios::loop(); } Much cleaner and I don't have to modify the values in .lua
Petit_Malin Posted June 19, 2020 Posted June 19, 2020 (edited) Well I finally got around to fixing this as well. Hated the idea of having to modify the A10.lua so I dug in and finally figured it out. Here is the new code I am using for this /* Mega and Uno pinout is the same * GRND = GRND * VCC = 5V * D10 = Digital input pin - this code uses pin 3 * CLK = Digital input pin - this code uses pin 2 */ #define DCSBIOS_DEFAULT_SERIAL #include <Wire.h> #include "SevenSegmentTM1637.h" SevenSegmentTM1637 am(2,3); // CLK pin first, D10 pin second #include "DcsBios.h" // DCS-Bios Code void onIlsMhzChange(char* newValue) { am.setCursor(0,0); am.print(newValue[0]); am.setCursor(0,1); am.print(newValue[1]); am.setCursor(0,2); am.print(newValue[2]); } DcsBios::StringBuffer<3> ilsMhzStrBuffer(0x116e, onIlsMhzChange); void onIlsKhzChange(char* newValue) { am.setCursor(0,3); am.print(newValue[1]); am.setCursor(0,4); am.print(newValue[0]); } DcsBios::StringBuffer<2> ilsKhzStrBuffer(0x1172, onIlsKhzChange); // End DCS-Bios Code void setup() { DcsBios::setup(); am.init(); am.clear(); } void loop() { DcsBios::loop(); } Much cleaner and I don't have to modify the values in .lua Hi Regnad517, I try since a few days to use 2 of this 6 digit 7 seg on a Arduino Nano for UHF/VHF Display for the M2000C Works great on USB but not with the #define DCSBIOS_RS485_SLAVE protocol :( Have you find a solution ? FYI I tried to disable #define TM1637_DEBUG in SevenSegmentTM1637.h and/or try to quote the Serial.begin and Serial.print but not better For Sharing this is the code for the UHF/VHF display on M2000C #include <SevenSegmentTM1637.h> #define TM1637_MAX_LINES 1 // number of display lines #define TM1637_MAX_COLOM 6 // number of coloms (digits) SevenSegmentTM1637 uhf(6,7); SevenSegmentTM1637 vhf(4,5); #define DCSBIOS_DEFAULT_SERIAL #include <DcsBios.h> void onUhfFrequencyChange(char* newValue) { //Display from left to the right uhf.setCursor(0,2); uhf.print(newValue[0]); uhf.setCursor(0,1); uhf.print(newValue[1]); uhf.setCursor(0,0); uhf.print(newValue[2]); uhf.setCursor(0,5); uhf.printRaw(128,5); uhf.setCursor(0,4); uhf.print(newValue[3]); uhf.setCursor(0,3); uhf.print(newValue[3]); } DcsBios::StringBuffer<5> uhfFrequencyBuffer(0x7334, onUhfFrequencyChange); void onVhfFrequencyChange(char* newValue) { vhf.setCursor(0,2); vhf.print(newValue[0]); vhf.setCursor(0,1); vhf.print(newValue[1]); vhf.setCursor(0,0); vhf.print(newValue[2]); vhf.setCursor(0,5); vhf.printRaw(128,5); vhf.setCursor(0,4); vhf.print(newValue[3]); vhf.setCursor(0,3); vhf.print(newValue[3]); } DcsBios::StringBuffer<5> vhfFrequencyBuffer(0x732a, onVhfFrequencyChange); void setup() { DcsBios::setup(); uhf.init(); uhf.clear(); uhf.printRaw(128,4); uhf.printRaw(128,5); vhf.init(); vhf.clear(); vhf.printRaw(128,4); vhf.printRaw(128,5); } void loop() { DcsBios::loop(); } Edited June 19, 2020 by Petit_Malin
olive47 Posted March 14, 2021 Posted March 14, 2021 Salut a vous.... quelqu un ce serait penché sur le tacan du A10??? j ai un 7 segments 4 digit TM1637 avec une mega 2560 merci d avance si quelqu un a un code a partager , car je pedale dans la semoule .
Recommended Posts