Skip to content

Commit

Permalink
switched back to the old KM5S processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
stancecoke committed Nov 12, 2020
1 parent 1cf8e97 commit cb4732b
Show file tree
Hide file tree
Showing 9 changed files with 419 additions and 161 deletions.
11 changes: 6 additions & 5 deletions Inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
#ifndef CONFIG_H_
#define CONFIG_H_
#include "stdint.h"
#define DISPLAY_TYPE_KINGMETER_618U (1<<4) // King-Meter 618U protocol (KM5s, EBS-LCD2, J-LCD, SW-LCD)
#define DISPLAY_TYPE_KINGMETER_901U (1<<8) // King-Meter 901U protocol (KM5s)
#define DISPLAY_TYPE_EBiCS (1<<5) // King-Meter 618U protocol (KM5s, EBS-LCD2, J-LCD, SW-LCD)
#define DISPLAY_TYPE_KINGMETER_618U (1<<3) // King-Meter 618U protocol (KM5s, EBS-LCD2, J-LCD, SW-LCD)
#define DISPLAY_TYPE_KINGMETER_901U (1<<4) // King-Meter 901U protocol (KM5s)
#define DISPLAY_TYPE_KINGMETER (DISPLAY_TYPE_KINGMETER_618U|DISPLAY_TYPE_KINGMETER_901U)
#define DISPLAY_TYPE_BAFANG (1<<2) // For 'Blaupunkt' Display of Prophete Entdecker
#define DISPLAY_TYPE_KUNTENG (1<<1) // For ASCII-Output in Debug mode
Expand Down Expand Up @@ -48,9 +49,9 @@
//#define DIRDET
#define FRAC_HIGH 30
#define FRAC_LOW 15
//#define TS_MODE
#define DISPLAY_TYPE DISPLAY_TYPE_KINGMETER_901U //ASCII Printout for debugging
#define REVERSE 1
#define TS_MODE
#define DISPLAY_TYPE DISPLAY_TYPE_KINGMETER_901U
#define REVERSE 0
//#define FAST_LOOP_LOG
//#define DISABLE_DYNAMIC_ADC
#endif /* CONFIG_H_ */
26 changes: 26 additions & 0 deletions Inc/display_ebics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* display_ebics.h
*
* Created on: 11.11.2020
* Author: Gaswerke
*/

#ifndef DISPLAY_EBICS_H_
#define DISPLAY_EBICS_H_

void ebics_init();
void process_ant_page(MotorState_t* MS_U);
void send_ant_page(MotorState_t* MS_D);

typedef struct _ant_variables
{
uint8_t ui8_assist_level;
uint8_t ui8_light;
uint8_t ui8_motor_characteristic;
uint8_t ui8_wheel_size;
uint8_t ui8_max_speed;
uint8_t ui8_power_assist_control_mode;
uint8_t ui8_controller_max_current;
} struc__ant_variables;

#endif /* DISPLAY_EBICS_H_ */
26 changes: 12 additions & 14 deletions Inc/display_kingmeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Definitions
#define KM_MAX_WHEELTIME 0x0DAC // Maximum Wheeltime reported to the display (e.g. when wheel is stopped)

#if (DISPLAY_TYPE == DISPLAY_TYPE_KINGMETER_618U)
#define KM_MAX_RXBUFF 6
#define KM_MAX_TXBUFF 8
#endif


#if (DISPLAY_TYPE == DISPLAY_TYPE_KINGMETER_901U)
#define KM_MAX_RXBUFF 20
#define KM5S_NM_RXBUFF 15 // KM5S RX-Buffer length for normal mode
#define KM_MAX_TXBUFF 13
#endif



#define KM_PASDIR_FORWARD 0x00
#define KM_PASDIR_BACKWARD 0x01

Expand Down Expand Up @@ -147,8 +133,18 @@ typedef struct

}TX_PARAM_t;

#if (DISPLAY_TYPE == DISPLAY_TYPE_KINGMETER_618U)
#define KM_MAX_RXBUFF 6
#define KM_MAX_TXBUFF 8
#endif


#if (DISPLAY_TYPE == DISPLAY_TYPE_KINGMETER_901U)
#define KM_MAX_RXBUFF 20
#define KM5S_NM_RXBUFF 15 // KM5S RX-Buffer length for normal mode
#define KM_MAX_TXBUFF 13
#endif

typedef struct
{
uint8_t RxState;
Expand All @@ -174,6 +170,8 @@ void KingMeter_Init (KINGMETER_t* KM_ctx);
void KingMeter_Service(KINGMETER_t* KM_ctx);




#endif // Display Type Kingmeter

#endif // KINGMETER_H
Expand Down
23 changes: 23 additions & 0 deletions KiCAD/EBiCS_BLE_Module/EBiCS_BLE_Module-cache.lib
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,29 @@ X OUT 7 500 -100 100 L 50 50 1 1 O
ENDDRAW
ENDDEF
#
# Device_LED
#
DEF Device_LED D 0 40 N N 1 F N
F0 "D" 0 100 50 H V C CNN
F1 "Device_LED" 0 -100 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
LED*
LED_SMD:*
LED_THT:*
$ENDFPLIST
DRAW
P 2 0 1 8 -50 -50 -50 50 N
P 2 0 1 0 -50 0 50 0 N
P 4 0 1 8 50 -50 50 50 -50 0 50 -50 N
P 5 0 1 0 -120 -30 -180 -90 -150 -90 -180 -90 -180 -60 N
P 5 0 1 0 -70 -30 -130 -90 -100 -90 -130 -90 -130 -60 N
X K 1 -150 0 100 R 50 50 1 1 P
X A 2 150 0 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_Q_NPN_BCE
#
DEF Device_Q_NPN_BCE Q 0 0 Y N 1 F N
Expand Down
87 changes: 64 additions & 23 deletions KiCAD/EBiCS_BLE_Module/EBiCS_BLE_Module.sch
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
EESchema Schematic File Version 4
LIBS:EBiCS_BLE_Module-cache
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
Expand All @@ -14,10 +15,10 @@ Comment3 ""
Comment4 ""
$EndDescr
$Comp
L HM-10:HM-10 U?
L HM-10:HM-10 U2
U 1 1 5FA814D7
P 6100 3800
F 0 "U?" H 6050 4837 60 0000 C CNN
F 0 "U2" H 6050 4837 60 0000 C CNN
F 1 "HM-10" H 6050 4731 60 0000 C CNN
F 2 "" H 5850 4550 60 0001 C CNN
F 3 "" H 5850 4550 60 0001 C CNN
Expand All @@ -28,21 +29,21 @@ F 6 "HM-10" H 6250 4250 61 0001 C CNN "MPN"
1 0 0 -1
$EndComp
$Comp
L DC-DC:LM2574N-3.3 U?
L DC-DC:LM2574N-3.3 U1
U 1 1 5FA8238A
P 3300 2550
F 0 "U?" H 3300 3099 50 0000 C CNN
F 0 "U1" H 3300 3099 50 0000 C CNN
F 1 "LM2574N-3.3" H 3300 3008 50 0000 C CNN
F 2 "DIP-8" H 3300 2917 50 0000 C CIN
F 3 "www.national.com/ds/LM/LM2574.pdf" H 3300 2826 50 0000 C CNN
1 3300 2550
1 0 0 -1
$EndComp
$Comp
L JST:HEADER_5 J?
L JST:HEADER_5 J1
U 1 1 5FA837D2
P 1550 3850
F 0 "J?" H 1542 3413 60 0000 C CNN
F 0 "J1" H 1542 3413 60 0000 C CNN
F 1 "HEADER_5" H 1542 3519 60 0000 C CNN
F 2 "" H 1550 3850 60 0000 C CNN
F 3 "" H 1550 3850 60 0000 C CNN
Expand Down Expand Up @@ -86,32 +87,32 @@ Wire Wire Line
Wire Wire Line
3800 4150 5350 4150
$Comp
L Device:Q_PMOS_GSD Q?
L Device:Q_PMOS_GSD Q2
U 1 1 5FA88256
P 9100 3400
F 0 "Q?" H 9306 3354 50 0000 L CNN
F 1 "Q_PMOS_GSD" H 9306 3445 50 0000 L CNN
F 0 "Q2" H 9306 3354 50 0000 L CNN
F 1 "IRLF9014" H 9306 3445 50 0000 L CNN
F 2 "" H 9300 3500 50 0001 C CNN
F 3 "~" H 9100 3400 50 0001 C CNN
1 9100 3400
1 0 0 1
$EndComp
$Comp
L Device:Q_NPN_BCE Q?
L Device:Q_NPN_BCE Q1
U 1 1 5FA88D7B
P 8000 3600
F 0 "Q?" H 8191 3646 50 0000 L CNN
F 0 "Q1" H 8191 3646 50 0000 L CNN
F 1 "Q_NPN_BCE" H 8191 3555 50 0000 L CNN
F 2 "" H 8200 3700 50 0001 C CNN
F 3 "~" H 8000 3600 50 0001 C CNN
1 8000 3600
1 0 0 -1
$EndComp
$Comp
L Device:R R?
L Device:R R5
U 1 1 5FA8B0CA
P 8450 3250
F 0 "R?" H 8520 3296 50 0000 L CNN
F 0 "R5" H 8520 3296 50 0000 L CNN
F 1 "20k" H 8520 3205 50 0000 L CNN
F 2 "" V 8380 3250 50 0001 C CNN
F 3 "~" H 8450 3250 50 0001 C CNN
Expand All @@ -128,10 +129,10 @@ Wire Wire Line
Wire Wire Line
8100 3400 8450 3400
$Comp
L Device:R R?
L Device:R R3
U 1 1 5FA8D17F
P 7650 3600
F 0 "R?" V 7443 3600 50 0000 C CNN
F 0 "R3" V 7443 3600 50 0000 C CNN
F 1 "4k7" V 7534 3600 50 0000 C CNN
F 2 "" V 7580 3600 50 0001 C CNN
F 3 "~" H 7650 3600 50 0001 C CNN
Expand All @@ -158,21 +159,21 @@ Wire Wire Line
Wire Wire Line
1950 3750 1650 3750
$Comp
L Device:R R?
L Device:R R1
U 1 1 5FA8FDE2
P 7250 3200
F 0 "R?" H 7320 3246 50 0000 L CNN
F 0 "R1" H 7320 3246 50 0000 L CNN
F 1 "10k" H 7320 3155 50 0000 L CNN
F 2 "" V 7180 3200 50 0001 C CNN
F 3 "~" H 7250 3200 50 0001 C CNN
1 7250 3200
1 0 0 -1
$EndComp
$Comp
L Device:R R?
L Device:R R2
U 1 1 5FA9045D
P 7250 3500
F 0 "R?" H 7320 3546 50 0000 L CNN
F 0 "R2" H 7320 3546 50 0000 L CNN
F 1 "420" H 7320 3455 50 0000 L CNN
F 2 "" V 7180 3500 50 0001 C CNN
F 3 "~" H 7250 3500 50 0001 C CNN
Expand All @@ -194,14 +195,54 @@ Wire Wire Line
Wire Wire Line
7000 3750 6750 3750
Connection ~ 7250 3350
Connection ~ 8450 3400
Wire Wire Line
8450 3400 8900 3400
$Comp
L Device:LED D1
U 1 1 5FAC254D
P 8450 2050
F 0 "D1" V 8489 1933 50 0000 R CNN
F 1 "LED" V 8398 1933 50 0000 R CNN
F 2 "" H 8450 2050 50 0001 C CNN
F 3 "~" H 8450 2050 50 0001 C CNN
1 8450 2050
0 -1 -1 0
$EndComp
$Comp
L Device:R R4
U 1 1 5FAC4085
P 8450 2550
F 0 "R4" H 8520 2596 50 0000 L CNN
F 1 "10k" H 8520 2505 50 0000 L CNN
F 2 "" V 8380 2550 50 0001 C CNN
F 3 "~" H 8450 2550 50 0001 C CNN
1 8450 2550
1 0 0 -1
$EndComp
Wire Wire Line
7250 1800 8450 1800
Wire Wire Line
8450 3100 8450 1800
8450 1800 8450 1900
Connection ~ 8450 1800
Wire Wire Line
8450 1800 9200 1800
Wire Wire Line
8450 2200 8450 2400
Wire Wire Line
8450 2700 8450 2900
Wire Wire Line
8450 2900 8900 2900
Wire Wire Line
8900 2900 8900 3400
Connection ~ 8450 2900
Wire Wire Line
8450 2900 8450 3100
Text Notes 1150 3700 0 50 ~ 0
Batt+
Text Notes 950 3800 0 50 ~ 0
Power Lock
Text Notes 1200 3900 0 50 ~ 0
GND
Text Notes 1050 4000 0 50 ~ 0
UART Rx
Text Notes 1050 4100 0 50 ~ 0
UART Tx
$EndSCHEMATC
Loading

0 comments on commit cb4732b

Please sign in to comment.