Skip to content

Commit 0aab0f1

Browse files
committed
bobby #1
1 parent 6d83002 commit 0aab0f1

File tree

6 files changed

+1229
-902
lines changed

6 files changed

+1229
-902
lines changed
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.

Inc/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//device specific
1212
#define DEAD_ZONE 64
13-
#define BAT_CELL_CNT 3.0
13+
#define BAT_CELL_CNT 10.0
1414
#define BAT_FULL_CELL 4.2
1515
#define BAT_RATED_CELL 3.7
1616
#define BAT_LOW1_CELL 3.4

Src/generic_device.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@ int clean_adc(uint32_t inval){
2121
return THROTTLE_MAX * SIGN(outval);
2222
return outval * THROTTLE_MAX / (ADC_MAX / 2 - ((DEAD_ZONE*3)/2));
2323
}
24+
25+
int clean_bobbycar(uint32_t inval){
26+
int outval = (uint32_t)(inval >> 16);
27+
if(abs(outval) > (ADC_MAX - ((DEAD_ZONE * 3) / 2)))
28+
return THROTTLE_MAX;
29+
return outval * THROTTLE_MAX / (ADC_MAX - ((DEAD_ZONE*3)/2));
30+
}
31+
2432
void device_specific(){
25-
int tmp = (clean_adc(virtual_ival[1][1]) + THROTTLE_MAX) /2 *SIGN(clean_adc(virtual_ival[1][0]));
33+
int tmp = clean_bobbycar(virtual_ival[1][1]) - clean_bobbycar(virtual_ival[1][0]);
2634
set_throttle(tmp, tmp);
2735
// (adc_buffer.l_tx2-ADC_MID) / 2 + (adc_buffer.l_rx2-ADC_MID) / 2,
2836
// (adc_buffer.l_tx2-ADC_MID) / 2 - (adc_buffer.l_rx2-ADC_MID) / 2);

0 commit comments

Comments
 (0)