This commit is contained in:
Nathan Schulte 2024-09-05 16:08:33 -04:00 committed by GitHub
commit d02d852424
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 85 additions and 4 deletions

View File

@ -459,6 +459,7 @@ typedef enum __attribute__ ((__packed__)) {
CAN_BUS_GENESIS_COUPE = 10,
CAN_BUS_HONDA_K = 11,
CAN_AIM_DASH = 12,
CAN_BUS_MINI_R52 = 13,
} can_nbc_e;

View File

@ -14,6 +14,7 @@
#include "can_msg_tx.h"
#include "can_bmw.h"
#include "can_vag.h"
#include "can_mini.h"
#include "rusefi_types.h"
#include "rtc_helper.h"
@ -27,15 +28,15 @@
#define CAN_MAZDA_RX_STATUS_2 0x420
//w202 DASH
#define W202_STAT_1 0x308 /* _20ms cycle */
#define W202_STAT_1 0x308 /* _20ms cycle */
#define W202_STAT_2 0x608 /* _100ms cycle */
#define W202_ALIVE 0x210 /* _200ms cycle */
#define W202_ALIVE 0x210 /* _200ms cycle */
#define W202_STAT_3 0x310 /* _200ms cycle */
//BMW E90 DASH
#define E90_ABS_COUNTER 0x0C0
#define E90_SEATBELT_COUNTER 0x0D7
#define E90_T15 0x130
#define E90_T15 0x130
#define E90_RPM 0x175
#define E90_BRAKE_COUNTER 0x19E
#define E90_SPEED 0x1A6
@ -129,6 +130,7 @@ void canDashboardNissanVQ(CanCycle cycle);
void canDashboardGenesisCoupe(CanCycle cycle);
void canDashboardAim(CanCycle cycle);
void canDashboardHaltech(CanCycle cycle);
void canDashboardMini(CanCycle cycle);
void updateDash(CanCycle cycle) {
@ -169,6 +171,9 @@ void updateDash(CanCycle cycle) {
case CAN_AIM_DASH:
canDashboardAim(cycle);
break;
case CAN_BUS_MINI_R52:
canDashboardMini(cycle);
break;
default:
firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Nothing for canNbcType %s", getCan_nbc_e(engineConfiguration->canNbcType));
break;
@ -1316,4 +1321,44 @@ void canDashboardAim(CanCycle cycle) {
// transmitStruct<Aim5fd>(0x5fd, false);
}
void canDashboardMini(CanCycle cycle) {
if (cycle.isInterval(CI::_50ms)) {
int rpm = Sensor::getOrZero(SensorType::Rpm);
{ // block scope to invoke CanTxMessage deconstructor (send)
CanTxMessage msg1(CAN_MINI_DME1_ID, 8);
uint16_t scaledRpm = rpm * 6.4f;
msg1[3] = scaledRpm >> 8;
msg1[4] = scaledRpm && 0xff;
}
{ // block scope to invoke CanTxMessage deconstructor (send)
CanTxMessage msg2(CAN_MINI_IC_4_ID, 8);
// 25% LCD brightness
msg2[1] = 0x3f;
// enable LCD backlight, needle, lights (byte 2, bit 4)
msg2.setBit(2, 1);
// enable orange 6k LED bar
msg2.setBit(4, 4);
if (rpm >= 5500) {
// enable red "5.5-6k" LED bars
msg2.setBit(4, 2);
if (rpm >= 6000) {
// enable red "6k" LED
msg2.setBit(4, 3);
// enable red "6-7k" LED bars
msg2.setBit(4, 5);
}
if (rpm >= 7000) {
// enable red "7-8k" LED bars
msg2.setBit(4, 6);
}
}
}
}
}
#endif // EFI_CAN_SUPPORT

View File

@ -0,0 +1,35 @@
/**
* BMC Mini R52 (e.g.) CAN dash implementation.
*
* @date 2024-05-16
* @author Nathan Schulte, (c) 2024
*/
#pragma once
// CAN frame IDs; BMW terms
//#define CAN_MINI_ASC1_ID 0x153
#define CAN_MINI_DME1_ID 0x316
//#define CAN_MINI_DME2_ID 0x329
// DME4: CEL, cruise light, EML, fuel consumption, oil temp+overheat
//#define CAN_MINI_DME4_ID 0x545
// Instrument Cluster,_1: A/C status
//#define CAN_MINI_IC_1_ID 0x615
// Instrument Cluster, 2: odometer, fuel level, clock (since battery)
//#define CAN_MINI_IC_2_ID 0x613
// Instrument Cluster, 3: trip, temp, speed, consumption, range
#define CAN_MINI_IC_3_ID 0x61a
// Instrument Cluster, 4: lights: RPM, high beams, cruise, service engine soon, brake, ABS, turn signals
#define CAN_MINI_IC_4_ID 0x61f
// R52 tach has sent back frames like:
// can0 630 [8] 02 00 00 00 00 00 00 00
// can0 630 [8] 02 50 00 00 00 00 00 00
// can0 630 [8] 02 54 00 00 00 00 00 00
// can0 630 [8] 02 70 00 00 00 00 00 00
// can0 630 [8] 02 74 00 00 00 00 00 00
// can0 630 [8] 02 7C 00 00 00 00 00 00
// 0x316 -- needs at least every 500ms
// 0x61a -- needs at least every 1000ms?
// 0x61f -- needs at least every 1000ms?

View File

@ -388,7 +388,7 @@ uint16_t engineSnifferRpmThreshold;Engine sniffer would be disabled above this r
custom ignition_mode_e 1 bits, U08, @OFFSET@, [0:1], "Single Coil", "Individual Coils", "Wasted Spark", "Two Distributors"
ignition_mode_e ignitionMode;Single coil = distributor\nIndividual coils = one coil per cylinder (COP, coil-near-plug), requires sequential mode\nWasted spark = Fires pairs of cylinders together, either one coil per pair of cylinders or one coil per cylinder\nTwo distributors = A pair of distributors, found on some BMW, Toyota and other engines
custom can_nbc_e 1 bits, U08, @OFFSET@, [0:4], "None", "FIAT", "VAG", "MAZDA RX8", "BMW", "W202", "BMW E90", "Haltech", "VAG MQB", "Nissan VQ35", "Genesis Coupe", "Honda K", "AiM", "type 13", "type 14"
custom can_nbc_e 1 bits, U08, @OFFSET@, [0:4], "None", "FIAT", "VAG", "MAZDA RX8", "BMW", "W202", "BMW E90", "Haltech", "VAG MQB", "Nissan VQ35", "Genesis Coupe", "Honda K", "AiM", "MINI R52", "type 14"
can_nbc_e canNbcType
struct injector_s