Compare commits
No commits in common. "aa3a2106aa220cdf7149a73dced325574b087243" and "b37c0a05be464f24b564d4fb36ea96d037858265" have entirely different histories.
aa3a2106aa
...
b37c0a05be
@ -1,6 +1,3 @@
|
|||||||
Import("env") # pylint: disable=undefined-variable
|
|
||||||
env.Execute("\"$PYTHONEXE\" -m pip install jinja2")
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
@ -58,13 +58,11 @@ const size_t GPSBaudRateString_Elements = sizeof(GPSBaudRateString) / sizeof(GPS
|
|||||||
#ifdef FEATURE_ENABLE_CAN
|
#ifdef FEATURE_ENABLE_CAN
|
||||||
typedef enum CANSource_e
|
typedef enum CANSource_e
|
||||||
{
|
{
|
||||||
KTM_890_ADV_R_2021,
|
KTM_890_ADV_R_2021
|
||||||
KTM_1290_SD_R_2023
|
|
||||||
} CANSource_t;
|
} CANSource_t;
|
||||||
|
|
||||||
const char CANSourceString[][30] = {
|
const char CANSourceString[][28] = {
|
||||||
"KTM 890 Adventure R (2021)",
|
"KTM 890 Adventure R (2021)"};
|
||||||
"KTM 1290 Superduke R (2023)"};
|
|
||||||
|
|
||||||
const size_t CANSourceString_Elements = sizeof(CANSourceString) / sizeof(CANSourceString[0]);
|
const size_t CANSourceString_Elements = sizeof(CANSourceString) / sizeof(CANSourceString[0]);
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,18 +14,7 @@ void Init_CAN()
|
|||||||
|
|
||||||
CAN0.init_Mask(0, 0, 0x07FF0000); // Init first mask...
|
CAN0.init_Mask(0, 0, 0x07FF0000); // Init first mask...
|
||||||
CAN0.init_Mask(1, 0, 0x07FF0000); // Init second mask...
|
CAN0.init_Mask(1, 0, 0x07FF0000); // Init second mask...
|
||||||
|
CAN0.init_Filt(0, 0, 0x012D0000); // Init first filter...
|
||||||
switch (LubeConfig.CANSource)
|
|
||||||
{
|
|
||||||
case KTM_890_ADV_R_2021:
|
|
||||||
CAN0.init_Filt(0, 0, 0x012D0000); // Init first filter...
|
|
||||||
break;
|
|
||||||
case KTM_1290_SD_R_2023:
|
|
||||||
CAN0.init_Filt(0, 0, 0x012D0000); // Init first filter...
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
CAN0.setMode(MCP_NORMAL);
|
CAN0.setMode(MCP_NORMAL);
|
||||||
}
|
}
|
||||||
@ -44,33 +33,19 @@ void CAN_Process()
|
|||||||
uint32_t Process_CAN_WheelSpeed()
|
uint32_t Process_CAN_WheelSpeed()
|
||||||
{
|
{
|
||||||
#define FACTOR_RWP_KMH_890ADV 18 // Divider to convert Raw Data to km/h
|
#define FACTOR_RWP_KMH_890ADV 18 // Divider to convert Raw Data to km/h
|
||||||
#define FACTOR_RWP_KMH_1290SD 18 // Divider to convert Raw Data to km/h
|
|
||||||
can_frame canMsg;
|
can_frame canMsg;
|
||||||
static uint32_t lastRecTimestamp = 0;
|
static uint32_t lastRecTimestamp = 0;
|
||||||
uint16_t RearWheelSpeed_raw;
|
uint16_t RearWheelSpeed_raw;
|
||||||
uint32_t milimeters_to_add = 0;
|
uint32_t milimeters_to_add = 0;
|
||||||
uint32_t RWP_millimeter_per_second = 0;
|
|
||||||
|
|
||||||
if (CAN0.readMsgBuf(&canMsg.can_id, &canMsg.can_dlc, canMsg.data) == CAN_OK)
|
if (CAN0.readMsgBuf(&canMsg.can_id, &canMsg.can_dlc, canMsg.data) == CAN_OK)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (LubeConfig.CANSource)
|
RearWheelSpeed_raw = (uint16_t)canMsg.data[5] << 8 | canMsg.data[6];
|
||||||
{
|
// raw / FACTOR_RWP_KMH_890ADV -> km/h * 100000 -> cm/h / 3600 -> cm/s
|
||||||
case KTM_890_ADV_R_2021:
|
// raw * 500 -> cm/s
|
||||||
// raw / FACTOR_RWP_KMH_890ADV -> km/h * 100000 -> cm/h / 3600 -> cm/s
|
uint32_t RWP_millimeter_per_second = (((uint32_t)RearWheelSpeed_raw * 1000000) / FACTOR_RWP_KMH_890ADV) / 3600;
|
||||||
// raw * 500 -> cm/s
|
|
||||||
RearWheelSpeed_raw = (uint16_t)canMsg.data[5] << 8 | canMsg.data[6];
|
|
||||||
RWP_millimeter_per_second = (((uint32_t)RearWheelSpeed_raw * 1000000) / FACTOR_RWP_KMH_890ADV) / 3600;
|
|
||||||
break;
|
|
||||||
case KTM_1290_SD_R_2023:
|
|
||||||
// raw / FACTOR_RWP_KMH_1290SD -> km/h * 100000 -> cm/h / 3600 -> cm/s
|
|
||||||
// raw * 500 -> cm/s
|
|
||||||
RearWheelSpeed_raw = (uint16_t)canMsg.data[5] << 8 | canMsg.data[6];
|
|
||||||
RWP_millimeter_per_second = (((uint32_t)RearWheelSpeed_raw * 1000000) / FACTOR_RWP_KMH_1290SD) / 3600;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t timesincelast = millis() - lastRecTimestamp;
|
uint32_t timesincelast = millis() - lastRecTimestamp;
|
||||||
lastRecTimestamp = millis();
|
lastRecTimestamp = millis();
|
||||||
|
@ -82,6 +82,10 @@ void setup()
|
|||||||
Serial.print("\n\nSouko's ChainLube Mk1\n");
|
Serial.print("\n\nSouko's ChainLube Mk1\n");
|
||||||
Serial.print(globals.DeviceName);
|
Serial.print(globals.DeviceName);
|
||||||
|
|
||||||
|
InitEEPROM();
|
||||||
|
GetConfig_EEPROM();
|
||||||
|
GetPersistence_EEPROM();
|
||||||
|
Serial.print("\nEE-Init done");
|
||||||
#ifdef FEATURE_ENABLE_OLED
|
#ifdef FEATURE_ENABLE_OLED
|
||||||
u8x8.begin();
|
u8x8.begin();
|
||||||
u8x8.setFont(u8x8_font_chroma48medium8_r);
|
u8x8.setFont(u8x8_font_chroma48medium8_r);
|
||||||
@ -90,12 +94,6 @@ void setup()
|
|||||||
u8x8.refreshDisplay();
|
u8x8.refreshDisplay();
|
||||||
Serial.print("\nDisplay-Init done");
|
Serial.print("\nDisplay-Init done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
InitEEPROM();
|
|
||||||
GetConfig_EEPROM();
|
|
||||||
GetPersistence_EEPROM();
|
|
||||||
Serial.print("\nEE-Init done");
|
|
||||||
|
|
||||||
leds.begin();
|
leds.begin();
|
||||||
Serial.print("\nLED-Init done");
|
Serial.print("\nLED-Init done");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user