lesthegrngo Posted May 31, 2022 Author Posted May 31, 2022 you will have to adjust this part struct StepperConfig stepperConfig = { 3900, // maxSteps 1000, // maxSpeed 1000 // acceleration }; The maxSteps will be the most important one Les
Vuacheslav Posted May 31, 2022 Posted May 31, 2022 5 часов назад, outbaxx сказал: Шаги на оборот для этих степперов составляют 720 полных шагов, с микрошагом 1/8 у вас есть 5760 шагов на оборот. Максимальный ход шагового двигателя это что? 320 градусов? 320/360*5760->5120 шагов? Попробуйте установить stepperconfig.maxSteps на 5120 плюс-минус. Thanks guys for the clarification. It seems that I figured it out with the arrow. According to this program, the arrow moves evenly (up to 250 it works correctly). but since after 300, the divisions go by 100 on the device, the readings do not correspond to those on the screen. How to prescribe so that after 250 it goes to hundreds?
outbaxx Posted May 31, 2022 Posted May 31, 2022 Is there any other Airspeed in the control reference?The one you have now says airspeedRPM… is there an other? I guess you need to find one that return 0-65535, then the needle should work properly.
Vuacheslav Posted May 31, 2022 Posted May 31, 2022 2 часа назад, outbaxx сказал: Есть ли какая-либо другая скорость полета в контрольной ссылке? На том, что у вас сейчас, написано airspeedRPM… есть ли другое? Я думаю, вам нужно найти тот, который возвращает 0-65535, тогда игла должна работать правильно. unfortunately no other
outbaxx Posted May 31, 2022 Posted May 31, 2022 I mean in the control reference in dcsBios, the one you have says airspeedMPH…There could be one that’s called airspeedNeedle or similar & that return values 0-65535.
Vuacheslav Posted May 31, 2022 Posted May 31, 2022 27 минут назад, outbaxx сказал: Я имею в виду, что в контрольной ссылке в dcsBios тот, который у вас есть, говорит airspeedMPH… Может быть один, который называется airspeedNeedle или аналогичный и возвращает значения 0-65535. there is this one
outbaxx Posted May 31, 2022 Posted May 31, 2022 I would try to use that one instead, hopefully the needle will move like in the sim with that one.
Vuacheslav Posted May 31, 2022 Posted May 31, 2022 30 минут назад, outbaxx сказал: Я бы попробовал использовать его вместо этого, надеюсь, стрелка будет двигаться, как в симуляторе с этим. I tried with these parameters, but it turns out that the arrow shows less than on the screen here is my code #define DCSBIOS_IRQ_SERIAL #include <AccelStepper.h> #include "DcsBios.h" struct StepperConfig { unsigned int maxSteps; unsigned int acceleration; unsigned int maxSpeed; }; class Vid29Stepper : public DcsBios::Int16Buffer { private: AccelStepper& stepper; StepperConfig& stepperConfig; unsigned int (*map_function)(unsigned int); unsigned char initState; public: Vid29Stepper(unsigned int address, AccelStepper& stepper, StepperConfig& stepperConfig, unsigned int (*map_function)(unsigned int)) : Int16Buffer(address), stepper(stepper), stepperConfig(stepperConfig), map_function(map_function), initState(0) { } virtual void loop() { if (initState == 0) { // not initialized yet stepper.setMaxSpeed(stepperConfig.maxSpeed); stepper.setAcceleration(stepperConfig.acceleration); stepper.moveTo(-((long)stepperConfig.maxSteps)); initState = 1; } if (initState == 1) { // zeroing stepper.run(); if (stepper.currentPosition() <= -((long)stepperConfig.maxSteps)) { stepper.setCurrentPosition(0); initState = 2; stepper.moveTo(stepperConfig.maxSteps); } } if (initState == 2) { // running normally if (hasUpdatedData()) { unsigned int newPosition = map_function(getData()); newPosition = constrain(newPosition, 0, stepperConfig.maxSteps); stepper.moveTo(newPosition); } stepper.run(); } } }; struct StepperConfig stepperConfig = { 5760, // maxSteps 1000, // maxSpeed 1000 // acceleration }; AccelStepper stepper(AccelStepper::DRIVER, 11, 10); Vid29Stepper airspeedNeedleBuffer(0x5030, stepper, stepperConfig, [](unsigned int newValue) -> unsigned int { return map(newValue, 0, 65535, 0, stepperConfig.maxSteps); }); void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); }
outbaxx Posted May 31, 2022 Posted May 31, 2022 I tried with these parameters, but it turns out that the arrow shows less than on the screen here is my code #define DCSBIOS_IRQ_SERIAL #include #include "DcsBios.h" struct StepperConfig { unsigned int maxSteps; unsigned int acceleration; unsigned int maxSpeed; }; class Vid29Stepper : public DcsBios::Int16Buffer { private: AccelStepper& stepper; StepperConfig& stepperConfig; unsigned int (*map_function)(unsigned int); unsigned char initState; public: Vid29Stepper(unsigned int address, AccelStepper& stepper, StepperConfig& stepperConfig, unsigned int (*map_function)(unsigned int)) : Int16Buffer(address), stepper(stepper), stepperConfig(stepperConfig), map_function(map_function), initState(0) { } virtual void loop() { if (initState == 0) { // not initialized yet stepper.setMaxSpeed(stepperConfig.maxSpeed); stepper.setAcceleration(stepperConfig.acceleration); stepper.moveTo(-((long)stepperConfig.maxSteps)); initState = 1; } if (initState == 1) { // zeroing stepper.run(); if (stepper.currentPosition() stepper.setCurrentPosition(0); initState = 2; stepper.moveTo(stepperConfig.maxSteps); } } if (initState == 2) { // running normally if (hasUpdatedData()) { unsigned int newPosition = map_function(getData()); newPosition = constrain(newPosition, 0, stepperConfig.maxSteps); stepper.moveTo(newPosition); } stepper.run(); } } }; struct StepperConfig stepperConfig = { 5760, // maxSteps 1000, // maxSpeed 1000 // acceleration }; AccelStepper stepper(AccelStepper::DRIVER, 11, 10); Vid29Stepper airspeedNeedleBuffer(0x5030, stepper, stepperConfig, [](unsigned int newValue) -> unsigned int { return map(newValue, 0, 65535, 0, stepperConfig.maxSteps); }); void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); }What numbers does it return in the control reference?
Vuacheslav Posted May 31, 2022 Posted May 31, 2022 11 минут назад, outbaxx сказал: Какие числа он возвращает в контрольной ссылке? at speed 220
outbaxx Posted May 31, 2022 Posted May 31, 2022 You could try to adjust the maxSteps to a lower number, or change 0,65535 to 0,45000.Don’t change both :)
No1sonuk Posted May 31, 2022 Posted May 31, 2022 Do you guys remember when I said this: On 5/29/2022 at 1:01 PM, No1sonuk said: I gave up on the P-51 airspeed indicator. There's a bug which means the number output doesn't relate directly to the angle of the needle. This means that if your gauge face is marked as in the game, the reading doesn't match your airspeed. I wasn't kidding about the bug. I asked the guys that maintain the FlightPanels fork of DCS-BIOS, and they couldn't figure out why the gauge reads differently. 1
Vinc_Vega Posted June 4, 2022 Posted June 4, 2022 (edited) Years ago I found a strange behavior with the MiG-21's radar altimeter. The values were not linear scaleable. The problem could be solved by using the "multiMap" library for Arduino. Maybe that you are facing similar issues. Below is that part of my code: Spoiler ... String raltNd(raltNdValue); int raltNdTemp = (raltNd.toInt() * 1000 / 65535); // conversion factor /* RadAlt needle values must be mapped according to DCS internal RadAlt scale see document "mainpanel_init" --> RADIO_ALTIMETER_indicator note: the in[] array should have increasing values out[] holds the values wanted in m */ int in[] = { 0.0, 41, 70, 103, 130, 181, 210, 245, 260, 298, 325, 472, 580, 680, 732, 807, 867, 909, 1000 }; int out[] = { 0.0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 250, 300, 400, 500, 600, 1000 }; int ralt = multiMap(raltNdTemp, in, out, 19); // for multiMap function see declaration part on top of this sheet ... Regards, Vinc Edited June 4, 2022 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Vuacheslav Posted June 7, 2022 Posted June 7, 2022 31.05.2022 в 18:07, outbaxx сказал: Вы можете попытаться настроить maxSteps на меньшее число или изменить 0,65535 на 0,45000. Не меняйте оба Guys tell me how to make the backlight of the scale in the device? I can’t find the item for which the backlight is responsible (what to look for?), and which pins to connect the LEDs to?
Recommended Posts