Jump to content

ECV56_Polten

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by ECV56_Polten

  1. Me uno al tema, primero para felicitar y agradecer a Japo32 por tremendo laburo que se mandó, y segundo, Francia... bueno, en realidad lo segundo es avisar que algunos piernógrafos no aparecen, como los del F-14 por ejemplo ¿Puedes resubirlos por favor?
  2. As stated in the title, I tried buying the upgrade version of BS3 from Steam, but after entering the payment info a message appears saying it is not possible because "I don´t have Black Shark 2" Is there a process to let Steam detect that I have BS2, or I am forced to buy it from ED?
  3. I have been away from the forum these days, hence the delay answering this thread. First of all, you must correct your "if" blocks in the onPltVuhfRemoteDispChange segment, because you are using the wrong operator. When you use "=" you are assigning a value to a variable, so, when you write if (i = 0) showDigit(i, newValue[i] - 48, 0); what you are telling there, is assign the value 0 to variable i, then evaluate if the value of i is true or false (since i = 0, it will be false; any integer value greater than 0 is true) and it will not run the showdigit part of the code. The correct operator is "==", which is the equality operator. Taking the same example, you should write it like: if (i == 0) showDigit(i, newValue[i] - 48, 0); Then you need to change all the "=" in your if blocks to "==". I have reread my responses, and made this same mistake in almost all of them, sorry for that. You can read about C language operator in https://www.programiz.com/c-programming/c-operators. Once again, I advice you to get a good C programming or Arduino programming book, and/or watch some tutorials about it in Youtube.
  4. Try this code; if it works, I will celebrate with a glass of my finest whiskey, if not, I will drown my sorrow in a glass of my finest whiskey ;-) #define DCSBIOS_IRQ_SERIAL #include <DcsBios.h> const int clockpin = 7; //SCK const int latchpin = 5; //RCK const int datapin = 6; //DIO const int num_of_digits = 6; /* Segment bit location(7=MSB, 0=LSB): * * |--0--| * 5| |1 * |--6--| * 4| |2 * |--3--| **7 */ // Array with possible values(0 = segment ON, 1 = segment off) byte value[] ={ B11000000, // 0 B11111001, // 1 B10100100, // 2 B10110000, // 3 B10011001, // 4 B10010010, // 5 B10000010, // 6 B11111000, // 7 B10000000, // 8 B10010000, // 9 B11111111};// display nothing byte digit[] ={ B00010000, // left segment B00100000, B01000000, B00000001, B00000010, B00000100,};// right segment void showDigit(int segmentnum, int number, bool showdecimalpoint) { digitalWrite(latchpin,LOW); byte value_temp = value[number]; value_temp = showdecimalpoint ? (value_temp & B01111111) : value_temp; shiftOut(datapin,clockpin,MSBFIRST,value_temp); shiftOut(datapin,clockpin,MSBFIRST,digit[segmentnum]); digitalWrite(latchpin,HIGH); } void setup() { pinMode(clockpin, OUTPUT); pinMode(latchpin, OUTPUT); pinMode(datapin, OUTPUT); DcsBios::setup(); } void loop() {; DcsBios::loop(); } void onPltVuhfRemoteDispChange(char* newValue) { int lenNewValue = String(newValue).length(); // get the length of newValue if (String(newValue).indexOf('.') >= 0) { lenNewValue--; // if newValue has a decimal point, I substract 1 to lenNewValue } // get the position of the decimal point and substract 1 to pair it with the segment position of the preceding number int pointPos = String(newValue).indexOf('.') - 1; // if the value to display does not contain a decimal point indexOf will return -1 so pointPos would be -2 in that case if (lenNewValue < num_of_digits) { for (int i = 0; i < lenNewValue; i++) { showDigit(i, 10, 0); // this will display nothing in the first segments if the length of newValue has less tnan 6 digits } } for (int i = num_of_digits - 1; i >= (num_of_digits - lenNewValue); i--) { if (i == pointPos + (num_of_digits - lenNewValue)) { showDigit(i, String(newValue[i - (num_of_digits - lenNewValue)]).toInt(), 1); // toInt() will convert the char to an integer value since showDigit expect this type as second parameter (for example, it will convert the char '5' - which has a value of 53 in the ASCII table, to 5 } else { showDigit(i, String(newValue[i - (num_of_digits - lenNewValue)]).toInt(), 0); // otherwise, only turn on the segments of the digit to display only } } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange);
  5. I am at the office right now, so I can not give you a thorough response, but your code is showing so many decimal points because the "if" blocks are all "true" at some point in the execution. Yesterday night I run some tests in an LCD 1602 I2C display; based on the results I think the code will require some minor changes. I will try to get back at this as soon as I can, in the meantime don't give up, and I suggest you get some good book or tutorial about C programming or Arduino programming, you need a better understanding of the programming logic.
  6. If the code above still don't work, then, try this void onPltVuhfRemoteDispChange(char* newValue) { //trying to pull the char* array into each digit with the bool decimal with a delay to show the number(?) if (atoi(newValue) > 0) { for (int i = 0; i < strlen(newValue); i++) { if (i = 2) showDigit(i, String(newValue[i]).toInt(), 1); else showDigit(i, String(newValue[i]).toInt(), 0); } } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange);
  7. Mmm. that's odd, when I compiled the code in my Arduino IDE it showed no errors or warnings. Just as a test, change the definition of onPltVuhfRemoteDispChange to this: void onPltVuhfRemoteDispChange(char* newValue) { //trying to pull the char* array into each digit with the bool decimal with a delay to show the number(?) if (atoi(newValue) > 0) { for (int i = 0; i < strlen(newValue); i++) { if (i = 2) showDigit(i, newValue[i] - 48, 1); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 else showDigit(i, newValue[i] - 48, 0); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 } } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange);
  8. Final code... maybe Ok, I think I have it, try this code and let me know: #define DCSBIOS_IRQ_SERIAL #include <DcsBios.h> const int clockpin = 7; //SCK const int latchpin = 5; //RCK const int datapin = 6; //DIO const int num_of_digits = 6; /* Segment bit location(7=MSB, 0=LSB): * * |--0--| * 5| |1 * |--6--| * 4| |2 * |--3--| **7 */ // Array with possible values(0 = segment ON, 1 = segment off) byte value[] ={ B11000000, // 0 B11111001, // 1 B10100100, // 2 B10110000, // 3 B10011001, // 4 B10010010, // 5 B10000010, // 6 B11111000, // 7 B10000000, // 8 B10010000, // 9 B11111111};// display nothing byte digit[] ={ B00010000, // left segment B00100000, B01000000, B00000001, B00000010, B00000100,};// right segment void showDigit(int segmentnum, int number, bool showdecimalpoint) { digitalWrite(latchpin,LOW); byte value_temp = value[number]; value_temp = showdecimalpoint ? (value_temp & B01111111) : value_temp; shiftOut(datapin,clockpin,MSBFIRST,value_temp); shiftOut(datapin,clockpin,MSBFIRST,digit[segmentnum]); digitalWrite(latchpin,HIGH); } void setup() { pinMode(clockpin, OUTPUT); pinMode(latchpin, OUTPUT); pinMode(datapin, OUTPUT); DcsBios::setup(); } void onPltVuhfRemoteDispChange(char* newValue) { //trying to pull the char* array into each digit with the bool decimal with a delay to show the number(?) if (atoi(newValue) > 0) { for (int i = 0; i < strlen(newValue); i++) { if (i = 2) showDigit(i, atoi(newValue[i]), 1); else showDigit(i, atoi(newValue[i]), 0); } } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange); void loop() { DcsBios::loop(); } For what I have been reading when you TM1637 arrive it will be way much easier to code.
  9. While I examine the rest of the code, correct yours in the onPltVuhfRemoteDispChange section to this: void onPltVuhfRemoteDispChange(char* newValue) { //trying to pull the char* array into each digit with the bool decimal with a delay to show the number(?) for (int i = 0; i < strlen(newValue); i++) { if (i = 2) showDigit(i, newValue[i], 1); else showDigit(i, newValue[i], 0); } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange);
  10. You call that generic? I hate you :)
  11. Ah, crap! forget about what I wrote below in this post; I haven't pay attention to the comment you put in the for loop //trying to push loop to show digit by saying something like if the char # is bigger then 0, display and show digit. Totally losing my self in the logic. I am leaving the text only to show you how to write a for loop, but I think I understand what you are trying to do, but since like I told I don't have a 6 digit module, I would try to make a guess and some assumptions to help you code this. In the meantime, if someone else can shed some light with this, please do so. Previous text I wrote The problem in the loop() is because the for definition is wrong. for(char i = * ; i < 0 ; i) The correct syntax in C for a for loop can be explained like this: for (type variable_name_here (usually "i") = initial_value; condition_to_stop the loop; increment_or_decrement) So, if I want a loop to run some code 5 times, it will look like: for (int i = 1; i <= 5; i++) { // code to run 5 times; } You have: for(char i = * You can use char instead of int, but you will be limited to values from 0 to 255, if your code does not need to be run more then 256 times, you can leave it as char. The "= *" segment is incorrect, you will need a number, so I am guessing it should be "= 0" or "=1" Then you have "i < 0", in this case it would be correct if you need the for loop to count in reverse order, but then, the first part should have a value greater than 0; taking the previous example, it would be like these if I want a code to be run 5 times but counting in reverse: for (int i = 5; i >= 0; i--) { // code to run 5 times; } Finally, you end the for definition with "; i)", so you are not telling if the value of i should be incremented (i++) or decremented (i--)
  12. There seems to be a problem on the onIasEuIntChange and onIasUsIntChange, or maybe a bug in DCS (never happened before, right?) I changed the code to use onIasEuChange and onIasUsChange, and a char array to int conversion, and it works; here's the code I used: #define DCSBIOS_DEFAULT_SERIAL #include <LiquidCrystal_I2C.h> #include "DcsBios.h" LiquidCrystal_I2C lcd(0x27, 16, 2); unsigned int SpeedEu; unsigned int SpeedUs; void setup() { // put your setup code here, to run once: ScreenSetup(); DcsBios::setup(); } void loop() { DisplayScreen(); DcsBios::loop(); } void ScreenSetup() { lcd.init(); lcd.backlight(); lcd.clear(); lcd.setCursor(0,0); lcd.print("kmh"); lcd.setCursor(8, 0); lcd.print("Knots"); } void DisplayScreen() { lcd.setCursor(0, 1); lcd.print(SpeedEu); lcd.setCursor(8, 1); lcd.print(SpeedUs); } void onIasUsChange(char* newValue) { SpeedUs = atoi(newValue); } DcsBios::StringBuffer<4> iasUsBuffer(0x0426, onIasUsChange); void onIasEuChange(char* newValue) { SpeedEu = atoi(newValue); } DcsBios::StringBuffer<4> iasEuBuffer(0x0422, onIasEuChange); Image shown below displaying an F-14 speed in Km/h and Knots. I also tried the same on Ka-50, no issues so far.
  13. I tried your code dracosb but it keeps showing odd values
  14. I changed the address to 0x0424, and now it shows values on the LCD, but the incorrect ones, unless an F-14B can fly at speeds exceding Mach 10 :unsure: It shows values in the range of 12000 to 14000+
  15. I took a second look to your post, and after examining your found code, now I know that your showDigit calls are lacking arguments. Look at the found code example, when it calls showDigit in loop() void loop() {; for(int i = 0; i < num_of_digits; i++) { showDigit(i, i, true); /*[b]<--- It is using three arguments, not one[/b]*/ demoDelay(); } } So, we can assume for sure that that is one of your problems with the code, I don't know if it is the only one, but correct that and let me know if something changed.
  16. I don't have too much experience in DCS-BIOS (as a matter of fact, I have my own issues to solve with it), and I have some background on C programming. I am not sure if it is the cause of your problem, but I found something odd in your code; specifically in these parts: void showDigit(int segmentnum, int number, bool showdecimalpoint) { digitalWrite(latchpin,LOW); byte value_temp = value[number]; value_temp = showdecimalpoint ? (value_temp & B01111111) : value_temp; shiftOut(datapin,clockpin,MSBFIRST,value_temp); shiftOut(datapin,clockpin,MSBFIRST,digit[segmentnum]); digitalWrite(latchpin,HIGH); } .... void onPltVuhfRemoteDispChange(char* newValue) { //no idea what I am doing here but trying to pull the char* array into each digit showDigit(newValue[0]); showDigit(newValue[1]); showDigit(newValue[2]); showDigit(newValue[3]); showDigit(newValue[4]); showDigit(newValue[5]); showDigit(newValue[6]); showDigit(newValue[7]); } In the first part, you are defining a showDigit function that needs three arguments (two integer numbers and a boolean - true or false), but when you define the onPltVuhfRemoteDispChange function you call showDigit passing only one argument (the value you want to be shown I assume). If I am correct, the calls shoulb be like this: showDigit(a_number (that represents the segment where you want the value to be shown), newValue[0], 1_or_0 (depending if you want to turn on the digital point, 1 for true, 0 for false); So, the calls should look like these: showDigit(0 /* for the first segment */, newValue[0], 0 /* no digital point */); another odd thing in your code is that your display have 6 digits, but in your onPltVuhfRemoteDispChange, you are calling showDigit 8 times, if I am not mistaken, taht would be correct if you had an 8 digit segments. Again, I don't have too much experience in DCS-BIOS, neither a 6 digit module to test it, but I hope my answer leads you to a possible solution. Let me know if it is of any help.
  17. Hi guys, I want to do something simple. The goal here is to show the speed on a LCD 16x2; for that, I have this code: #define DCSBIOS_DEFAULT_SERIAL #include <LiquidCrystal_I2C.h> #include "DcsBios.h" LiquidCrystal_I2C lcd(0x27, 16, 2); void setup() { // put your setup code here, to run once: lcd.init(); lcd.backlight(); lcd.clear(); lcd.setCursor(0,0); lcd.print("kmh"); DcsBios::setup(); } void loop() { DcsBios::loop(); } void onIasEuIntChange(unsigned int newValue) { /* your code here */ lcd.setCursor(0,1); lcd.print(newValue); } DcsBios::IntegerBuffer iasEuIntBuffer(0x042a, 0xffff, 0, onIasEuIntChange); The LCD only shows the "kmh" legend on the first row, but nothing is shown on the second row as intended. I checked the connection on DCS-BIOS web console and all is working fine, so I am guessing it has to be something in the code, probably a misplaced line of code. I am using an Arduino Uno board and a LCD 1602 I2C (PCF8574) :helpsmilie:
  18. Check this thread by Pikey. I used it in two or three of my test/training missions with excelent results for what you are trying to do.
  19. Thanks Saruman, I am downloading the Nvidia hotfix right now. :thumbup:
  20. I experience a constant crash when I fly the F-14B in HTS. The steps I do are more or less these. - Start the plane at Kutaisi - Ask Ground Crew to arm the plane with 4xMK20 - Use F10 Other menu to spawn an easy range - Mark the range with label in F10 map - Ask Jester to set Surface Target to that range using the label - Taxi to RWY 26 - Take off - Ask Jester to set destination WP to ST - Set HUD to AG - Master arm ON - Ask Jester to select the MK20, Nose tail fuzes, pairs - Dive to target area - Release a pair of bombs Few seconds after releasing the bombs, the game crashes every time. I attached the crash log to this thread. I already sent a previous one via sim. dcs.log-20190504-183915.zip
  21. That's correct, lower/upper alt, slower/faster airspeed. Both cases in metric system.
  22. You have a typo on line 17, you wrote resDetection instead of redDetection. I don´t think this is causing the problem you mention, but it will surely cause other problems, specially in line 23 when you call AI_A2A_Dispatcher:New(redDetection)
  23. Same problem here. I can not load any Nevada mission, or instant action (I don´t own PG). It just CTD when I select any activity in Nevada. I attached my dcs.log to this message. dcs.zip
  24. @L39Tom: I think you made a typo in MESSAGE:NewType( " Altitude = ".. playeralt .."m", MESSAGE.Type.Information ):ToAll() It should be MESSAGE:NewType( " Altitude = ".. [b]player1alt[/b] .."m", MESSAGE.Type.Information ):ToAll()
×
×
  • Create New...