hoverboard-firmware-hack icon indicating copy to clipboard operation
hoverboard-firmware-hack copied to clipboard

analog control fix

Open kozinalexey opened this issue 6 years ago • 10 comments

steer control from analog bug fix add new style controll "tank mode" forward/reverse from one stick #ifdef CONTROL_ADC_TANKSTYLE

kozinalexey avatar Feb 12 '19 10:02 kozinalexey

Hi, Thank you for the contribution, but I don't think that will work. Please move the line 205 to 208 in the main.c so that it is only calculated when the "Tank Style" is active. Please also add a commented out define at a useful place in config.h.

Jana-Marie avatar Feb 12 '19 12:02 Jana-Marie

And did you test the code? Is there a sample video?

Jana-Marie avatar Feb 12 '19 12:02 Jana-Marie

hi, i make changes, code compiled and tested by my friend. i asked him video. of course i missed to add help/description for #define CONTROL_ADC_TANKSTYLE

kozinalexey avatar Feb 12 '19 12:02 kozinalexey

control forward-backward right-left from one joystick in "tank mode" demo video https://youtu.be/uBMAFsj5K08

kozinalexey avatar Feb 12 '19 13:02 kozinalexey

Could you rename "CONTROL_ADC_TANKSTYLE"? maybe something like adc, zero or bias would be more clear for me. For me "tank-style" is the default steering method already active.

p-h-a-i-l avatar Feb 12 '19 13:02 p-h-a-i-l

Likewise, this is not a fix, but an extension (of an ADC offset). Could you please name this accordingly and adjust the code so that the offset can be set in the config.h?

Jana-Marie avatar Feb 12 '19 14:02 Jana-Marie

Likewise, this is not a fix, but an extension (of an ADC offset). Could you please name this accordingly and adjust the code so that the offset can be set in the config.h? offset no have affect to reverse command

cmd2 = CLAMP(adc_buffer.l_rx2 - ADC2_MIN, 0, ADC2_MAX) / (ADC2_MAX / 1000.0f); // ADC2 clamp limited output cmd1 (or cmd2) value between 0 and ADC MAX value so cmd cant to be in range from -1000 to 1000

after cmd = cmd -500; range 0-1000 changed to -500 ... +500 so cmd = (cmd -500) * 2; range 0-1000 changed to -1000 ... +1000

kozinalexey avatar Feb 12 '19 20:02 kozinalexey

@kozinalexey No this is not a fix, the ADC is not supposed to have negative values and the code is not a "out-of-the-box" code for everything, it is a codebase. Most parts in the config.h should be considered as "example" adding more will obfuscate the file even more. Therefore I don't want to merge your pull request, at least not by myself. I will get in touch with @NiklasFauth.

@p-h-a-i-l Thank you for your contributions and I'm sorry that your own pull request is not merged yet, I will review it as well later.

Jana-Marie avatar Feb 12 '19 22:02 Jana-Marie

@Jan--Henrik no worries, I know that my pull request is quite large and time is always limited. You also need to decide what your strategy is for this repo: Code to get stuff running as a foundation for others or a constantly evolving codebase with nice but more complex features.

@kozinalexey you might want to rebase my code change proposals, doesn't look nice to have 7 tiny commits without commit message

p-h-a-i-l avatar Feb 13 '19 12:02 p-h-a-i-l

@p-h-a-i-l im sorry. i did non clone the repository localy, im only using github visual tools for quick fix, githib visual tools have not rebase function

kozinalexey avatar Feb 13 '19 14:02 kozinalexey