diff --git a/306-controller_interface.X/app/can_message.c b/306-controller_interface.X/app/can_message.c
index d8d9a97..3fa19b1 100644
--- a/306-controller_interface.X/app/can_message.c
+++ b/306-controller_interface.X/app/can_message.c
@@ -17,9 +17,7 @@ typedef union {
uint8_t byte2;
uint8_t byte3;
} separate;
- struct {
- uint32_t bytes;
- } full;
+ uint32_t full;
} BYTES_4;
void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
@@ -32,67 +30,109 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
if(idMsg == 0x0) { // CONTROL_SETUP
// steeringMode eraseMemory - controlAliveTime
BYTES_4 tmpData;
- tmpData.full.bytes = data;
+ tmpData.full = data;
if (tmpData.separate.byte1) {
MEM_reset();
}
- CAR_CST.CONTROL_STEERING_MODE = tmpData.separate.byte0;
- CAR_CST.CONTROL_ALIVE_TIME = tmpData.separate.byte3;
- MEM_write_1_byte(MEMADD_CONTROL_STEERING_MODE, CAR_CST.CONTROL_STEERING_MODE);
- MEM_write_1_byte(MEMADD_CONTROL_ALIVE_TIME, CAR_CST.CONTROL_ALIVE_TIME);
- ALIVE_setAliveTime(ALcontroller(), CAR_CST.CONTROL_ALIVE_TIME);
+ KART_CST.CONTROL_STEERING_MODE = tmpData.separate.byte0;
+ KART_CST.CONTROL_ALIVE_TIME = tmpData.separate.byte3;
+ MEM_write_1_byte(MEMADD_CONTROL_STEERING_MODE, KART_CST.CONTROL_STEERING_MODE);
+ MEM_write_1_byte(MEMADD_CONTROL_ALIVE_TIME, KART_CST.CONTROL_ALIVE_TIME);
+ ALIVE_setAliveTime(ALcontroller(), KART_CST.CONTROL_ALIVE_TIME);
}
if(idMsg == 0x1) { // CONTROL_SPEED_FACTOR
// valHH valH valL valLL
+ KART_CST.CONTROL_SPEED_FACTOR = data;
+ MEM_write_4_byte(MEMADD_CONTROL_SPEED_FACTOR, KART_CST.CONTROL_SPEED_FACTOR);
}
if(idMsg == 0x2) { // CONTROL_POWER_FACTOR
// valHH valH valL valLL
+ KART_CST.CONTROL_POWER_FACTOR = data;
+ MEM_write_4_byte(MEMADD_CONTROL_POWER_FACTOR, KART_CST.CONTROL_POWER_FACTOR);
}
if(idMsg == 0x3) { // CONTROL_STEERING_FACTOR
// valHH valH valL valLL
+ KART_CST.CONTROL_STEERING_FACTOR = data;
+ MEM_write_4_byte(MEMADD_CONTROL_STEERING_FACTOR, KART_CST.CONTROL_STEERING_FACTOR);
}
if(idMsg == 0x4) { // CONTROL_SECURITY_PARAM
// maxSpeedFw maxSpeedBw - -
+ BYTES_4 tmpData;
+ tmpData.full = data;
+ KART_CST.CONTROL_MAX_SPEED_FW = tmpData.separate.byte0;
+ KART_CST.CONTROL_MAX_SPEED_BW = tmpData.separate.byte1;
+ MEM_write_1_byte(MEMADD_CONTROL_MAX_SPEED_FW, KART_CST.CONTROL_MAX_SPEED_FW);
+ MEM_write_1_byte(MEMADD_CONTROL_MAX_SPEED_BW, KART_CST.CONTROL_MAX_SPEED_BW);
}
if(idMsg == 0x5) { // CONTROL_SETUP_PARAM
// displayAliveTime steeringAliveTime - -
+ BYTES_4 tmpData;
+ tmpData.full = data;
+ KART_CST.DISPLAY_ALIVE_TIME = tmpData.separate.byte0;
+ KART_CST.STEERING_ALIVE_TIME = tmpData.separate.byte1;
+ MEM_write_1_byte(MEMADD_DISPLAY_ALIVE_TIME, KART_CST.DISPLAY_ALIVE_TIME);
+ MEM_write_1_byte(MEMADD_STEERING_ALIVE_TIME, KART_CST.STEERING_ALIVE_TIME);
+ // TODO set alive times
+ // TODO send params
}
if(idMsg == 0x6) { // CONTROL_SETUP_PARAM_JOY
// joystickMode joystickParam1 joystickParam2 joystickAliveTime
BYTES_4 tmpData;
- tmpData.full.bytes = data;
- CAR_CST.JOYSTICK_MODE = tmpData.separate.byte0;
- CAR_CST.JOYSTICK_PARAM1 = tmpData.separate.byte1;
- CAR_CST.JOYSTICK_PARAM2 = tmpData.separate.byte2;
- CAR_CST.JOYSTICK_ALIVE_TIME = tmpData.separate.byte3;
- MEM_write_1_byte(MEMADD_JOYSTICK_MODE, CAR_CST.JOYSTICK_MODE);
- MEM_write_1_byte(MEMADD_JOYSTICK_PARAM1, CAR_CST.JOYSTICK_PARAM1);
- MEM_write_1_byte(MEMADD_JOYSTICK_PARAM2, CAR_CST.JOYSTICK_PARAM2);
- MEM_write_1_byte(MEMADD_JOYSTICK_ALIVE_TIME, CAR_CST.JOYSTICK_ALIVE_TIME);
+ tmpData.full = data;
+ KART_CST.JOYSTICK_MODE = tmpData.separate.byte0;
+ KART_CST.JOYSTICK_PARAM1 = tmpData.separate.byte1;
+ KART_CST.JOYSTICK_PARAM2 = tmpData.separate.byte2;
+ KART_CST.JOYSTICK_ALIVE_TIME = tmpData.separate.byte3;
+ MEM_write_1_byte(MEMADD_JOYSTICK_MODE, KART_CST.JOYSTICK_MODE);
+ MEM_write_1_byte(MEMADD_JOYSTICK_PARAM1, KART_CST.JOYSTICK_PARAM1);
+ MEM_write_1_byte(MEMADD_JOYSTICK_PARAM2, KART_CST.JOYSTICK_PARAM2);
+ MEM_write_1_byte(MEMADD_JOYSTICK_ALIVE_TIME, KART_CST.JOYSTICK_ALIVE_TIME);
- ALIVE_setAliveTime(ALjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
+ ALIVE_setAliveTime(ALjoy(), KART_CST.JOYSTICK_ALIVE_TIME);
CM_JOY_SETUP(NULL);
}
if(idMsg == 0x7) { // CONTROL_SETUP_PARAM_DRIVE
// driveAliveTime driveSpeedTime driveStopTime -
+ BYTES_4 tmpData;
+ tmpData.full = data;
+ KART_CST.DRIVE_ALIVE_TIME = tmpData.separate.byte0;
+ KART_CST.DRIVE_SPEED_TIME = tmpData.separate.byte1;
+ KART_CST.DRIVE_STOP_TIME = tmpData.separate.byte2;
+ MEM_write_1_byte(MEMADD_DRIVE_ALIVE_TIME, KART_CST.DRIVE_ALIVE_TIME);
+ MEM_write_1_byte(MEMADD_DRIVE_SPEED_TIME, KART_CST.DRIVE_SPEED_TIME);
+ MEM_write_1_byte(MEMADD_DRIVE_STOP_TIME, KART_CST.DRIVE_STOP_TIME);
+ // TODO set alive time
+ // TODO send params
}
if(idMsg == 0x8) { // CONTROL_SETUP_PARAM_BATTERY
// batteryVoltTime batteryCurrentTime batteryEnergyTime batteryAliveTime
+ BYTES_4 tmpData;
+ tmpData.full = data;
+ KART_CST.BATTERY_VOLT_TIME = tmpData.separate.byte0;
+ KART_CST.BATTERY_CURRENT_TIME = tmpData.separate.byte1;
+ KART_CST.BATTERY_ENERGY_TIME = tmpData.separate.byte2;
+ KART_CST.BATTERY_ALIVE_TIME = tmpData.separate.byte3;
+ MEM_write_1_byte(MEMADD_BATTERY_VOLT_TIME, KART_CST.BATTERY_VOLT_TIME);
+ MEM_write_1_byte(MEMADD_BATTERY_CURRENT_TIME, KART_CST.BATTERY_CURRENT_TIME);
+ MEM_write_1_byte(MEMADD_BATTERY_ENERGY_TIME, KART_CST.BATTERY_ENERGY_TIME);
+ MEM_write_1_byte(MEMADD_BATTERY_ALIVE_TIME, KART_CST.BATTERY_ALIVE_TIME);
+ // TODO set alive time
+ // TODO send params
}
@@ -112,11 +152,11 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
// - - - -
ALIVE_ISALIVE(ALjoy());
if(ALjoy()->state == STAL_DEAD){
- CAR_CST.JOYSTICK_MODE = MEM_read_1_byte(MEMADD_JOYSTICK_MODE);
- CAR_CST.JOYSTICK_PARAM1 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM1);
- CAR_CST.JOYSTICK_PARAM2 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM2);
- CAR_CST.JOYSTICK_ALIVE_TIME = MEM_read_1_byte(MEMADD_JOYSTICK_ALIVE_TIME);
- ALIVE_setAliveTime(ALjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
+ KART_CST.JOYSTICK_MODE = MEM_read_1_byte(MEMADD_JOYSTICK_MODE);
+ KART_CST.JOYSTICK_PARAM1 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM1);
+ KART_CST.JOYSTICK_PARAM2 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM2);
+ KART_CST.JOYSTICK_ALIVE_TIME = MEM_read_1_byte(MEMADD_JOYSTICK_ALIVE_TIME);
+ ALIVE_setAliveTime(ALjoy(), KART_CST.JOYSTICK_ALIVE_TIME);
ALIVE_emitBorn(ALjoy(), 0, 0);
ALIVE_emitReady(ALjoy(), 100, 0);
}
@@ -130,6 +170,7 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
case 3:
if(idMsg == 0xF) { // DISPLAY_ALIVE
// powerMode - - -
+ // TODO display say ALIVE
}
break;
@@ -146,6 +187,7 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
if(idMsg == 0xF) { // DRIVE_ALIVE
// statusH statusL - -
+ // TODO drive say ALIVE
}
break;
@@ -167,6 +209,7 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
if(idMsg == 0xF) { // STEERING_ALIVE
// statusH statusL - -
+ // TODO steering say ALIVE with his status
}
break;
@@ -178,6 +221,7 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
case 6:
if(idMsg == 0xF) { // BATTERY_ALIVE
// - - - -
+ // TODO battery say ALIVE
}
break;
@@ -192,46 +236,113 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
}
void CM_CONTROLLER_ALIVE(void* p) {
+ // - - - -
CAN_Send(0x0, 0xF, 0);
}
void CM_JOY_SETUP(void* p) {
+ // mode parm1 param2 aliveTime
BYTES_4 joy;
- joy.separate.byte0 = CAR_CST.JOYSTICK_MODE;
- joy.separate.byte1 = CAR_CST.JOYSTICK_PARAM1;
- joy.separate.byte2 = CAR_CST.JOYSTICK_PARAM2;
- joy.separate.byte3 = CAR_CST.JOYSTICK_ALIVE_TIME;
- CAN_Send(2, 0, joy.full.bytes);
-
+ joy.separate.byte0 = KART_CST.JOYSTICK_MODE;
+ joy.separate.byte1 = KART_CST.JOYSTICK_PARAM1;
+ joy.separate.byte2 = KART_CST.JOYSTICK_PARAM2;
+ joy.separate.byte3 = KART_CST.JOYSTICK_ALIVE_TIME;
+ CAN_Send(2, 0, joy.full);
}
void CM_DISPLAY_SETUP(void* p) {
-
+ // reset - - aliveTime
+ BYTES_4 display;
+ display.separate.byte0 = 0; // reset
+ display.separate.byte3 = KART_CST.DISPLAY_ALIVE_TIME;
+ CAN_Send(3, 0, display.full);
}
void CM_DISPLAY_SPEED(void* p) {
-
+ // valH valL - -
+ BYTES_4 tmpData;
+ // byte0 should be valH but isn't possible to go enough fast for use it
+ tmpData.separate.byte0 = 0;
+ tmpData.separate.byte1 = *((uint8_t*) p);
+ tmpData.separate.byte2 = 0;
+ tmpData.separate.byte3 = 0;
+ CAN_Send(3, 2, tmpData.full);
}
void CM_DISPLAY_DIRECTION(void* p) {
-
+ // direction - - -
+ BYTES_4 tmpData;
+ tmpData.separate.byte0 = (uint8_t) p;
+ tmpData.separate.byte1 = 0;
+ tmpData.separate.byte2 = 0;
+ tmpData.separate.byte3 = 0;
+ CAN_Send(3, 3, tmpData.full);
}
void CM_DRIVE_SETUP(void* p) {
+ // reset/init speedTime stopTime aliveTime
+ BYTES_4 tmpData;
+ tmpData.separate.byte0 = (uint8_t) p;
+ tmpData.separate.byte1 = KART_CST.DRIVE_SPEED_TIME;
+ tmpData.separate.byte2 = KART_CST.DRIVE_STOP_TIME;
+ tmpData.separate.byte3 = KART_CST.DRIVE_ALIVE_TIME;
+ CAN_Send(4, 0, tmpData.full);
}
void CM_DRIVE_POWER(void* p) {
-
+ // valH valL - -
+ // TODO
}
void CM_STEERING_SETUP(void* p) {
-
+ // reset/init homing setCenter aliveTime
+ // TODO not working have to fix it
+ BYTES_4 tmpData;
+ uint8_t choice = (uint8_t) p;
+ switch (choice) {
+ case 1:
+ tmpData.separate.byte0 = 1;
+ tmpData.separate.byte1 = 0;
+ tmpData.separate.byte2 = 0;
+ break;
+ case 2:
+ tmpData.separate.byte0 = 0;
+ tmpData.separate.byte1 = 1;
+ tmpData.separate.byte2 = 0;
+ break;
+ case 3:
+ tmpData.separate.byte0 = 0;
+ tmpData.separate.byte1 = 0;
+ tmpData.separate.byte2 = 1;
+ break;
+ default:
+ tmpData.separate.byte0 = 0;
+ tmpData.separate.byte1 = 0;
+ tmpData.separate.byte2 = 0;
+ break;
+ }
+ tmpData.separate.byte3 = KART_CST.STEERING_ALIVE_TIME; // 0 -> no alive
+ CAN_Send(5, 0, tmpData.full);
}
void CM_STEERING_SET(void* p) {
-
+ // valHH valH valL valLL
+ BYTES_4 pPosition;
+ pPosition.full = *((uint32_t*) p);
+ BYTES_4 sPosition;
+ sPosition.separate.byte0 = pPosition.separate.byte3;
+ sPosition.separate.byte1 = pPosition.separate.byte2;
+ sPosition.separate.byte2 = pPosition.separate.byte1;
+ sPosition.separate.byte3 = pPosition.separate.byte0;
+ CAN_Send(5, 1, sPosition.full);
}
-void CM_SETUP_CONTROL(void* p) {
-
+void CM_SUPPLY_SETUP(void* p) {
+ // batteryVoltTime batteryCurrentTime batteryEnergyTime aliveTime
+ BYTES_4 supply;
+ supply.separate.byte0 = KART_CST.BATTERY_VOLT_TIME;
+ supply.separate.byte1 = KART_CST.BATTERY_CURRENT_TIME;
+ supply.separate.byte2 = KART_CST.BATTERY_ENERGY_TIME;
+ supply.separate.byte3 = KART_CST.BATTERY_ALIVE_TIME;
+ CAN_Send(6, 0, supply.full);
}
diff --git a/306-controller_interface.X/app/can_message.h b/306-controller_interface.X/app/can_message.h
index 5e39140..64bab11 100644
--- a/306-controller_interface.X/app/can_message.h
+++ b/306-controller_interface.X/app/can_message.h
@@ -26,17 +26,76 @@ S R M
1 6 0 SETUP_CONTROL batteryVoltTime batteryCurrentTime batteryEnergyTime aliveTime
*/
+/**
+ * Process an incoming message
+ * @param idSender id of the sender
+ * @param idMsg is of the message
+ * @param data data of the message
+ */
void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data);
+
+/**
+ * Send alive message from controller
+ * @param p have to be NULL
+ */
void CM_CONTROLLER_ALIVE(void* p);
+
+/**
+ * Send setup to the joystick (settings from memory)
+ * @param p have to be NULL
+ */
void CM_JOY_SETUP(void* p);
+
+/**
+ * Send setup to the display (settings from memory)
+ * @param p have to be NULL
+ */
void CM_DISPLAY_SETUP(void* p);
+
+/**
+ * Send speed to display
+ * @param p the speed in 100m/h (max 255 m/h)
+ */
void CM_DISPLAY_SPEED(void* p);
+
+/**
+ * Send direction of the steering wheel
+ * 0 is straight forward
+ * positive value is going right
+ * negative value is going left
+ * @param p the direction (int 8)
+ */
void CM_DISPLAY_DIRECTION(void* p);
+
+/**
+ * Send setup to the drive
+ * use with reset in parameter
+ * other settings from memory
+ * @param p 1 if reset/init 0 else
+ */
void CM_DRIVE_SETUP(void* p);
+
void CM_DRIVE_POWER(void* p);
+
+/**
+ * Send setup to the steering
+ * can be use for reset (1), homing (2) and setCenter (3)
+ * @param p 0 for setup, 1 for reset, 2 for homing, 3 for setCenter
+ */
void CM_STEERING_SETUP(void* p);
+
+/**
+ * Send position for steering
+ * no negative value because 0 is home (sensor)
+ * @param p the position (uint32_t*)
+ */
void CM_STEERING_SET(void* p);
-void CM_SETUP_CONTROL(void* p);
+
+/**
+ * Send setup to the supply (settings from memory)
+ * @param p have to be NULL
+ */
+void CM_SUPPLY_SETUP(void* p);
#endif /* CAN_MESSAGE_H */
diff --git a/306-controller_interface.X/app/car.h b/306-controller_interface.X/app/car.h
index d1ba7a7..5551386 100644
--- a/306-controller_interface.X/app/car.h
+++ b/306-controller_interface.X/app/car.h
@@ -65,8 +65,15 @@ typedef struct {
uint8_t BATTERY_CURRENT_TIME;
uint8_t BATTERY_ENERGY_TIME;
uint8_t BATTERY_ALIVE_TIME;
-} CAR_CST_TYPE;
-CAR_CST_TYPE CAR_CST;
+} KART_CST_TYPE;
+KART_CST_TYPE KART_CST;
+
+typedef struct {
+ int32_t speed;
+ uint32_t center;
+ uint32_t position;
+} KART_VAR_TYPE;
+KART_VAR_TYPE eKart;
#endif /* CAR_H */
diff --git a/306-controller_interface.X/app/factory/factory.c b/306-controller_interface.X/app/factory/factory.c
index fe819c8..2964f29 100644
--- a/306-controller_interface.X/app/factory/factory.c
+++ b/306-controller_interface.X/app/factory/factory.c
@@ -63,12 +63,10 @@ void Factory_init() {
CAN_setSender(1);
LED_off(l1());
- // TODO init EPROM interface
MEM_init();
- // TODO init watchdog with EPROM CST
ALIVE_init(ALcontroller());
- ALIVE_setAliveTime(ALcontroller(), CAR_CST.CONTROL_ALIVE_TIME);
+ ALIVE_setAliveTime(ALcontroller(), KART_CST.CONTROL_ALIVE_TIME);
ALIVE_init(ALjoy());
}
@@ -81,7 +79,7 @@ void Factory_build() {
ALIVE_onAlive(ALcontroller(), CM_CONTROLLER_ALIVE, NULL);
ALIVE_onSetup(ALjoy(), CM_JOY_SETUP, NULL);
- ALIVE_setAliveTime(ALjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
+ ALIVE_setAliveTime(ALjoy(), KART_CST.JOYSTICK_ALIVE_TIME);
ALIVE_onBorn(ALjoy(), LED_on, l1());
ALIVE_onDead(ALjoy(), LED_off, l1());
diff --git a/306-controller_interface.X/mcc_generated_files/memory.c b/306-controller_interface.X/mcc_generated_files/memory.c
index b53aa2c..a2ebbd8 100644
--- a/306-controller_interface.X/mcc_generated_files/memory.c
+++ b/306-controller_interface.X/mcc_generated_files/memory.c
@@ -198,7 +198,6 @@ uint8_t DATAEE_ReadByte(uint16_t bAdd)
void MEMORY_Tasks( void )
{
- /* TODO : Add interrupt handling code */
PIR0bits.NVMIF = 0;
}
/**
diff --git a/306-controller_interface.X/middleware/eeprom.c b/306-controller_interface.X/middleware/eeprom.c
index e3041d6..6be123a 100644
--- a/306-controller_interface.X/middleware/eeprom.c
+++ b/306-controller_interface.X/middleware/eeprom.c
@@ -22,85 +22,85 @@ typedef union {
void MEM_init(){
uint8_t check = MEM_read_1_byte(0x0);
if(check != 0x42){
- CAR_CST.CONTROL_STEERING_MODE = 0;
- CAR_CST.CONTROL_ALIVE_TIME = 50;
- CAR_CST.CONTROL_SPEED_FACTOR = 0;
- CAR_CST.CONTROL_POWER_FACTOR = 0;
- CAR_CST.CONTROL_STEERING_FACTOR = 0;
- CAR_CST.CONTROL_MAX_SPEED_FW = 0;
- CAR_CST.CONTROL_MAX_SPEED_BW = 0;
+ KART_CST.CONTROL_STEERING_MODE = 0;
+ KART_CST.CONTROL_ALIVE_TIME = 50;
+ KART_CST.CONTROL_SPEED_FACTOR = 0;
+ KART_CST.CONTROL_POWER_FACTOR = 0;
+ KART_CST.CONTROL_STEERING_FACTOR = 0;
+ KART_CST.CONTROL_MAX_SPEED_FW = 0;
+ KART_CST.CONTROL_MAX_SPEED_BW = 0;
- CAR_CST.JOYSTICK_MODE = 0;
- CAR_CST.JOYSTICK_PARAM1 = 10;
- CAR_CST.JOYSTICK_PARAM2 = 1;
- CAR_CST.JOYSTICK_ALIVE_TIME = 10;
+ KART_CST.JOYSTICK_MODE = 0;
+ KART_CST.JOYSTICK_PARAM1 = 5;
+ KART_CST.JOYSTICK_PARAM2 = 1;
+ KART_CST.JOYSTICK_ALIVE_TIME = 25;
- CAR_CST.DISPLAY_ALIVE_TIME = 50;
+ KART_CST.DISPLAY_ALIVE_TIME = 100;
- CAR_CST.DRIVE_SPEED_TIME = 0;
- CAR_CST.DRIVE_STOP_TIME = 0;
- CAR_CST.DRIVE_ALIVE_TIME = 10;
+ KART_CST.DRIVE_SPEED_TIME = 0;
+ KART_CST.DRIVE_STOP_TIME = 0;
+ KART_CST.DRIVE_ALIVE_TIME = 10;
- CAR_CST.STEERING_ALIVE_TIME = 100;
+ KART_CST.STEERING_ALIVE_TIME = 100;
- CAR_CST.BATTERY_VOLT_TIME = 50;
- CAR_CST.BATTERY_CURRENT_TIME = 50;
- CAR_CST.BATTERY_ENERGY_TIME = 50;
- CAR_CST.BATTERY_ALIVE_TIME = 50;
+ KART_CST.BATTERY_VOLT_TIME = 50;
+ KART_CST.BATTERY_CURRENT_TIME = 50;
+ KART_CST.BATTERY_ENERGY_TIME = 50;
+ KART_CST.BATTERY_ALIVE_TIME = 50;
- MEM_write_1_byte(MEMADD_CONTROL_STEERING_MODE, CAR_CST.CONTROL_STEERING_MODE);
- MEM_write_1_byte(MEMADD_CONTROL_ALIVE_TIME, CAR_CST.CONTROL_ALIVE_TIME);
- MEM_write_4_byte(MEMADD_CONTROL_SPEED_FACTOR, CAR_CST.CONTROL_SPEED_FACTOR);
- MEM_write_4_byte(MEMADD_CONTROL_POWER_FACTOR, CAR_CST.CONTROL_POWER_FACTOR);
- MEM_write_4_byte(MEMADD_CONTROL_STEERING_FACTOR, CAR_CST.CONTROL_STEERING_FACTOR);
- MEM_write_1_byte(MEMADD_CONTROL_MAX_SPEED_FW, CAR_CST.CONTROL_MAX_SPEED_FW);
- MEM_write_1_byte(MEMADD_CONTROL_MAX_SPEED_BW, CAR_CST.CONTROL_MAX_SPEED_BW);
+ MEM_write_1_byte(MEMADD_CONTROL_STEERING_MODE, KART_CST.CONTROL_STEERING_MODE);
+ MEM_write_1_byte(MEMADD_CONTROL_ALIVE_TIME, KART_CST.CONTROL_ALIVE_TIME);
+ MEM_write_4_byte(MEMADD_CONTROL_SPEED_FACTOR, KART_CST.CONTROL_SPEED_FACTOR);
+ MEM_write_4_byte(MEMADD_CONTROL_POWER_FACTOR, KART_CST.CONTROL_POWER_FACTOR);
+ MEM_write_4_byte(MEMADD_CONTROL_STEERING_FACTOR, KART_CST.CONTROL_STEERING_FACTOR);
+ MEM_write_1_byte(MEMADD_CONTROL_MAX_SPEED_FW, KART_CST.CONTROL_MAX_SPEED_FW);
+ MEM_write_1_byte(MEMADD_CONTROL_MAX_SPEED_BW, KART_CST.CONTROL_MAX_SPEED_BW);
- MEM_write_1_byte(MEMADD_JOYSTICK_MODE, CAR_CST.JOYSTICK_MODE);
- MEM_write_1_byte(MEMADD_JOYSTICK_PARAM1, CAR_CST.JOYSTICK_PARAM1);
- MEM_write_1_byte(MEMADD_JOYSTICK_PARAM2, CAR_CST.JOYSTICK_PARAM2);
- MEM_write_1_byte(MEMADD_JOYSTICK_ALIVE_TIME, CAR_CST.JOYSTICK_ALIVE_TIME);
+ MEM_write_1_byte(MEMADD_JOYSTICK_MODE, KART_CST.JOYSTICK_MODE);
+ MEM_write_1_byte(MEMADD_JOYSTICK_PARAM1, KART_CST.JOYSTICK_PARAM1);
+ MEM_write_1_byte(MEMADD_JOYSTICK_PARAM2, KART_CST.JOYSTICK_PARAM2);
+ MEM_write_1_byte(MEMADD_JOYSTICK_ALIVE_TIME, KART_CST.JOYSTICK_ALIVE_TIME);
- MEM_write_1_byte(MEMADD_DISPLAY_ALIVE_TIME, CAR_CST.DISPLAY_ALIVE_TIME);
+ MEM_write_1_byte(MEMADD_DISPLAY_ALIVE_TIME, KART_CST.DISPLAY_ALIVE_TIME);
- MEM_write_1_byte(MEMADD_DRIVE_SPEED_TIME, CAR_CST.DRIVE_SPEED_TIME);
- MEM_write_1_byte(MEMADD_DRIVE_STOP_TIME, CAR_CST.DRIVE_STOP_TIME);
- MEM_write_1_byte(MEMADD_DRIVE_ALIVE_TIME, CAR_CST.DRIVE_ALIVE_TIME);
+ MEM_write_1_byte(MEMADD_DRIVE_SPEED_TIME, KART_CST.DRIVE_SPEED_TIME);
+ MEM_write_1_byte(MEMADD_DRIVE_STOP_TIME, KART_CST.DRIVE_STOP_TIME);
+ MEM_write_1_byte(MEMADD_DRIVE_ALIVE_TIME, KART_CST.DRIVE_ALIVE_TIME);
- MEM_write_1_byte(MEMADD_STEERING_ALIVE_TIME, CAR_CST.STEERING_ALIVE_TIME);
+ MEM_write_1_byte(MEMADD_STEERING_ALIVE_TIME, KART_CST.STEERING_ALIVE_TIME);
- MEM_write_1_byte(MEMADD_BATTERY_VOLT_TIME, CAR_CST.BATTERY_VOLT_TIME);
- MEM_write_1_byte(MEMADD_BATTERY_CURRENT_TIME, CAR_CST.BATTERY_CURRENT_TIME);
- MEM_write_1_byte(MEMADD_BATTERY_ENERGY_TIME, CAR_CST.BATTERY_ENERGY_TIME);
- MEM_write_1_byte(MEMADD_BATTERY_ALIVE_TIME, CAR_CST.BATTERY_ALIVE_TIME);
+ MEM_write_1_byte(MEMADD_BATTERY_VOLT_TIME, KART_CST.BATTERY_VOLT_TIME);
+ MEM_write_1_byte(MEMADD_BATTERY_CURRENT_TIME, KART_CST.BATTERY_CURRENT_TIME);
+ MEM_write_1_byte(MEMADD_BATTERY_ENERGY_TIME, KART_CST.BATTERY_ENERGY_TIME);
+ MEM_write_1_byte(MEMADD_BATTERY_ALIVE_TIME, KART_CST.BATTERY_ALIVE_TIME);
MEM_write_1_byte(0x0, 0x42);
} else {
- CAR_CST.CONTROL_STEERING_MODE = MEM_read_1_byte(MEMADD_CONTROL_STEERING_MODE);
- CAR_CST.CONTROL_ALIVE_TIME = MEM_read_1_byte(MEMADD_CONTROL_ALIVE_TIME);
- CAR_CST.CONTROL_SPEED_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_SPEED_FACTOR);
- CAR_CST.CONTROL_POWER_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_POWER_FACTOR);
- CAR_CST.CONTROL_STEERING_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_STEERING_FACTOR);
- CAR_CST.CONTROL_MAX_SPEED_FW = MEM_read_1_byte(MEMADD_CONTROL_MAX_SPEED_FW);
- CAR_CST.CONTROL_MAX_SPEED_BW = MEM_read_1_byte(MEMADD_CONTROL_MAX_SPEED_BW);
+ KART_CST.CONTROL_STEERING_MODE = MEM_read_1_byte(MEMADD_CONTROL_STEERING_MODE);
+ KART_CST.CONTROL_ALIVE_TIME = MEM_read_1_byte(MEMADD_CONTROL_ALIVE_TIME);
+ KART_CST.CONTROL_SPEED_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_SPEED_FACTOR);
+ KART_CST.CONTROL_POWER_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_POWER_FACTOR);
+ KART_CST.CONTROL_STEERING_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_STEERING_FACTOR);
+ KART_CST.CONTROL_MAX_SPEED_FW = MEM_read_1_byte(MEMADD_CONTROL_MAX_SPEED_FW);
+ KART_CST.CONTROL_MAX_SPEED_BW = MEM_read_1_byte(MEMADD_CONTROL_MAX_SPEED_BW);
- CAR_CST.JOYSTICK_MODE = MEM_read_1_byte(MEMADD_JOYSTICK_MODE);
- CAR_CST.JOYSTICK_PARAM1 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM1);
- CAR_CST.JOYSTICK_PARAM2 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM2);
- CAR_CST.JOYSTICK_ALIVE_TIME = MEM_read_1_byte(MEMADD_JOYSTICK_ALIVE_TIME);
+ KART_CST.JOYSTICK_MODE = MEM_read_1_byte(MEMADD_JOYSTICK_MODE);
+ KART_CST.JOYSTICK_PARAM1 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM1);
+ KART_CST.JOYSTICK_PARAM2 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM2);
+ KART_CST.JOYSTICK_ALIVE_TIME = MEM_read_1_byte(MEMADD_JOYSTICK_ALIVE_TIME);
- CAR_CST.DISPLAY_ALIVE_TIME = MEM_read_1_byte(MEMADD_DISPLAY_ALIVE_TIME);
+ KART_CST.DISPLAY_ALIVE_TIME = MEM_read_1_byte(MEMADD_DISPLAY_ALIVE_TIME);
- CAR_CST.DRIVE_SPEED_TIME = MEM_read_1_byte(MEMADD_DRIVE_SPEED_TIME);
- CAR_CST.DRIVE_STOP_TIME = MEM_read_1_byte(MEMADD_DRIVE_STOP_TIME);
- CAR_CST.DRIVE_ALIVE_TIME = MEM_read_1_byte(MEMADD_DRIVE_ALIVE_TIME);
+ KART_CST.DRIVE_SPEED_TIME = MEM_read_1_byte(MEMADD_DRIVE_SPEED_TIME);
+ KART_CST.DRIVE_STOP_TIME = MEM_read_1_byte(MEMADD_DRIVE_STOP_TIME);
+ KART_CST.DRIVE_ALIVE_TIME = MEM_read_1_byte(MEMADD_DRIVE_ALIVE_TIME);
- CAR_CST.STEERING_ALIVE_TIME = MEM_read_1_byte(MEMADD_STEERING_ALIVE_TIME);
+ KART_CST.STEERING_ALIVE_TIME = MEM_read_1_byte(MEMADD_STEERING_ALIVE_TIME);
- CAR_CST.BATTERY_VOLT_TIME = MEM_read_1_byte(MEMADD_BATTERY_VOLT_TIME);
- CAR_CST.BATTERY_CURRENT_TIME = MEM_read_1_byte(MEMADD_BATTERY_CURRENT_TIME);
- CAR_CST.BATTERY_ENERGY_TIME = MEM_read_1_byte(MEMADD_BATTERY_ENERGY_TIME);
- CAR_CST.BATTERY_ALIVE_TIME = MEM_read_1_byte(MEMADD_BATTERY_ALIVE_TIME);
+ KART_CST.BATTERY_VOLT_TIME = MEM_read_1_byte(MEMADD_BATTERY_VOLT_TIME);
+ KART_CST.BATTERY_CURRENT_TIME = MEM_read_1_byte(MEMADD_BATTERY_CURRENT_TIME);
+ KART_CST.BATTERY_ENERGY_TIME = MEM_read_1_byte(MEMADD_BATTERY_ENERGY_TIME);
+ KART_CST.BATTERY_ALIVE_TIME = MEM_read_1_byte(MEMADD_BATTERY_ALIVE_TIME);
}
}
diff --git a/busmaster_config.cfx b/busmaster_config.cfx
index 94c32ac..783a951 100644
--- a/busmaster_config.cfx
+++ b/busmaster_config.cfx
@@ -8,8 +8,8 @@
FALSE
FALSE
FALSE
- FALSE
- TRUE
+ TRUE
+ FALSE
SYSTEM
FALSE
FALSE
@@ -17,7 +17,7 @@
FALSE
SHOWNORMAL
- HIDE
+ SHOWNORMAL
655
0
874
@@ -28,6 +28,44 @@
threewheeler.DBF
+
+
+
+ Parameter
+ 1
+ 200
+ 1
+
+
+ Channel 1
+ 2
+ 90
+ 1
+
+
+
+
+ Parameter
+ 1
+ 200
+ 1
+
+
+ Channel 1
+ 2
+ 90
+ 1
+
+
+
+ SHOWNORMAL
+ RESTORETOMAXIMIZED
+ 388
+ 612
+ 1002
+ 1034
+
+
MHS Tiny-CAN
@@ -85,27 +123,305 @@
+
+
+ notAlive
+ STOP
+
+ 271
+ 271
+ Rx
+ STD
+ NONRTR
+ 0
+
+
+ 799
+ 799
+ ALL
+ STD
+ ALL
+ 0
+
+
+ 543
+ 543
+ ALL
+ STD
+ ALL
+ 0
+
+
+ 1055
+ 1055
+ ALL
+ STD
+ ALL
+ 0
+
+
+ 1311
+ 1311
+ ALL
+ STD
+ ALL
+ 0
+
+
+
+ display
+ PASS
+
+ 306
+ 306
+ ALL
+ STD
+ ALL
+ 0
+
+
+ 307
+ 307
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 799
+ 799
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 1585
+ 1585
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 1586
+ 1586
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 1587
+ 1587
+ ALL
+ ALL
+ ALL
+ 0
+
+
+
+ drive
+ PASS
+
+ 320
+ 320
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 321
+ 321
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 1055
+ 1055
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 1040
+ 1040
+ ALL
+ ALL
+ ALL
+ 0
+
+
+
+ steering
+ PASS
+
+ 336
+ 336
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 337
+ 337
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 1298
+ 1298
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 1311
+ 1311
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 82
+ 82
+ ALL
+ ALL
+ ALL
+ 0
+
+
+
+ joy
+ PASS
+
+ 288
+ 288
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 529
+ 529
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 543
+ 543
+ ALL
+ ALL
+ ALL
+ 0
+
+
+
+ controller
+ PASS
+
+ 16
+ 16
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 271
+ 271
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 17
+ 17
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 18
+ 18
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 19
+ 19
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 20
+ 20
+ ALL
+ ALL
+ ALL
+ 0
+
+
+ 22
+ 22
+ ALL
+ ALL
+ ALL
+ 0
+
+
+
- 288
- DeltaY
- aliveTime
- timeMeasureOrDeltaX
- mode
+ 337
+ SteeringPosition
+
+
+ 336
+ SET_CENTER
+ HOMING
+ RESET
+ ALIVE_TIME
+
+
+ 82
+ CENTER_POS
+
+
+ 1298
+ POSITION
SHOWNORMAL
HIDE
- 622
- 86
- 816
- 998
+ 157
+ 596
+ 1086
+ 387
- 142
- 174
- 285
- 142
+ 94
+ 178
+ 189
+ 94
@@ -192,12 +508,12 @@
- HIDE
+ SHOWNORMAL
RESTORETOMAXIMIZED
0
0
- 0
- 0
+ 577
+ 423
@@ -212,9 +528,11 @@
- 5000
- 2000
- 100
+ 2025155376
+ 24800128
+ 2025155348
+ notAlive
+ steering
1
@@ -223,27 +541,27 @@
Time
- 2
+ 5
1
- 138
+ 129
Tx/Rx
- 3
+ 4
1
- 85
+ 53
Channel
- 4
- 1
- 92
+ 2
+ 0
+ 0
Msg Type
- 5
- 1
- 71
+ 3
+ 0
+ 0
ID
@@ -255,22 +573,22 @@
Message
7
1
- 174
+ 143
DLC
8
1
- 75
+ 38
Data Byte(s)
9
1
- 198
+ 158
1
- 0
+ 1
0
SYSTEM
@@ -278,16 +596,16 @@
RESTORETOMAXIMIZED
0
0
- 295
- 909
+ 810
+ 606
SHOWNORMAL
RESTORETOMAXIMIZED
- 271
- 879
- 958
- 1552
+ 173
+ 10
+ 451
+ 359
@@ -378,15 +696,15 @@
RESTORETOMAXIMIZED
0
0
- 543
+ 549
1614
SHOWNORMAL
RESTORETOMAXIMIZED
- 179
+ 173
10
- 457
+ 451
359
@@ -463,15 +781,15 @@
RESTORETOMAXIMIZED
0
0
- 543
+ 549
1614
SHOWNORMAL
RESTORETOMAXIMIZED
- 179
+ 173
10
- 457
+ 451
359
@@ -479,19 +797,19 @@
SHOWNORMAL
SETMINPOSITION
- 12
- 989
- 667
- 1849
+ 3
+ 1055
+ 658
+ 1915
1
- 528
+ 22
FALSE
FALSE
4
- 0,0,0,0
+ 0,5,1,25
10
FALSE
a
@@ -499,11 +817,11 @@
1
- 529
+ 16
FALSE
FALSE
4
- 0,0,0,0
+ 0,0,0,50
10
FALSE
a
@@ -511,11 +829,11 @@
1
- 288
+ 306
FALSE
FALSE
- 4
- 0,255,1,5
+ 2
+ 0,100
10
FALSE
a
@@ -523,11 +841,35 @@
1
- 543
+ 336
FALSE
FALSE
- 1
- 0
+ 4
+ 1,0,0,0
+ 10
+ FALSE
+ a
+ FALSE
+
+
+ 1
+ 336
+ FALSE
+ FALSE
+ 4
+ 0,1,0,0
+ 10
+ FALSE
+ a
+ FALSE
+
+
+ 1
+ 337
+ FALSE
+ FALSE
+ 4
+ 0,1,134,160
10
FALSE
a