Mini Milestone: Driver loads and connects.

This commit is contained in:
2025-12-18 16:26:51 +01:00
parent b5ed3ff733
commit 2acf280c55
20 changed files with 5407 additions and 59 deletions

75
bc.h
View File

@@ -50,6 +50,21 @@ namespace cbc
[[maybe_unused]] constexpr static double NORMALIZED_VOLTAGE_OFFSET = 20.8333;
[[maybe_unused]] constexpr static double NORMALIZED_VOLTAGE_FAKTOR = 0.416667;
// misc
//#define cbc::Version "CanBusControl 0.0.01 / 02.07.2022"
[[maybe_unused]] constexpr static const char* Version = "CanBusControl 0.1.00 / 08.11.2022 © 2022 chris@sourceworx.org";
[[maybe_unused]] constexpr static const char* OrgName = "source::worx";
[[maybe_unused]] constexpr static const char* DomainName = "sourceworx.org";
[[maybe_unused]] constexpr static const char* AppName = "CanBusControl";
// timer
void delay_seconds( uint32_t );
void delay_millis( uint32_t );
void delay_micros( uint32_t );
QString formatInt( int count, int len );
} // namespace cbc
// abbreviations:
@@ -301,13 +316,9 @@ public:
Reg_Battery_Rev_Bom = 0x41, // Identification Of Printed Circuit Board Bill Of Material Version. 1: All Smc6.2 And Smc#6.3r1. 8: Smc#6.3r4
Reg_Battery_Config_Taillamp_Intensity = 0x43, // Controls The Intensity Of The Tail Lamp. 0: Off. 1-100%: On
Reg_Battery_Config_Accessory_Mounted = 0x44, // -
Reg_Battery_Config_Battint_Voltage_Enable = 0x45, // Enable/Disable Vbattint
Reg_Battery_Config_Diag = 0x46, // -
Reg_Battery_Config_Force_Done = 0x47, // ++++ Setting This Register To 0x45 Will Force Soc To 100%
Battery_Config_Force_Done = 0x45,
@@ -519,21 +530,21 @@ public:
Reg_Charger_Final_Voltage_Hi = 0x12, // Set Final Charge Voltage [Unit:V, Factor:0.01]
Reg_Charger_Final_Voltage_Lo = 0x13,
Reg_Charger_Current_Hi = 0x14, // Set Charge Current [Unit:A, Factor:0.001]
Reg_Charger_Current_Lo = 0x15,
Reg_Charger_Current_Hi = 0x14, // Set Charge Current [Unit:A, Factor:0.001]
Reg_Charger_Current_Lo = 0x15,
Reg_Charger_Voltage_Calibration_Hi = 0x42, // Multiplier Applied On Charger Voltage Reading For Its Calibration
Reg_Charger_Voltage_Calibration_Lo = 0x43,
Reg_Charger_Voltage_Calibration_Hi = 0x42, // Multiplier Applied On Charger Voltage Reading For Its Calibration
Reg_Charger_Voltage_Calibration_Lo = 0x43,
Reg_Charger_Current_Calibration_Hi = 0x46, // Multiplier Applied On Charger Current Reading For Its Calibration
Reg_Charger_Current_Calibration_Lo = 0x47,
Reg_Charger_Current_Calibration_Hi = 0x46, // Multiplier Applied On Charger Current Reading For Its Calibration
Reg_Charger_Current_Calibration_Lo = 0x47,
Reg_Charger_Rev_Charger = 0x56, // -
Reg_Charger_Rev_Charger = 0x56, // -
//{%Endregion}
// {%Region Motor}
ID_Motor = 0x20,
ID_Motor = 0x20,
// ID_Motor_Response = 0x08,
Motor_Assist_Level = 0x09, // [Unit:%, Range:-100..100, Factor:1.5625] !!! Signed !!!
@@ -595,20 +606,20 @@ public:
Motor_Status_5v_Voltage_Hi = 0x74, // - [Unit:V, Factor:0.001]
Motor_Status_5v_Voltage_Lo = 0x75,
Motor_Stat_Max_Power_Voltage_Hi = 0x80, // - [Unit:V, Factor:0.001]
Motor_Stat_Max_Power_Voltage_Lo = 0x81,
Motor_Stat_Max_Power_Voltage_Hi = 0x80, // - [Unit:V, Factor:0.001]
Motor_Stat_Max_Power_Voltage_Lo = 0x81,
Motor_Stat_Max_Temperature_Hi = 0x82, // -
Motor_Stat_Max_Temperature_Lo = 0x83,
Motor_Stat_Max_Temperature_Hi = 0x82, // -
Motor_Stat_Max_Temperature_Lo = 0x83,
Motor_Stat_Odo_Hi = 0x84, // - [Unit:Km]
Motor_Stat_Odo_Lo = 0x85,
Motor_Stat_Odo_Hi = 0x84, // - [Unit:Km]
Motor_Stat_Odo_Lo = 0x85,
Motor_Stat_Chrono_Hours_Hi = 0x86, // - [Unit:H]
Motor_Stat_Chrono_Hours_Lo = 0x87,
Motor_Stat_Chrono_Hours_Hi = 0x86, // - [Unit:H]
Motor_Stat_Chrono_Hours_Lo = 0x87,
Motor_Stat_Chrono_Seconds_Hi = 0x88, // - [Unit:S]
Motor_Stat_Chrono_Seconds_Lo = 0x89,
Motor_Stat_Chrono_Seconds_Hi = 0x88, // - [Unit:S]
Motor_Stat_Chrono_Seconds_Lo = 0x89,
Motor_Preference_Region = 0x8a, // -
@@ -622,20 +633,20 @@ public:
Motor_Protect_Unlock = 0xa5, // Unlock Register, Write Unlock_Key Here Before Setting Protected Registers
Motor_Protect_Unlock_Key = 0xaa,
Motor_Protect_Lock_Key = 0x00,
Motor_Protect_Unlock_Key = 0xaa,
Motor_Protect_Lock_Key = 0x00,
Motor_Stat_Hall_Dchs_Hi = 0xb0, // -
Motor_Stat_Hall_Dchs_Lo = 0xb1,
Motor_Stat_Hall_Dchs_Hi = 0xb0, // -
Motor_Stat_Hall_Dchs_Lo = 0xb1,
Motor_Stat_Hall_Trans_Hi = 0xb2, // -
Motor_Stat_Hall_Trans_Lo = 0xb3,
Motor_Stat_Hall_Trans_Hi = 0xb2, // -
Motor_Stat_Hall_Trans_Lo = 0xb3,
Motor_Stat_Hall_Ring_Hi = 0xb4, // -
Motor_Stat_Hall_Ring_Lo = 0xb5,
Motor_Stat_Hall_Ring_Hi = 0xb4, // -
Motor_Stat_Hall_Ring_Lo = 0xb5,
Motor_Stat_Hall_Lost_Hi = 0xb6, // -
Motor_Stat_Hall_Lost_Lo = 0xb7,
Motor_Stat_Hall_Lost_Hi = 0xb6, // -
Motor_Stat_Hall_Lost_Lo = 0xb7,
Motor_Torque_Gauge_Noise_Hi = 0xc4, // - [Unit:%, Range:0..100, Factor:0.0015259]
Motor_Torque_Gauge_Noise_Lo = 0xc5,