-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syncronization #55
Comments
Did you solve this? |
Maciej (of DCSBIOSKIT) just helped me get it figured out today. He is putting a request in for a fix on the file DcsBiosNgRS485Slave.cpp in the arduino library. Here is my code for the electrical panel which is now finally compiling using RS485 as a short term fix. The issue was modifying this line - DcsBios::PollingInput::resetAllStates(); from the original example. //ELECTRICAL PANEL// #define DCSBIOS_RS485_SLAVE 31 DcsBios::Switch3Pos batterySw("BATTERY_SW", 11, 9); DcsBios::ProtocolParser parser; unsigned long uLastModelTimeS = 0xFFFFFFFF; // Start big, to ensure the first step triggers a resync int ledState = true; void onModTimeChange(char* newValue) { if( currentModelTimeS < uLastModelTimeS ) } void setup() { void loop() { |
Excellent! |
@kstrance |
@Jocman I wish I could help on this one, but @maciekish was the one to truly help. I am not sure if because I am using his dcsbioskit that utilizes RS485 was originally the issue. Once the arduino library was updated with the required changes for RS485 and the code was amended to the sketch and uploaded to his boards, everything worked. I found the syncronization code in the examples folder of the arduino library under EXAMPLES>SYNCRONIZATION>syncronization.ino. Sorry I cant be more help. |
@kyestrance |
If possible, am looking for help in moving from DCSBIOS Hub version to the new FP fork. Specifically related to syncing physical switches to the game. The original code worked in HUB and have been porting the new arduino FP library as well. What it appears is that 'pollinputcurrent' is no longer available in the switches.h library. I do see the examples of the newer synchronization.ino in the new library, but it appears when trying to update to the newer examples, that 'resetallstates' is not a reference in the library either? Unfortunately, my current skillset ends there and have spent the better part of two weeks trying to figure out how this works between the HUB version and FP version, changes, etc... The code pasted below is what was referenced on DCS forums and created by Blue73 that I then used for my INT_LIGHTS panel originally on HUB. It is driven by the battery switch set to ON and polling the state of switches on that panel. With the latest release and updated arduino FP library, how would this port over to the new version? Thanks for any help, much appreciated. -Kye
//INTERIOR LIGHTS//
#define DCSBIOS_RS485_SLAVE 33
#define TXENABLE_PIN 2
#include <DcsBios.h>
#define DCSBIOS_IRQ_SERIAL
//Interior Lights Panel//
DcsBios::Switch3Pos cockkpitLightModeSw("COCKKPIT_LIGHT_MODE_SW", 3, 4);
DcsBios::Switch2Pos lightsTestSw("LIGHTS_TEST_SW", 5);
DcsBios::Potentiometer warnCautionDimmer("WARN_CAUTION_DIMMER", 6);
#define FORCEPOLLCYCLES 10
unsigned int g_iInitIntervalCounter = 0;
unsigned int g_iForcePollCycles = 0;
void setup() {
DcsBios::setup();
}
void loop() {
DcsBios::loop();
if ( g_iForcePollCycles > 0 )
{
//repeat poll for this many cycles
if ( ++g_iInitIntervalCounter == 0 )
{ PollAllControls(); //main loop 1->65535->0 then polls
g_iForcePollCycles--;
}
}
}
void onBatterySwChange(unsigned int newValue)
{
//Battery Switch change, start polling controls FORCEPOLLCYCLES times
g_iForcePollCycles = FORCEPOLLCYCLES;
}
DcsBios::IntegerBuffer batterySwBuffer(0x54b6, 0x0600, 9, onBatterySwChange);
void PollAllControls()
{
cockkpitLightModeSw.pollInputCurrent();
lightsTestSw.pollInputCurrent();
}
The text was updated successfully, but these errors were encountered: