Skip to content

Commit

Permalink
Firmware release for TranspOtterNG. Compatible for older TranspOtters
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Fauth committed Dec 16, 2018
1 parent c6e5cf5 commit 95dc493
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 77 deletions.
72 changes: 10 additions & 62 deletions Inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
#define BAT_CALIB_REAL_VOLTAGE 43.0 // input voltage measured by multimeter
#define BAT_CALIB_ADC 1704 // adc-value measured by mainboard (value nr 5 on UART debug output)

#define BAT_NUMBER_OF_CELLS 9 // normal Hoverboard battery: 10s
#define BAT_NUMBER_OF_CELLS 10 // normal Hoverboard battery: 10s
#define BAT_LOW_LVL1_ENABLE 0 // to beep or not to beep, 1 or 0
#define BAT_LOW_LVL1 3.2 // gently beeps at this voltage level. [V/cell]
#define BAT_LOW_LVL1 3.5 // gently beeps at this voltage level. [V/cell]
#define BAT_LOW_LVL2_ENABLE 1 // to beep or not to beep, 1 or 0
#define BAT_LOW_LVL2 3.0 // your battery is almost empty. Charge now! [V/cell]
#define BAT_LOW_DEAD 2.6 // undervoltage poweroff. (while not driving) [V/cell]
#define BAT_LOW_LVL2 3.3 // your battery is almost empty. Charge now! [V/cell]
#define BAT_LOW_DEAD 3.2 // undervoltage poweroff. (while not driving) [V/cell]

#define DC_CUR_LIMIT 15 // DC current limit in amps per motor. so 15 means it will draw 30A out of your battery. it does not disable motors, it is a soft current limit.

Expand Down Expand Up @@ -76,70 +76,18 @@
#define SUPPORT_NUNCHUCK
//#define SUPPORT_REMOTE

#define VEL_P 0.9
#define ROT_P -1.2
#define ROT_P -1.2 // P coefficient for the direction controller. Positive / Negative values to invert gametrak steering direction.
#define FILTER 0.1 // lower value == softer filter. do not use values <0.01, you will get float precision issues.

#define INVERT_R_DIRECTION // Invert right motor
#define INVERT_L_DIRECTION // Invert left motor

// ###### CONTROL VIA NINTENDO NUNCHUCK ######
// left sensor board cable. keep cable short, use shielded cable, use ferrits, stabalize voltage in nunchuck, use the right one of the 2 types of nunchucks, add i2c pullups. use original nunchuck. most clones does not work very well.
//#define CONTROL_NUNCHUCK // use nunchuck as input. disable DEBUG_SERIAL_USART3!

// ############################### DRIVING BEHAVIOR ###############################

// inputs:
// - cmd1 and cmd2: analog normalized input values. -1000 to 1000
// - button1 and button2: digital input values. 0 or 1
// - adc_buffer.l_tx2 and adc_buffer.l_rx2: unfiltered ADC values (you do not need them). 0 to 4095
// outputs:
// - speedR and speedL: normal driving -1000 to 1000
// - weakr and weakl: field weakening for extra boost at high speed (speedR > 700 and speedL > 700). 0 to ~400

#define FILTER 0.1 // lower value == softer filter. do not use values <0.01, you will get float precision issues.
// during nunchuck control (only relevant when activated)
#define SPEED_COEFFICIENT 0.9 // higher value == stronger. 0.0 to ~2.0?
#define STEER_COEFFICIENT 0.5 // higher value == stronger. if you do not want any steering, set it to 0.0; 0.0 to 1.0
#define INVERT_R_DIRECTION
#define INVERT_L_DIRECTION

#define BEEPS_BACKWARD 1 // 0 or 1

//Turbo boost at high speeds while button1 is pressed:
//#define ADDITIONAL_CODE \
if (button1 && speedR > 700) { /* field weakening at high speeds */ \
weakl = cmd1 - 700; /* weak should never exceed 400 or 450 MAX!! */ \
weakr = cmd1 - 700; } \
else { \
weakl = 0; \
weakr = 0; }

// ###### SIMPLE BOBBYCAR ######
// for better bobbycar code see: https://github.com/larsmm/hoverboard-firmware-hack-bbcar
// #define FILTER 0.1
// #define SPEED_COEFFICIENT -1
// #define STEER_COEFFICIENT 0

// #define ADDITIONAL_CODE \
if (button1 && speedR < 300) { /* drive backwards */ \
speedR = speedR * -0.2f; \
speedL = speedL * -0.2f; } \
else { \
direction = 1; } \
if (button1 && speedR > 700) { /* field weakening at high speeds */ \
weakl = speedR - 600; /* weak should never exceed 400 or 450 MAX!! */ \
weakr = speedR - 600; } \
else { \
weakl = 0; \
weakr = 0; }

// ###### ARMCHAIR ######
// #define FILTER 0.05
// #define SPEED_COEFFICIENT 0.5
// #define STEER_COEFFICIENT -0.2

// #define ADDITIONAL_CODE if (button1 && scale > 0.8) { /* field weakening at high speeds */ \
weakl = speedL - 600; /* weak should never exceed 400 or 450 MAX!! */ \
weakr = speedR - 600; } \
else {\
weakl = 0;\
weakr = 0;

// ############################### VALIDATE SETTINGS ###############################

Expand Down
30 changes: 15 additions & 15 deletions build/hover.hex
Original file line number Diff line number Diff line change
Expand Up @@ -1192,20 +1192,20 @@
:104A5800E05D0008E45D0008760000200000E03F0B
:104A6800E85D0008F85D000878000020D34D62106A
:104A7800085E00081F85EB51B600002020000020CA
:104A8800AC000020A80000202E4B1868FBF736FD6C
:104A980002460B46022100912B4800F0ABFF2B4B3E
:104AA8001A8801321A802A4B1C6820462949FCF7CB
:104AB80057FB38B1284B1B681333262B02D8FFF756
:104AC80051F921E020462549FCF74AFB58B1204618
:104AD8002049FCF763FB30B10522214B1A700622EE
:104AE800204B1A7010E01C4B1B6813F1320F06DACA
:104AF80005221B4B1A7001221A4B1A7004E000237E
:104B0800174A1370174A13708AEAEA73A3EBEA7319
:104B1800322B05DC029B002BB8BF5B42322B03DD36
:104B28000022114B1A6003E00F4B1A6801321A6019
:104B38000D4B1A680D4B9A427FF6AAAAFFF712F995
:104B4800FFF7A6BAA8000020B803002078000020CC
:104B5800200000203333BB41740400200000D841FA
:104A8800AC000020A80000202F4B1868FBF736FD6B
:104A980002460B46022100912C4800F0ABFF2C4B3C
:104AA8001A8801321A802B4B1C6820464FF084412B
:104AB800FCF756FB38B1284B1B681333262B02D85A
:104AC800FFF750F922E020462449FCF749FB60B182
:104AD80020464FF08441FCF761FB30B10522204BA2
:104AE8001A7006221F4B1A7010E01B4B1B6813F13B
:104AF800320F06DA05221A4B1A700122194B1A7066
:104B080004E00023164A1370164A13708AEAEA73FF
:104B1800A3EBEA73322B05DC029B002BB8BF5B4288
:104B2800322B03DD0022104B1A6003E00E4B1A688B
:104B380001321A600C4B1A680C4B9A427FF6A8AAED
:104B4800FFF710F9FFF7A4BAA8000020B803002067
:104B58007800002020000020740400200000044297
:104B68009C000020800000205C04002000710200EE
:104B78002DE9F8430222704B5A60704B1B68B3F55D
:104B88007A7F3BDA01336D4A13606D4B998889B29D
Expand Down Expand Up @@ -1511,7 +1511,7 @@
:045E3000E90100087C
:105E340000A24A04640000003713000000000000C0
:105E4400D0070000D0070000D0070000D0070000F2
:105E540000001042D0070000D0070000040000003A
:105E540000002042D0070000D0070000040000002A
:105E6400050000000600000007000000000000001C
:0C5E74000100000002000000030000001C
:0400000508005CADE6
Expand Down

0 comments on commit 95dc493

Please sign in to comment.