Giter Club home page Giter Club logo

Comments (3)

Cleric-K avatar Cleric-K commented on May 30, 2024

Hi, I'm not sure why the number of channels is wrong. Anyway if you are not using the analog channels you should change the code to:

#define NUM_ANALOG_INPUTS 0
byte analogPins[] = {};
#define NUM_DIGITAL_INPUTS 12
byte digitalPins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};
#define NUM_DIGITAL_BITMAPPED_INPUTS 0
byte digitalBitmappedPins[] = {};

But I would recommend to use the bitmapped inputs like this:

#define NUM_ANALOG_INPUTS 0
byte analogPins[] = {};
#define NUM_DIGITAL_INPUTS 0
byte digitalPins[] = {};
#define NUM_DIGITAL_BITMAPPED_INPUTS 12
byte digitalBitmappedPins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};

This will allow all 12 buttons to be packed in just one channel (2 bytes/16bits). Otherwise, with every frame you are sending 12 16bit channels of which really only 1 bit has any meaning, so it's a waste.

from vjoyserialfeeder.

CubicVirtuoso avatar CubicVirtuoso commented on May 30, 2024

Thanks for the insight. I've reconfigured with your suggestion but still having issues with these momentary buttons.

Firstly when I upload the script I get the following warnings:

C:\Users\William\Desktop\vjoy-serialfeeder\Joystick\Joystick.ino:15:0: warning: "NUM_ANALOG_INPUTS" redefined
#define NUM_ANALOG_INPUTS 0

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:258:0,
from sketch\Joystick.ino.cpp:1:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega/pins_arduino.h:29:0: note: this is the location of the previous definition
#define NUM_ANALOG_INPUTS 16

Secondly, in the vJoySerialFeeder App I now show only one channel detected, so I configured a bit-mapped button. Tied it to channel 1 and here are my settings for each bit:
image

Nothing seems to be working, I'm not getting any feedback or seeing any button response in the vJoy Game controller.

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on May 30, 2024

Oh, I see now. I had no idea that NUM_ANALOG_INPUTS is actually #define that is used in Arduino code itself =O
I'll have to update the sketch to use another name. Please replace every instance of NUM_ANALOG_INPUTS inside the .ino file with something else.

About the the other problem: I completely forgot that recently there was update of vjsf that is probably the reason for this.

Some time ago it turned out that IBUS uses only 12bits (0-2047) for each channel. This leaves 4bits free from every 16. Thus FlySky is using the 4bits of three consecutive channels to pack another 12-bit channel. For this reason if you have 3 channels (2 bytes/16-bit each) in the frame, you can pack inside one additional 12-bit channel (3 times the 4 unused bits).

This is the reason that you got 37 channels instead of 28.
28/3 = 9.333... So with 28 16bit values you can pack 9 additional channels, giving the total of 37.

Newer AFHDS3 tranismitters pack these additional channels. Within the standard 14 channels they pack 4 additional for total of 18. That's why I've implemented this in vjsf, but also made it possible to use the old behavior that uses the full 16-bits for each channel. You have to click the Setup button next to the IBUS protocol selector and there choose 16-bit channels.

I had to document this but I completely forgot about all this.

from vjoyserialfeeder.

Related Issues (20)

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.