Git Product home page Git Product logo

dcs-bios-arduino-library's People

Contributors

aerialelectron avatar ajamtli avatar maciekish avatar talbotmcinnis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dcs-bios-arduino-library's Issues

[BUG] KA-50 Targeting Mode Control Panel - Head-on airborne target button issue

DCS Unified 2.9.3 (DCSBIOS Fork)

Ka-50 Black Shark 3 - Targeting Mode Control Panel

WEAPONS_FORWARD_HEMI_TARGET_BTN

Testing the Bort snippet in Socat (with no DCS running) pushing the button I expect to read the messages:

WEAPONS_FORWARD_HEMI_TARGET_BTN 1
WEAPONS_FORWARD_HEMI_TARGET_BTN 0

but I get instead only:

1
0

and, if I run DCS, I don't see the virtual button moving.

To Reproduce

Expected behavior

I expect tho read the messages sent
WEAPONS_FORWARD_HEMI_TARGET_BTN 1
WEAPONS_FORWARD_HEMI_TARGET_BTN 0
but I get only
1
0

Screenshots

Additional context

With the support (and effort and time) of Vinc_Vega, I found that there's some internal DCSBIOS issue, as if I load a simple sketch like:
`
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::Switch2Pos weaponsForwardHemiTargetBtn("WEAPONS_FORWARD_HEMI_TARGET_BTN", 3);

void setup() {
DcsBios::setup();
}

void loop() {
DcsBios::loop();
}

`

I get the correct behaviour (the full messages sent correctly).

But switching to RS_485 bus (as per my system):

`//#define DCSBIOS_IRQ_SERIAL

#define DCSBIOS_RS485_SLAVE 126 //Nr. massimo: 126

/*
The Arduino pin that is connected to the
/RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2 //PIN RISERVATO PER PROTOCOLLO 487

#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::Switch2Pos weaponsForwardHemiTargetBtn("WEAPONS_FORWARD_HEMI_TARGET_BTN", 3);

void setup() {
DcsBios::setup();
}

void loop() {
DcsBios::loop();
}`

I get only 1 and 0

The issue seems be limited to RS_485 bus, as in IRQ_SERIAL mode it works correctly.

Arduino Nano Every requires workaround

I have a couple of PCBs that I designed for my Warthog pit (CMSP, CMSC, and ARC-210) that require an Arduino Nano Every with the ATMega4809 microcontroller.

The boards don't work using RS485, but they do work when directly connected via USB. However, I have found that I have to first open and close a serial monitor on each board via the Arduino IDE before it will communicate with DCS. The ports are recognized by socat, but they won't talk to DCS until after the serial monitor trick.

Any idea what might be causing this? Any suggested alternative approach to make these boards work without the extra step?

Thanks,
Eric

[BUG] : DcsBios::Potentiometer min & max values are not limiting the travel of the in-game lever

DCS-BIOS version
DCS Unified 2.9.3

DCS-BIOS Control
PLT_FLAPS_LEVER when using DcsBios::Potentiometer

Describe the bug

  • Using a 100k linear potentiometer on a Leonardo board, connected to Analog port A0
  • DcsBios::Potentiometer function being used for the PLT_FLAPS_LEVER and a min & max value of 0 & 500 for F14
  • In-game, the flaps lever starts to move from the closed position to the open position. When the open (max travel in-game) is reached, the flap lever quickly snaps to the closed position - the function seems to causing the lever to continuously loop back to the closed position each time the in-game max is reached

To Reproduce

  1. Arduino code :
#define DCSBIOS_DEFAULT_SERIAL
#include "DcsBios.h"

void setup() {
// the flaps lever at 100% or 65535 is up (flaps up)
  DcsBios::Potentiometer pltFlapsLever("PLT_FLAPS_LEVER", A0,false,700,1023);
  DcsBios::setup();
}

void loop() {
  DcsBios::loop();
}
  1. fire up DCS-Bios Bridge or the socat cmd file to communicate with the Leonardo port
  2. Run DCS, Instant Action, F14 tomcat anywhere, in-cockpit, move pot whilst looking at flaps lever

Expected behavior

once the max value is reached, the movement should stop & not loop around

Screenshots

n/a

Additional context

sendDcsBiosMessage sends only boolean values.

Hi. I'm trying to send a filtered value (from potentiometer) to DCS BIOS. But when it comes to sendDcsBiosMessage, it only returns boolean value.(sendDcsBiosMessage is defined to return only bool in Dcsbios.h).
Is this correct? If I'm incorrect, is there any way to send integer value to DCS BIOS?

Adafruit Qualia pins not working with DCS-BIOS

DCS-BIOS version
2.8.7

DCS-BIOS Control
All (tests on DcsBios::Switch2Pos radaltTestSw("RADALT_TEST_SW", A0);)

Describe the bug
I am using the Adafruit Qualia ESP32S3 board, driving a 2.1" round display. The board has a number of pins (see attached) that can be set to digital input or output using pinMode. This works fine with simple code in Arduino IDE (pinMode test works). However in all DCS-BIOS examples tried the DCS-BIOS code will not accept inputs from these pins with or without pinMode on either the analog pins or those stated to offer arduino pins (pinMode test1).

To Reproduce
These results have been confirmed by another person using their own code. In all cases the code compiles without error, it just does not work. To reproduce you will need a Qualia board

Expected behavior
I would expect DCS-BIOS to be able to take input from these pins, as they natively work fine.

Screenshots
See attached

Additional context
Add any other context about the problem here.
Qualia pins

pinMode_test_works.txt
pinMode_test_1.txt

AH-64D Fire panel Cover

This is more of a help request.
Currently working on making all panels for the AH-64D.
I have unfortunatly stumbled upon a problem with the Fire Extg panel.
Is there a way that with a single press of a button i can open the cover then push ENG 1 ?

currently i need to open the PLT_FIRE_ENG1_CVR with my mouse to then press the button on my panel PLT_FIRE_ENG1_BTN.
i have tried binding both the CVR and BTN to 1 pin to see if it would work but it doesnt.

Any of you have tips or work arounds ?

Same used to be with the trigger guard but this got fixed by dcs itself.

any help would be greatly appreciated !!!

Matrix2pos fuction guide

Hi all,

Can you, please, provide a guide for Matrix2pos function? Cannot understand from Button_matrix_Example.ino. I need to know, how do I initialize matrix etc, so it works with matrix2pos and other similar functions.

SwitchMultiPos not correctly accounting for PIN_NC and instead sends the PIN_NC value

In working with SwitchMultiPos we have a 8 position switch with pin 1 not connected.
when we switch between positions on the switch the not connected pin gets sent between each position (ie on a non-shorting switch)

so for example, say an 8 position switch and position 1 is not connected.
you start on position 2,
you move to position 3.
soon as position 2 disconnects position 1 (this PIN_NC pin) is sent so in DCS commands coming from the switch you see this
INS_SW 2
INS_SW 1
INS_SW 3

and if you continue sweeping the switch you get
INS_SW 1
INS_SW 4
INS_SW 1
INS_SW 5
INS_SW 1
INS_SW 6
INS_SW 1
INS_SW 7
INS_SW 1
INS_SW 8
INS_SW 1
INS_SW 7
and so on

from looking at the code for SwitchMultiPos

	class SwitchMultiPosT : PollingInput, public ResettableInput
	{
	private:
		const char* msg_;
		const byte* pins_;
		char numberOfPins_;
		char lastState_;
		bool reverse_;
		char readState() {
			unsigned char ncPinIdx = lastState_;
			for (unsigned char i=0; i<numberOfPins_; i++) {
				if( pins_[i] == PIN_NC)
					ncPinIdx = i;
				else
				{
					if (digitalRead(pins_[i]) == LOW && reverse_ == false) return i;
					else if (digitalRead(pins_[i]) == HIGH && reverse_ == true) return i;
				}
			}
			return ncPinIdx;
		}
		void resetState()
		{
			lastState_ = (lastState_==0)?-1:0;
		}
		void pollInput() {
			char state = readState();
			if (state != lastState_)
			{
				char buf[7];
				utoa(state, buf, 10);
				if (tryToSendDcsBiosMessage(msg_, buf))
					lastState_ = state;
			}
		}
	public:
		SwitchMultiPosT(const char* msg, const byte* pins, char numberOfPins, bool reverse = false) :
			PollingInput(pollIntervalMs),
			lastState_(0)
		{
			msg_ = msg;
			pins_ = pins;
			reverse_ = reverse;
			numberOfPins_ = numberOfPins;
			unsigned char i;
			for (i=0; i<numberOfPins; i++) {
				if( pins[i] != PIN_NC)
					pinMode(pins[i], INPUT_PULLUP);
			}
			lastState_ = readState();
		}
		
		void SetControl( const char* msg )
		{
			msg_ = msg;
		}
        
		void resetThisState()
		{
			this->resetState();
		}
	};
	typedef SwitchMultiPosT<> SwitchMultiPos;

in the public section you skip setting the pinMode for any PIN_NC which would seem to be correct.
then in the private section is where I beleive the issue to be

here is readState

		char readState() {
			unsigned char ncPinIdx = lastState_;
			for (unsigned char i=0; i<numberOfPins_; i++) {
				if( pins_[i] == PIN_NC)
					ncPinIdx = i;
				else
				{
					if (digitalRead(pins_[i]) == LOW && reverse_ == false) return i;
					else if (digitalRead(pins_[i]) == HIGH && reverse_ == true) return i;
				}
			}
			return ncPinIdx;
		}

you check if the pin is a PIN_NC and if so set ncPinIdx to the loop counter then return the the value of the loop count via return ncPinidx

now in Private pollInput()

		void pollInput() {
			char state = readState();
			if (state != lastState_)
			{
				char buf[7];
				utoa(state, buf, 10);
				if (tryToSendDcsBiosMessage(msg_, buf))
					lastState_ = state;
			}

you get the state which for the PIN_NC is going to be the ncPinidx value
since laststate was 2 and ncPinidx contatins 1 it will enter the if (state != lastState_) and then do the tryToSendDcsBiosMessage(msg_, buf) which we dont' want for a PIN_NC. we need it to not send a DcsBiosMessage in that case

one way around this would be to set ncPinidx to PIN_NC

		char readState() {
			unsigned char ncPinIdx = lastState_;
			for (unsigned char i=0; i<numberOfPins_; i++) {
				if( pins_[i] == PIN_NC)
					ncPinIdx = PIN_NC;
				else
				{
					if (digitalRead(pins_[i]) == LOW && reverse_ == false) return i;
					else if (digitalRead(pins_[i]) == HIGH && reverse_ == true) return i;
				}
			}
			return ncPinIdx;
		}

then in

		void pollInput() {
			char state = readState();
			if (state != lastState_)
			{
				char buf[7];
				utoa(state, buf, 10);
				if (tryToSendDcsBiosMessage(msg_, buf))
					lastState_ = state;
			}

check for PIN_NC and skip if that value is used

		void pollInput() {
			char state = readState();
			if (state != lastState_ || state != ncPinidx)
			{
				char buf[7];
				utoa(state, buf, 10);
				if (tryToSendDcsBiosMessage(msg_, buf))
					lastState_ = state;
			}

this way when state is PIN_NC the if loop is not entered so no DCS bios message is sent

Can we get DCS BIOS RS485 going on STM Blue Pills - both master and slave?

Hi all,

Been playing with a few devices on the the bench today and got RS485 running, very happy.

At this point the RS485 master requires the device to be an Arduino MEGA2560
Not hard to get them, but they're a big and expensive board.
The STM Blue Pill has 3 or 4 USARTS in addition to the USB port it seems like a great candidate for an RS485 master, more compact and less than 1/4 of the price.

Also would be great to get these going as a slave as well, but not sure how to tell DCS BIOS which USART is connected to a 485 transceiver.

Just a random lookup on ali express, an STM Blue Pill USD $3.33 delivered.
5 / 10 packs are available too.

I'm not great with code, but would be happy to participate / test code.

Syncronization

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();
}

RS485 with Interrupts

Hi, does DCS-BIOS use interrupts for RS485 slave devices? I'm skimming through the code but it doesn't seem very clear.

Background: I'm trying to run a display for the A-10C CDU with Bodmers HX_8357 library. As good as it is, even with additional optimisations it's too slow to draw the CDU fast enough and it seems like the slave Arduino Mega is losing incoming data due to the drawing. Sometimes part of the display don't update at all, sometimes text entered into the CDU doesn't show up, or shows up partially, and after a while the whole screen gets garbled. I'm assuming the last issue is because the Arduino starts reading data at a random point in the data stream and tries to draw an invalid character and this messes up the drawing with the HX_8357 library. If I connect it directly over USB instead of RS485, it works perfectly fine. I'm assuming this is because USB uses interrupts properly, but the code isn't very clear about RS485. Can someone help me understand this please?

In DcsBiosNgRS485Slave.cpp.inc:224, you do indeed attach interrupts to the UDRE, RX and TX:

ISR(USART0_RX_vect) { rs485slave.rxISR(); }
ISR(USART0_TX_vect) { rs485slave.txcISR(); }
ISR(USART0_UDRE_vect) { rs485slave.udreISR(); }

However, in Protocol.cpp::21, i find this code, which seems to disable interrupts for RS485 slave devices:

void ProtocolParser::processCharISR(unsigned char c) {
	incomingDataBuffer.put(c);
	if (processingData) return;
	
	processingData = true;
	while (1) {
		if (incomingDataBuffer.isEmpty()) {
			processingData = false;
			return;
		}
		unsigned char nextByte = incomingDataBuffer.get();
		interrupts();
		processChar(nextByte);
#ifdef DCSBIOS_RS485_SLAVE <------------------------------- Why?!
		noInterrupts();
#endif
	}
}

Do I understand this correctly that slaves do not use interrupts, and the slow drawing is indeed what is causing the display issues? If so, does anyone know why the interrupts were disabled for the slaves? Seems like a serious issue to me.

ATmega32U4 supported as a RS485 Master/Slave

Is it possible to get the ATmega32U4 supported as a RS485 Master/Slave?
working on a project we we're using the Sparkfun Pro Micro with HID but would the rest of our pit we'd like to also use it as RS485 Master/Slave.

It looks like the issue is with the UART
added my log file to show the errors

RS485.log.txt

My Sample test code

#include <Arduino.h>

/*
  The following #define tells DCS-BIOS that this is a RS-485 slave device.
  It also sets the address of this slave device. The slave address should be
  between 1 and 126 and must be unique among all devices on the same bus.
*/

#define DCSBIOS_DEFAULT_SERIAL
#define DCSBIOS_RS485_SLAVE 1

/*
  The Arduino pin that is connected to the
  /RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2

#include "DcsBios.h"

/* paste code snippets from the reference documentation here */

void setup() {
  DcsBios::setup();
}

void loop() {
  DcsBios::loop();
}

TACAN mode selector switch - possible problems with 'new' DCS Dios script

The behaviour of the rotary switch in game does not match the actual input using the script from the newer DSC Bios documentation,

I loaded the old script in place of the new, and it works perfectly

New DCS Bios script (problematic)

const byte tacanModePins[9] = {PIN_0, PIN_1, PIN_2, PIN_3, PIN_4}
DcsBios::SwitchMultiPos tacanMode("TACAN_MODE", tacanModePins, 9);

Old DSC Bios script (working)

const byte tacanModePins[5] = {PIN_0, PIN_1, PIN_2, PIN_3, PIN_4};
DcsBios::SwitchMultiPos tacanMode("TACAN_MODE", tacanModePins, 5);

STM32duino support with RS485

Hi, I have DCS-BIOS up and running on an STM32F401CC over USB successfully using the STM32duino board support package.

However, when i try RS485 instead, it fails with "fatal error: libmaple/usart.h: No such file or directory". Could it be that this requires Roger Clarks STM32 board support package instead? It compiles fine with that, but there are 2 huge caveats - It only supports the older STM32F1XXX chips, and newer libraries like Bodmers TFT_eSPI library only support STM32duino, not Roger Clarks. And I absolutely need TFT_eSPI. So I'm caught between a rock and a hard place.

So it appears only the USB part of the STM32 support actually supports STM32duino, and the RS485 part was never migrated to STM32duino?

Q (bug?): Garbled data on complex sketches - (concurrency?) isssue in DcsBiosNgRS485Slave.cpp.inc

I am seeing garbled string data (F-16 DED) , and randomly firing LEDs in complex sketches.

According to this comment from the DCS forums (credit BoboBear):

https://forum.dcs.world/topic/208455-dcs-bios-over-rs485/page/3/#comment-4374711

There seems to be an unreported issue In function:

void RS485Slave::rxISR()

I tested the fix mentioned in the issue, that is, set the state before processing - and this indeed seems to fix the problem. The RX_WAIT_DATA case is changed to look like this:

case RX_WAIT_DATA: rxtx_len--; if (rxtx_len == 0) { state = RX_WAIT_CHECKSUM; } if (rx_datatype == RXDATA_DCSBIOS_EXPORT) { parser.processCharISR(c); } break;

Should this be considered as a patch?

STM32 Compile Issues

Hi, I cannot get a simple DCS-BIOS sketch to compile on my STM32F103C8 blue pill.
I can however compile and upload the simple Blink sketch and another sketch which reads potentiometer outputs etc with no issues.
I used the STM32duino board definitions.
I have installed your Arduino library version 3.6 from here: https://github.com/talbotmcinnis/dcs-bios-arduino-library/releases/download/0.3.6/dcs-bios-arduino-library-0.3.6.zip
I am using the Flight Panels DCS BIOS code.

Hers is the sketch code:

#define DCSBIOS_DEFAULT_SERIAL
#define DCSBIOS_FOR_STM32
#include "DcsBios.h"

/* Declare a Master Caution Reset button on pin 10 /
DcsBios::Switch2Pos ufcMasterCaution("UFC_MASTER_CAUTION", PB4);
/
Make the LED connected to pin 13 into a Master Caution Light */
DcsBios::LED masterCaution(0x1012, 0x0800, PC13);

void setup() {
DcsBios::setup();
}

void loop() {
DcsBios::loop();
}

I get the following errors on compile:

In file included from C:\Users\Peter\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.6\src/DcsBios.h:130,
from C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_800786\MasterCaution.ino:6:
C:\Users\Peter\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.6\src/internal/RotarySwitch.h: In member function 'void DcsBios::RotarySwitchT<pollIntervalMs, stepsPerDetent>::pollInput()':
C:\Users\Peter\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.6\src/internal/RotarySwitch.h:48:54: error: no matching function for call to 'min(int, signed char&)'
48 | switchValue_ = min(switchValue_+1, maxSwichValue_);
| ^
In file included from c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\algorithm:62,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/wiring_constants.h:26,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/wiring.h:34,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/Arduino.h:36,
from sketch\MasterCaution.ino.cpp:1:
c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\bits\stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
3474 | min(initializer_list<_Tp> __l, _Compare comp)
| ^~~
c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\bits\stl_algo.h:3474:5: note: template argument deduction/substitution failed:
In file included from C:\Users\Peter\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.6\src/DcsBios.h:130,
from C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_800786\MasterCaution.ino:6:
C:\Users\Peter\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.6\src/internal/RotarySwitch.h:48:54: note: mismatched types 'std::initializer_list<Tp>' and 'int'
48 | switchValue
= min(switchValue
+1, maxSwichValue
);
| ^
In file included from c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\algorithm:62,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/wiring_constants.h:26,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/wiring.h:34,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/Arduino.h:36,
from sketch\MasterCaution.ino.cpp:1:
c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\bits\stl_algo.h:3468:5: note: candidate: 'template constexpr _Tp std::min(std::initializer_list<_Tp>)'
3468 | min(initializer_list<_Tp> l)
| ^~~
c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\bits\stl_algo.h:3468:5: note: template argument deduction/substitution failed:
In file included from C:\Users\Peter\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.6\src/DcsBios.h:130,
from C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_800786\MasterCaution.ino:6:
C:\Users\Peter\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.6\src/internal/RotarySwitch.h:48:54: note: mismatched types 'std::initializer_list<Tp>' and 'int'
48 | switchValue
= min(switchValue
+1, maxSwichValue
);
| ^
In file included from c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\algorithm:61,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/wiring_constants.h:26,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/wiring.h:34,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/Arduino.h:36,
from sketch\MasterCaution.ino.cpp:1:
c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\bits\stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
278 | min(const _Tp& __a, const _Tp& __b, _Compare comp)
| ^~~
c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\bits\stl_algobase.h:278:5: note: template argument deduction/substitution failed:
In file included from C:\Users\Peter\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.6\src/DcsBios.h:130,
from C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_800786\MasterCaution.ino:6:
C:\Users\Peter\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.6\src/internal/RotarySwitch.h:48:54: note: deduced conflicting types for parameter 'const Tp' ('int' and 'signed char')
48 | switchValue
= min(switchValue
+1, maxSwichValue
);
| ^
In file included from c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\algorithm:61,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/wiring_constants.h:26,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/wiring.h:34,
from C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/Arduino.h:36,
from sketch\MasterCaution.ino.cpp:1:
c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\bits\stl_algobase.h:230:5: note: candidate: 'template constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
230 | min(const _Tp& __a, const _Tp& b)
| ^~~
c:\users\peter\appdata\local\arduino15\packages\stmicroelectronics\tools\xpack-arm-none-eabi-gcc\10.2.1-1.1\arm-none-eabi\include\c++\10.2.1\bits\stl_algobase.h:230:5: note: template argument deduction/substitution failed:
In file included from C:\Users\Peter\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.6\src/DcsBios.h:130,
from C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_800786\MasterCaution.ino:6:
C:\Users\Peter\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.6\src/internal/RotarySwitch.h:48:54: note: deduced conflicting types for parameter 'const Tp' ('int' and 'signed char')
48 | switchValue
= min(switchValue
+1, maxSwichValue
);
| ^
Multiple libraries were found for "Servo.h"
Used: C:\Users\Peter\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\libraries\Servo
Not used: C:\Program Files (x86)\Arduino\libraries\Servo
exit status 1
Error compiling for board Generic STM32F1 series.

Polling Issue when using latest version of DCS-BIOS v0.3.8

I recently upgraded to DCS-Bios v0.3.8 from 0.2.11. Now i am receiving a polling error when compliling. Sketch works fine with v2.11

Below is the sketch I'm trying to use. I have attached error message as well

Thanks!

#define DCSBIOS_IRQ_SERIAL
#include <DcsBios.h>
#include <timer.h>
Timer tm;

namespace DcsBios {
class SwitchMultiPosBCD : PollingInput {
private:
const char* msg_;
const byte* pins_;
char numberOfPins_;
char lastState_;

 char readState() {
   unsigned char i;
   unsigned char state = 0;
   for (i=0; i<numberOfPins_; i++) {
     unsigned char j = numberOfPins_ - i - 1;

// state |= (digitalRead(pins_[i]) << j);
state |= ((digitalRead(pins_[i]) ^ 1) << j); // to invert logic

   }
   return state;
 }

 void pollInput() {
   char state = readState();
   if (state != lastState_) {
     char buf[7];
     utoa(state, buf, 10);
     if (tryToSendDcsBiosMessage(msg_, buf))
       lastState_ = state;
   }
 }

public:
SwitchMultiPosBCD(const char* msg, const byte* pins, char numberOfPins) : lastState_(0) {
msg_ = msg;
pins_ = pins;
numberOfPins_ = numberOfPins;
unsigned char i;
for (i=0; i<numberOfPins; i++) {
pinMode(pins[i], INPUT_PULLUP);
}
lastState_ = readState();
}
};
}

//Mode-1 Wheel 1 ROTARY ENCODER
const byte iffMode1Wheel1Pins[3] = {27, 26, 25};
DcsBios::SwitchMultiPosBCD iffMode1Wheel1("IFF_MODE1_WHEEL1", iffMode1Wheel1Pins, 3);

//Mode-1 Wheel 2 ROTARY ENCODER
const byte iffMode1Wheel2Pins[2] = {23, 24};
DcsBios::SwitchMultiPosBCD iffMode1Wheel2("IFF_MODE1_WHEEL2", iffMode1Wheel2Pins, 2);

//Mode-3A Wheel 1 ROTARY ENCODER
const byte iffMode3aWheel1Pins[3] = {56, 55, 54};
DcsBios::SwitchMultiPosBCD iffMode3aWheel1("IFF_MODE3A_WHEEL1", iffMode3aWheel1Pins, 3);

//Mode-3A Wheel 2 ROTARY ENCODER
const byte iffMode3aWheel2Pins[3] = {58, 59, 60};
DcsBios::SwitchMultiPosBCD iffMode3aWheel2("IFF_MODE3A_WHEEL2", iffMode3aWheel2Pins, 3);

//Mode-3A Wheel 3 ROTARY ENCODER
const byte iffMode3aWheel3Pins[3] = {62, 63, 64};
DcsBios::SwitchMultiPosBCD iffMode3aWheel3("IFF_MODE3A_WHEEL3", iffMode3aWheel3Pins, 3);

//Mode-3A Wheel 4 ROTARY ENCODER
const byte iffMode3aWheel4Pins[3] = {66, 67, 68};
DcsBios::SwitchMultiPosBCD iffMode3aWheel4("IFF_MODE3A_WHEEL4", iffMode3aWheel4Pins, 3);

void setup() {
DcsBios::setup();

}

void loop() {
DcsBios::loop();
polling error.txt
}

DCS BIOS FOR STM32

Hello
I'm new here and trying to figure out how to code in DCS BIOS using the STM32 extension for an f-16 cockpit, I'm currently using the dcs-bios-arduino-library-0.3.9.

After I compile the code a sequence of error relating directly to the DCSBIOS.h appears on the arduino ide console, even when just a small part of the code is used the error report is the same. When changed for the arduino board it compile without problems. normally was used the STM32F4 board but even when other boards are used the error is the same.

the code is bellow:
/*
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
#define DCSBIOS_FOR_STM32

#include "DcsBios.h"

// TEST PANEL

int FLCS_MAINT = PE_2 ; // flcs maint
int FLCS_TEST = PE_3 ; // flcs test
int PROBE_HEAT = PE_4 ; // probe heat
int PROBE_TEST= PE_5 ; // probe test
int FIRE_OVHT = PE_6 ; // overhear - fire

/* paste code snippets from the reference documentation here */

void setup() {
DcsBios::setup();
}

void loop() {
DcsBios::loop();
}

here is the error that returns

In file included from C:\Users\leosa\AppData\Local\Temp.arduinoIDE-unsaved2024113-18876-1rtbjia.9jz6\IRQSerial\IRQSerial.ino:21:
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:55:20: error: expected constructor, destructor, or type conversion before '(' token
55 | ISR(USART0_RX_vect) {
| ^
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h: In function 'void DcsBios::setup()':
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:27:14: error: 'PRR' was not declared in this scope; did you mean 'PWR'?
27 | #define PRR0 PRR
| ^~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:61:25: note: in expansion of macro 'PRR0'
61 | PRR0 &= ~(1<<PRUSART0);
| ^~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:61:38: error: 'PRUSART0' was not declared in this scope; did you mean 'USART1'?
61 | PRR0 &= ~(1<<PRUSART0);
| ^~~~~~~~
| USART1
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:62:25: error: 'UBRR0H' was not declared in this scope
62 | UBRR0H = 0;
| ^~~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:63:25: error: 'UBRR0L' was not declared in this scope
63 | UBRR0L = 3; // 250000 bps
| ^~~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:64:25: error: 'UCSR0A' was not declared in this scope
64 | UCSR0A = 0;
| ^~~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:65:25: error: 'UCSR0C' was not declared in this scope
65 | UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
| ^~~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:65:38: error: 'UCSZ00' was not declared in this scope
65 | UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
| ^~~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:65:52: error: 'UCSZ01' was not declared in this scope
65 | UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
| ^~~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:67:25: error: 'UCSR0B' was not declared in this scope
67 | UCSR0B = (1<<RXEN0) | (1<<TXEN0) | (1<<RXCIE0);
| ^~~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:67:38: error: 'RXEN0' was not declared in this scope
67 | UCSR0B = (1<<RXEN0) | (1<<TXEN0) | (1<<RXCIE0);
| ^~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:67:51: error: 'TXEN0' was not declared in this scope
67 | UCSR0B = (1<<RXEN0) | (1<<TXEN0) | (1<<RXCIE0);
| ^~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:67:64: error: 'RXCIE0' was not declared in this scope
67 | UCSR0B = (1<<RXEN0) | (1<<TXEN0) | (1<<RXCIE0);
| ^~~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h: In function 'void DcsBios::usart_tx(const char*)':
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:82:41: error: 'UCSR0A' was not declared in this scope
82 | while(!(UCSR0A & (1<<UDRE0))); // wait until TX buffer is empty
| ^~~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:82:54: error: 'UDRE0' was not declared in this scope
82 | while(!(UCSR0A & (1<<UDRE0))); // wait until TX buffer is empty
| ^~~~~
d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:83:33: error: 'UDR0' was not declared in this scope
83 | UDR0 = *c++; // write byte to TX buffer
| ^~~~
Multiple libraries were found for "Servo.h"
Used: C:\Users\leosa\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.7.1\libraries\Servo
Not used: C:\Users\leosa\AppData\Local\Arduino15\libraries\Servo
exit status 1

Compilation error: exit status 1

someone has any clue what is happening?

Latest DCS Bios library "servo.h" library incompatible with ESP32 boards

I updated the DCS Bios library and now get the following error

f:\Users\LES\Documents\Arduino\libraries\Servo\src/Servo.h:77:2: error: #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."
#error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."

All ESP32 boards no cannot be used until this is corrected

Possible STM32 support - pull available on original arduino library repo

Hi there,
Hope I'm putting the right info in the right place.
I get lost in github sometimes.

This is the pull on the oridinal DCS BIOS arduino lib repo...
dcs-bios/dcs-bios-arduino-library#27

The Arduino mega 2560 has been a bit of a show stopper due to running out of ram.
There are a few STM 32 dev boards that would increase the 8KM SRAM of the arduino to ~ 96KB.

I might only be causing a hassle, but i hope not.
What I'm doing with DCS BIOS seems to be different to (what i think) it's intended purpose is.
I have an LCD and ma driving different content to it depending on the pit i'm in.
This is working great, but have run out of room (moreso RAM) on the Mega 2560.
One example of issue is the PVI-800 output for the Ka-50 - the commas are not part of the string, but when writing to the LCD i need them in, and with some creative code arduino side a mate helped this happen, but litle issues like this are piling up and we've hit the SRAM limit for the code,

Happy for anyone to take and act on this possible STM32 support as seen fit.
If anyone is available i'd also probably love to ask more questions, but I'm sure you're busy so i'll leave it at this for now.

Last thing, do you accept donations, can u buy you a coffee or a beer?
Happy to send a bit of appreciation for an active project.

Addresses.h is outdated

The included Addresses.h file is outdated compared to the version in the dcs-bios repo from which it's generated. Additionally, the naming convention for the constants has changed since the current version was last updated, meaning the current Addresses.h effectively will not work with any current bios version.

It also doesn't seem great that we're duplicating this file across repos, but I'm not sure what the best course of action is here.

Dual concentric rotary encoder emulation feature?

I'm curious if anyone would be interested in a feature to emulate dual concentric rotary encoders using normal rotary encoders with built in push buttons? Concentric encoders are usually found on radio/navigation panels such as the A-10C's ILS and TACAN panels. These types of concentric encoders aren't always easy to source and can be rather expensive so I've found emulating them to be a great option for my own panels.

I've already written the code into the encoders header for my own purposes, but I can make a pull request if there is any interest. In terms of actual changes it's just another encoder class with a second message, second increment and decrement arguments, and another pin number for the button. The encoder defaults to the first message when rotated normally, but switches to the second message as long as the button is held down while rotating.

MatrixSwitches.h should either be bracketed by #ifdef block in the DcsBios.h, or included by default

Currently, MatrixSwitches.h is included from DcBios.h, which leads casual observer to believe this include is always present. However, MatrixSwitches.h itself is conditional on USE_MATRIX_SWITCHES being defined.

This is suboptimal from the perspective of someone trying to understand the library.

Two possible better solutions are:

  • Bracket the DcBios.h include with ifdef block
  • Include MatrixSwitches.h by default

Problem uploading / verify code to arduino

Hi
I recently installed DCS Bios and BORT.
I installed the DCS BIOS lib to the Arduino IDE and i made a sketch code.
For unknown reasn to me i can not verify or upload the sketch code to the arduino.
25 5 2024

Bounty: RS485 support on STM32 with the official STM32duino core

I offer $500 to anyone who updates DCS-BIOS to support RS485 with the official STM32duino core on the STM32 platform. The current code compiles fine on STM32 but only in USB mode. RS485 requires libmaple/usart.h which seems to refer to an older pre-stm32duino library. This code needs to be migrated to stm32duino.

Conditions:

  • Add support for RS485 when compiling DCS-BIOS for STM32 with the official core.
  • Must use interrupt-based communication to not miss any data.
  • Must support latest version of DCS-BIOS (0.3.8 +) at the moment of completion.
  • Must support latest version of the Arduino IDE (2.x +) at the moment of completion.
  • Well-written code, no plain copy-paste of example code.
  • Half the bounty will be paid upon receipt of a short video demonstrating RS485 on an STM32 board, the other half when i receive the code and verify that it works on my STM32F401CC.
  • Optionally, also add support for interrupt-based USB, the current code will miss data if the user sketch runs too slow. This should be fairly simple considering the main requirement already includes interrupt support.
  • Finally, a complete pull request (without merge issues at completion time) must be submitted to the flightpanels fork of DCS-BIOS.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.