Copy PH1 module and test build

This commit is contained in:
Carsten Schmiemann 2022-04-09 01:03:19 +02:00
parent e8b351edf7
commit 471f4f2095
7 changed files with 2543 additions and 0 deletions

View File

@ -0,0 +1,14 @@
#
# Main component makefile.
#
# This Makefile can be left empty. By default, it will take the sources in the
# src/ directory, compile them and link them into lib(subdirectory_name).a
# in the build directory. This behaviour is entirely configurable,
# please read the ESP-IDF documents if you need to do this.
#
ifdef CONFIG_OVMS_VEHICLE_RENAULTZOE
COMPONENT_ADD_INCLUDEDIRS:=src
COMPONENT_SRCDIRS:=src
COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive
endif

View File

@ -0,0 +1,446 @@
PIDS del Renault Zoe
======================
// extraidos de CanZE Fields.java
// SID_Consumption = "1fd.48" (dash kWh) instead of V*A
final String SID_EVC_TractionBatteryVoltage = "7ec.623203.24"; // unit = V
final String SID_EVC_TractionBatteryCurrent = "7ec.623204.24"; // unit = A
final String SID_RealSpeed = "5d7.0"; // unit = km/h
final String SID_DriverBrakeWheel_Torque_Request = "130.44"; //UBP braking wheel torque the driver wants
final String SID_ElecBrakeWheelsTorqueApplied = "1f8.28"; //10ms
final String SID_ElecEngineRPM = "1f8.40"; //10ms
// It would be easier use SID_Consumption = "1fd.48" (dash kWh) instead of V*A
final String SID_VirtualUsage = "800.6100.24"; ???
final String SID_EVC_Odometer = "7ec.622006.24"; // (EVC)
final String SID_RangeEstimate = "654.42"; // (EVC)
(FieldHeaterSetpoint) SID_VirtualUsage = "699.8" (0 = NaN, 4 = -10º, 5 = 40º);
val = ((value - offset) * resolution ) * 10^(-decimals)
String fieldDef = // ID (hex), startBit, endBit, resolution, offset (aplied BEFORE resolution multiplication), decimals, unit, requestID (hex string), responseID (hex string),
// options (hex, see MainActivity for definitions), optional name, optional list
""
// 2016-01-27
+ "130,44,55,-3,4094,0,Nm,,,ff\n" // DriverBrakeWheelTq_Req
+ "186,16,27,0.5,800,1,Nm,,,ff\n" // MeanEffectiveTorque
+ "186,40,49,0.125,0,1,%,,,ff\n" // Throttle
+ "18a,27,38,0.5,800,1,Nm,,,ff\n" // Coasting Torque
+ "1f8,16,27,1,4096,0,Nm,,,ff\n" // TotalPotentialResistiveWheelsTorque
+ "1f8,28,39,-1,4096,0,Nm,,,ff\n" // ElecBrakeWheelsTorqueApplied
+ "1f8,40,50,10,0,0,Rpm,,,ff\n" // ElecEngineRPM
+ "1fd,0,7,0.390625,0,1,%,,,ff\n" // 12V Battery Current?
+ "1fd,48,55,1,80,0,kW,,,ff\n" // Consumption
+ "35c,5,7,1,0,0,,,,ff\n" // Vehicle state
+ "427,40,47,0.3,0,0,kW,,,e2\n" // Available Charging Power
+ "427,49,57,0.1,0,1,kWh,,,e2\n" // Available Energy
+ "42a,30,39,0.1,400,1,°C,,,ff\n" // Evaporator Temp Measure
+ "42a,48,50,1,0,0,,,,e2\n" // ClimLoopMode
+ "42e,0,12,0.02,0,2,%,,,e3\n" // State of Charge
+ "42e,20,24,5,0,0,%,,,e2\n" // Engine Fan Speed
+ "42e,38,43,1,0,1,A,,,e3\n" // Charging Pilot Current
+ "42e,44,50,1,40,0,°C,,,e3\n" // HV Battery Temp
+ "42e,56,63,0.3,0,1,kW,,,ff\n" // Charging Power
+ "430,24,33,0.5,30,1,°C,,,e2\n" // Comp Temperature Discharge
+ "430,38,39,1,0,0,,,,e2\n" // HV Battery Cooling State
+ "430,40,49,0.1,400,1,°C,,,e2\n" // HV Battery Evaporator Temp
+ "432,36,37,1,0,0,,,,e2\n" // HV Bat Conditionning Mode
+ "534,32,40,1,40,0,°C,,,e5\n" // Temp out
+ "5d7,0,15,0.01,0,2,km/h,,,ff\n" // Speed
+ "5da,0,7,1,40,0,ºC,,,e7\n" // Water temperature
+ "638,37,39,1,0,0,,,,ff\n" // Battery 14v To Be Changed Display
+ "654,2,2,1,0,0,,,,ff\n" // Charging Plug Connected
+ "654,25,31,1,0,0,,,,ff\n" // State of Charge
+ "654,32,41,1,0,0,min,,,ff\n" // Time to Full
+ "654,42,51,1,0,0,km,,,ff\n" // Available Distance
+ "656,48,55,1,40,0,°C,,,e2\n" // External Temp
+ "658,33,39,1,0,0,%,,,ff\n" // Battery Health
+ "65b,41,43,1,0,0,,,,ff\n" // Charging Status Display
+ "673,0,0,1,0,0,,,,ff\n" // Speed pressure misadaptation
+ "673,2,4,1,0,0,,,,ff\n" // Rear right wheel state
+ "673,5,7,1,0,0,,,,ff\n" // Rear left wheel state
+ "673,8,10,1,0,0,,,,ff\n" // Front right wheel state
+ "673,11,13,1,0,0,,,,ff\n" // Front left wheel state
+ "673,16,23,13.725,0,0,mbar,,,ff\n" // Rear right wheel pressure
+ "673,24,31,13.725,0,0,mbar,,,ff\n" // Rear left wheel pressure
+ "673,32,39,13.725,0,0,mbar,,,ff\n" // Front right wheel pressure
+ "673,40,47,13.725,0,0,mbar,,,ff\n" // Front left wheel pressure
+ "699,8,15,0.5,0,0,°C,,,e2\n" // Temperature
+ "760,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "760,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "760,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "760,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "760,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "760,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "762,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "762,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "762,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "762,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "762,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "762,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "763,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "763,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "763,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "763,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "763,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "763,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "764,26,35,0.1,400,0,°C,2121,6121,e2\n" // IH_InCarTemp
+ "764,8,15,0.4,100,0,°C,2121,6121,5\n" // IH_InCarTemp
+ "764,36,43,1,0,0,%,2121,6121,e2\n" // IH_RHumidity
+ "764,16,23,1,0,0,%,2121,6121,5\n" // IH_RHumidity
+ "764,86,87,1,0,0,,2143,6143,ff\n" // IH_EcoModeRequest,0:Unavailable Value;1:Eco mode requested;2:Eco mode not requested;3:Not used
+ "764,110,117,1,40,0,%,2143,6143,ff\n" // IH_ExternalTemp
+ "764,134,142,.1,0,0,bar,2143,6143,ff\n" // IH_ACHighPressureSensor
+ "764,107,116,10,0,0,rpm,2144,6144,ff\n" // IH_ClimCompRPMStatus
+ "764,40,41,1,0,0,,2167,6167,ff\n" // IH_ExternalTemp
+ "764,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "764,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "764,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "764,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "764,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "764,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "765,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "765,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "765,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "765,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "765,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "765,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "76d,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "76d,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "76d,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "76d,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "76d,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "76d,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "76e,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "76e,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "76e,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "76e,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "76e,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "76e,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "772,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "772,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "772,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "772,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "772,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "772,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "77e,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "77e,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "77e,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "77e,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "77e,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "77e,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "77e,24,39,0.015625,0,2,ºC,223018,623018,ff\n" // DCDC converter temperature
+ "77e,24,31,0.015625,0,2,°C,22302b,62302b,ff\n" // inverter temperature
+ "793,0,0,1,0,0,,1081,5081,ff\n" // start diag
+ "793,0,0,1,0,0,,10c0,50c0,ff\n" // start diag
+ "793,0,0,1,0,0,,3e01,7e01,ff\n" // Tester present
+ "793,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "793,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "793,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "793,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "793,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "793,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "793,24,39,0.0625,32768,0,mA,225057,625057,ff\n" // DataRead.Raw leakage current - DC part measurement
+ "793,24,39,0.0625,32768,0,mA,225058,625058,ff\n" // DataRead.Raw leakage current - High Frequency 10kHz part measurement
+ "793,24,39,0.0625,32768,0,mA,225059,625059,ff\n" // DataRead.Raw leakage current - High Frequency 1st part measurement
+ "793,24,39,0.0625,32768,0,mA,22505a,62505a,ff\n" // DataRead.Raw leakage current - Low Frequency part measurement (50Hz)
+ "793,24,39,.0625,3200,0,A,222001,622001,ff\n" // Mains phase 1 current RMS value
+ "793,24,39,.0625,3200,0,A,22503A,62503A,ff\n" // Mains phase 2 current RMS
+ "793,24,39,.0625,3200,0,A,22503B,62503B,ff\n" // Mains phase 3 current RMS
+ "793,29,31,1,0,0,,225017,625017,ff\n" // Mains current type,0:Nok;1:AC mono;2:AC tri;3:DC;4:AC bi
+ "793,24,39,.5,32000,0,V,22502C,62502C,ff\n" // Raw AC mains phase 1 measured voltage
+ "793,24,39,.5,32000,0,V,22502D,62502D,ff\n" // Raw AC mains phase 2 measured voltage
+ "793,24,39,.5,32000,0,V,22502E,62502E,ff\n" // Raw AC mains phase 3 measured voltage
+ "793,24,39,.5,0,0,V,22503f,62503f,ff\n" // Mains phase 1-2 voltage RMS value
+ "793,24,39,.5,0,0,V,225041,625041,ff\n" // Mains phase 2-3 voltage RMS value
+ "793,24,39,.5,0,0,V,225042,625042,ff\n" // Mains phase 3-1 voltage RMS value
+ "793,24,39,1,20000,0,W,22504A,62504A,ff\n" // Mains active power consumed
+ "793,24,39,1,0,0,Ohm,225062,625062,ff\n" // Mains ground resistance
+ "793,24,31,1,0,0,,225063,625063,ff\n" // Supervisor state,0:Init;1:Wait;2:ClosingS2;3:InitType;4:InitLkg;5:InitChg;6:Charge;7:ZeroAmpMode;8:EndOfChg;9:OpeningS2;10:ReadyToSleep;11:EmergencyStop;12:InitChargeDF;13:OCPStop;14:WaitS2
+ "793,24,31,1,0,0,,225064,625064,ff\n" // Leakage current diagnostic stored completion status,0:init;1:HF10;3:Mains Ground Default;5:Earth Current default;9:Ground Default;17:Means Leakage DC;33:Means Leakage LF;49:Means Leakage DC+LF;65:Means Leakage HF;81:Means Leakage DC+HF;97:Means Leakage LF+HF;113:Means Leakage DC+LF+HF
+ "7b6,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "7b6,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "7b6,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "7b6,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "7b6,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "7b6,0,23,1,0,0,,19023b,59020f,ff\n" // Query DTC
+ "7bb,336,351,0.01,0,2,kW,2101,6101,e2\n" // Maximum battery input power
+ "7bb,56,71,10,0,0,°C,2103,6103,5\n" // Mean battery compartment temp
+ "7bb,192,207,0.01,0,2,%,2103,6103,e2\n" // Real State of Charge
+ "7bb,32,39,1,40,0,°C,2104,6104,e2\n" // Cell 1 Temperature
+ "7bb,56,63,1,40,0,°C,2104,6104,e2\n" // Cell 2 Temperature
+ "7bb,80,87,1,40,0,°C,2104,6104,e2\n" // Cell 3 Temperature
+ "7bb,104,111,1,40,0,°C,2104,6104,e2\n" // Cell 4 Temperature
+ "7bb,128,135,1,40,0,°C,2104,6104,e2\n" // Cell 5 Temperature
+ "7bb,152,159,1,40,0,°C,2104,6104,e2\n" // Cell 6 Temperature
+ "7bb,176,183,1,40,0,°C,2104,6104,e2\n" // Cell 7 Temperature
+ "7bb,200,207,1,40,0,°C,2104,6104,e2\n" // Cell 8 Temperature
+ "7bb,224,231,1,40,0,°C,2104,6104,e2\n" // Cell 9 Temperature
+ "7bb,248,255,1,40,0,°C,2104,6104,e2\n" // Cell 10 Temperature
+ "7bb,272,279,1,40,0,°C,2104,6104,e2\n" // Cell 11 Temperature
+ "7bb,296,303,1,40,0,°C,2104,6104,e2\n" // Cell 12 Temperature
+ "7bb,600,607,1,40,0,degC,2104,6104,ff\n" // 21_04_#76_Average_Battery_Temperature
+ "7bb,16,23,1,0,0,,2107,6107,e2\n" // Cell 1 Balancing switch
+ "7bb,24,31,1,0,0,,2107,6107,e2\n" // Cell 2 Balancing switch
+ "7bb,32,39,1,0,0,,2107,6107,e2\n" // Cell 3 Balancing switch
+ "7bb,40,47,1,0,0,,2107,6107,e2\n" // Cell 4 Balancing switch
+ "7bb,48,55,1,0,0,,2107,6107,e2\n" // Cell 5 Balancing switch
+ "7bb,56,63,1,0,0,,2107,6107,e2\n" // Cell 6 Balancing switch
+ "7bb,64,71,1,0,0,,2107,6107,e2\n" // Cell 7 Balancing switch
+ "7bb,72,79,1,0,0,,2107,6107,e2\n" // Cell 8 Balancing switch
+ "7bb,80,87,1,0,0,,2107,6107,e2\n" // Cell 9 Balancing switch
+ "7bb,88,95,1,0,0,,2107,6107,e2\n" // Cell 10 Balancing switch
+ "7bb,96,102,1,0,0,,2107,6107,e2\n" // Cell 11 Balancing switch
+ "7bb,104,111,1,0,0,,2107,6107,e2\n" // Cell 12 Balancing switch
+ "7bb,32,39,1,0,0,°C,2104,6104,105\n" // Cell 1 Balancing switch
+ "7bb,56,63,1,0,0,°C,2104,6104,105\n" // Cell 2 Balancing switch
+ "7bb,80,87,1,0,0,°C,2104,6104,105\n" // Cell 3 Balancing switch
+ "7bb,104,111,1,0,0,°C,2104,6104,105\n" // Cell 4 Balancing switch
+ "7bb,16,31,0.001,0,3,V,2141,6141,ff\n" // Cell 01 V
+ "7bb,32,47,0.001,0,3,V,2141,6141,ff\n" // Cell 02 V
+ "7bb,48,63,0.001,0,3,V,2141,6141,ff\n" // Cell 03 V
+ "7bb,64,79,0.001,0,3,V,2141,6141,ff\n" // Cell 04 V
+ "7bb,80,95,0.001,0,3,V,2141,6141,ff\n" // Cell 05 V
+ "7bb,96,111,0.001,0,3,V,2141,6141,ff\n" // Cell 06 V
+ "7bb,112,127,0.001,0,3,V,2141,6141,ff\n" // Cell 07 V
+ "7bb,128,143,0.001,0,3,V,2141,6141,ff\n" // Cell 08 V
+ "7bb,144,159,0.001,0,3,V,2141,6141,ff\n" // Cell 09 V
+ "7bb,160,175,0.001,0,3,V,2141,6141,ff\n" // Cell 10 V
+ "7bb,176,191,0.001,0,3,V,2141,6141,ff\n" // Cell 11 V
+ "7bb,192,207,0.001,0,3,V,2141,6141,ff\n" // Cell 12 V
+ "7bb,208,223,0.001,0,3,V,2141,6141,ff\n" // Cell 13 V
+ "7bb,224,239,0.001,0,3,V,2141,6141,ff\n" // Cell 14 V
+ "7bb,240,255,0.001,0,3,V,2141,6141,ff\n" // Cell 15 V
+ "7bb,256,271,0.001,0,3,V,2141,6141,ff\n" // Cell 16 V
+ "7bb,272,287,0.001,0,3,V,2141,6141,ff\n" // Cell 17 V
+ "7bb,288,303,0.001,0,3,V,2141,6141,ff\n" // Cell 18 V
+ "7bb,304,319,0.001,0,3,V,2141,6141,ff\n" // Cell 19 V
+ "7bb,320,335,0.001,0,3,V,2141,6141,ff\n" // Cell 20 V
+ "7bb,336,351,0.001,0,3,V,2141,6141,ff\n" // Cell 21 V
+ "7bb,352,367,0.001,0,3,V,2141,6141,ff\n" // Cell 22 V
+ "7bb,368,383,0.001,0,3,V,2141,6141,ff\n" // Cell 23 V
+ "7bb,384,399,0.001,0,3,V,2141,6141,ff\n" // Cell 24 V
+ "7bb,400,415,0.001,0,3,V,2141,6141,ff\n" // Cell 25 V
+ "7bb,416,431,0.001,0,3,V,2141,6141,ff\n" // Cell 26 V
+ "7bb,432,447,0.001,0,3,V,2141,6141,ff\n" // Cell 27 V
+ "7bb,448,463,0.001,0,3,V,2141,6141,ff\n" // Cell 28 V
+ "7bb,464,479,0.001,0,3,V,2141,6141,ff\n" // Cell 29 V
+ "7bb,480,495,0.001,0,3,V,2141,6141,ff\n" // Cell 30 V
+ "7bb,496,511,0.001,0,3,V,2141,6141,ff\n" // Cell 31 V
+ "7bb,512,527,0.001,0,3,V,2141,6141,ff\n" // Cell 32 V
+ "7bb,528,543,0.001,0,3,V,2141,6141,ff\n" // Cell 33 V
+ "7bb,544,559,0.001,0,3,V,2141,6141,ff\n" // Cell 34 V
+ "7bb,560,575,0.001,0,3,V,2141,6141,ff\n" // Cell 35 V
+ "7bb,576,591,0.001,0,3,V,2141,6141,ff\n" // Cell 36 V
+ "7bb,592,607,0.001,0,3,V,2141,6141,ff\n" // Cell 37 V
+ "7bb,608,623,0.001,0,3,V,2141,6141,ff\n" // Cell 38 V
+ "7bb,624,639,0.001,0,3,V,2141,6141,ff\n" // Cell 39 V
+ "7bb,640,655,0.001,0,3,V,2141,6141,ff\n" // Cell 40 V
+ "7bb,656,671,0.001,0,3,V,2141,6141,ff\n" // Cell 41 V
+ "7bb,672,687,0.001,0,3,V,2141,6141,ff\n" // Cell 42 V
+ "7bb,688,703,0.001,0,3,V,2141,6141,ff\n" // Cell 43 V
+ "7bb,704,719,0.001,0,3,V,2141,6141,ff\n" // Cell 44 V
+ "7bb,720,735,0.001,0,3,V,2141,6141,ff\n" // Cell 45 V
+ "7bb,736,751,0.001,0,3,V,2141,6141,ff\n" // Cell 46 V
+ "7bb,752,767,0.001,0,3,V,2141,6141,ff\n" // Cell 47 V
+ "7bb,768,783,0.001,0,3,V,2141,6141,ff\n" // Cell 48 V
+ "7bb,784,799,0.001,0,3,V,2141,6141,ff\n" // Cell 49 V
+ "7bb,800,815,0.001,0,3,V,2141,6141,ff\n" // Cell 50 V
+ "7bb,816,831,0.001,0,3,V,2141,6141,ff\n" // Cell 51 V
+ "7bb,832,847,0.001,0,3,V,2141,6141,ff\n" // Cell 52 V
+ "7bb,848,863,0.001,0,3,V,2141,6141,ff\n" // Cell 53 V
+ "7bb,864,879,0.001,0,3,V,2141,6141,ff\n" // Cell 54 V
+ "7bb,880,895,0.001,0,3,V,2141,6141,ff\n" // Cell 55 V
+ "7bb,896,911,0.001,0,3,V,2141,6141,ff\n" // Cell 56 V
+ "7bb,912,927,0.001,0,3,V,2141,6141,ff\n" // Cell 57 V
+ "7bb,928,943,0.001,0,3,V,2141,6141,ff\n" // Cell 58 V
+ "7bb,944,959,0.001,0,3,V,2141,6141,ff\n" // Cell 59 V
+ "7bb,960,975,0.001,0,3,V,2141,6141,ff\n" // Cell 60 V
+ "7bb,976,991,0.001,0,3,V,2141,6141,ff\n" // Cell 61 V
+ "7bb,992,1007,0.001,0,3,V,2141,6141,ff\n" // Cell 62 V
+ "7bb,16,31,0.001,0,3,V,2142,6142,ff\n" // Cell 63 V
+ "7bb,32,47,0.001,0,3,V,2142,6142,ff\n" // Cell 64 Vl
+ "7bb,48,63,0.001,0,3,V,2142,6142,ff\n" // Cell 65 V
+ "7bb,64,79,0.001,0,3,V,2142,6142,ff\n" // Cell 66 V
+ "7bb,80,95,0.001,0,3,V,2142,6142,ff\n" // Cell 67 V
+ "7bb,96,111,0.001,0,3,V,2142,6142,ff\n" // Cell 68 V
+ "7bb,112,127,0.001,0,3,V,2142,6142,ff\n" // Cell 69 V
+ "7bb,128,143,0.001,0,3,V,2142,6142,ff\n" // Cell 70 V
+ "7bb,144,159,0.001,0,3,V,2142,6142,ff\n" // Cell 71 V
+ "7bb,160,175,0.001,0,3,V,2142,6142,ff\n" // Cell 72 V
+ "7bb,176,191,0.001,0,3,V,2142,6142,ff\n" // Cell 73 V
+ "7bb,192,207,0.001,0,3,V,2142,6142,ff\n" // Cell 74 V
+ "7bb,208,223,0.001,0,3,V,2142,6142,ff\n" // Cell 75 V
+ "7bb,224,239,0.001,0,3,V,2142,6142,ff\n" // Cell 76 V
+ "7bb,240,255,0.001,0,3,V,2142,6142,ff\n" // Cell 77 V
+ "7bb,256,271,0.001,0,3,V,2142,6142,ff\n" // Cell 78 V
+ "7bb,272,287,0.001,0,3,V,2142,6142,ff\n" // Cell 79 V
+ "7bb,288,303,0.001,0,3,V,2142,6142,ff\n" // Cell 80 V
+ "7bb,304,319,0.001,0,3,V,2142,6142,ff\n" // Cell 81 V
+ "7bb,320,335,0.001,0,3,V,2142,6142,ff\n" // Cell 82 V
+ "7bb,336,351,0.001,0,3,V,2142,6142,ff\n" // Cell 83 V
+ "7bb,352,367,0.001,0,3,V,2142,6142,ff\n" // Cell 84 V
+ "7bb,368,383,0.001,0,3,V,2142,6142,ff\n" // Cell 85 V
+ "7bb,384,399,0.001,0,3,V,2142,6142,ff\n" // Cell 86 V
+ "7bb,400,415,0.001,0,3,V,2142,6142,ff\n" // Cell 87 V
+ "7bb,416,431,0.001,0,3,V,2142,6142,ff\n" // Cell 88 V
+ "7bb,432,447,0.001,0,3,V,2142,6142,ff\n" // Cell 89 V
+ "7bb,448,463,0.001,0,3,V,2142,6142,ff\n" // Cell 90 V
+ "7bb,464,479,0.001,0,3,V,2142,6142,ff\n" // Cell 91 V
+ "7bb,480,495,0.001,0,3,V,2142,6142,ff\n" // Cell 92 V
+ "7bb,496,511,0.001,0,3,V,2142,6142,ff\n" // Cell 93 V
+ "7bb,512,527,0.001,0,3,V,2142,6142,ff\n" // Cell 94 V
+ "7bb,528,543,0.001,0,3,V,2142,6142,ff\n" // Cell 95 V
+ "7bb,544,559,0.001,0,3,V,2142,6142,ff\n" // Cell 96 V
+ "7bb,96,119,1,0,0,km,2161,6161,ff\n" // Battery mileage in km
+ "7bb,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "7bb,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "7bb,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "7bb,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "7bb,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "7bb,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "7bc,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "7bc,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "7bc,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "7bc,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "7bc,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "7bc,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "7da,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "7da,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "7da,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "7da,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "7da,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "7da,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "7ec,56,63,1,0,0,,2180,6180,ff\n" // diagVersion
+ "7ec,64,87,1,0,0,,2180,6180,2ff\n" // Supplier (string!)
+ "7ec,128,143,1,0,0,,2180,6180,ff\n" // Soft
+ "7ec,144,159,1,0,0,,2180,6180,ff\n" // Version
+ "7ec,0,7,1,0,0,,14ffff,54,ff\n" // Reset DTC
+ "7ec,0,23,1,0,0,,19023b,5902ff,ff\n" // Query DTC
+ "7ec,24,31,1,40,0,°C,222001,622001,ff,Battery Rack temperature\n" //
+ "7ec,24,39,2,0,2,%,222002,622002,e2\n" // SOC
+ "7ec,24,39,2.083333333,0,2,%,222002,622002,e5\n" // SOC
+ "7ec,24,39,0.01,0,2,V,222005,622005,ff\n" // 12V battery voltage
+ "7ec,24,47,1,0,0,km,222006,622006,ff\n" // Odometer
+ "7ec,24,31,0.5,0,1,A,223028,623028,ff\n" // 14V current?
+ "7ec,24,39,0.5,0,2,V,223203,623203,ff\n" // HV Battery voltage
+ "7ec,24,39,0.25,32768,2,A,223204,623204,ff\n" // HV Battery current
+ "7ec,24,31,1,0,0,%,223206,623206,ff\n" // Battery health in %
+ "7ec,24,31,1,1,0,,223318,623318,ff\n" // Motor Water pump speed
+ "7ec,24,31,1,1,0,,223319,623319,ff\n" // Charger pump speed
+ "7ec,24,31,1,1,0,,22331A,62331A,ff\n" // Heater water pump speed
+ "7ec,24,47,0.001,1,0,kWh,2233dc,6233dc,ff\n" // Consumed domestic energy
+ "7ec,240,263,1,0,0,km,2233d4,6233d4,ff\n" //
+ "7ec,216,239,1,0,0,km,2233d4,6233d4,ff\n" //
+ "7ec,192,215,1,0,0,km,2233d4,6233d4,ff\n" //
+ "7ec,168,191,1,0,0,km,2233d4,6233d4,ff\n" //
+ "7ec,144,167,1,0,0,km,2233d4,6233d4,ff\n" //
+ "7ec,120,143,1,0,0,km,2233d4,6233d4,ff\n" //
+ "7ec,96,119,1,0,0,km,2233d4,6233d4,ff\n" //
+ "7ec,72,95,1,0,0,km,2233d4,6233d4,ff\n" //
+ "7ec,48,71,1,0,0,km,2233d4,6233d4,ff\n" //
+ "7ec,24,47,1,0,0,km,2233d4,6233d4,ff\n" //
+ "7ec,96,103,1,0,0,,2233d5,6233d5,ff,\n" //
+ "7ec,88,95,1,0,0,,2233d5,6233d5,ff\n" //
+ "7ec,80,87,1,0,0,,2233d5,6233d5,ff\n" //
+ "7ec,72,79,1,0,0,,2233d5,6233d5,ff\n" //
+ "7ec,64,71,1,0,0,,2233d5,6233d5,ff\n" //
+ "7ec,56,63,1,0,0,,2233d5,6233d5,ff\n" //
+ "7ec,48,55,1,0,0,,2233d5,6233d5,ff\n" //
+ "7ec,40,47,1,0,0,,2233d5,6233d5,ff\n" //
+ "7ec,32,39,1,0,0,,2233d5,6233d5,ff\n" //
+ "7ec,24,31,1,0,0,,2233d5,6233d5,ff\n" //
+ "7ec,96,103,1,0,0,,2233d6,6233d6,ff\n" //
+ "7ec,88,95,1,0,0,,2233d6,6233d6,ff\n" //
+ "7ec,80,87,1,0,0,,2233d6,6233d6,ff\n" //
+ "7ec,72,79,1,0,0,,2233d6,6233d6,ff\n" //
+ "7ec,64,71,1,0,0,,2233d6,6233d6,ff\n" //
+ "7ec,56,63,1,0,0,,2233d6,6233d6,ff\n" //
+ "7ec,48,55,1,0,0,,2233d6,6233d6,ff\n" //
+ "7ec,40,47,1,0,0,,2233d6,6233d6,ff\n" //
+ "7ec,32,39,1,0,0,,2233d6,6233d6,ff\n" //
+ "7ec,24,31,1,0,0,,2233d6,6233d6,ff\n" //
+ "7ec,168,183,.2,0,0,%,2233d7,6233d7,ff\n" //
+ "7ec,152,167,.2,0,0,%,2233d7,6233d7,ff\n" //
+ "7ec,136,151,.2,0,0,%,2233d7,6233d7,ff\n" //
+ "7ec,120,135,.2,0,0,%,2233d7,6233d7,ff\n" //
+ "7ec,104,119,.2,0,0,%,2233d7,6233d7,ff\n" //
+ "7ec,88,103,.2,0,0,%,2233d7,6233d7,ff\n" //
+ "7ec,72,87,.2,0,0,%,2233d7,6233d7,ff\n" //
+ "7ec,56,71,.2,0,0,%,2233d7,6233d7,ff\n" //
+ "7ec,40,55,.2,0,0,%,2233d7,6233d7,ff\n" //
+ "7ec,24,39,.2,0,0,%,2233d7,6233d7,ff\n" //
+ "7ec,96,103,1,40,0,°C,2233d8,6233d8,ff\n" //
+ "7ec,88,95,1,40,0,°C,2233d8,6233d8,ff\n" //
+ "7ec,80,87,1,40,0,°C,2233d8,6233d8,ff\n" //
+ "7ec,72,79,1,40,0,°C,2233d8,6233d8,ff\n" //
+ "7ec,64,71,1,40,0,°C,2233d8,6233d8,ff\n" //
+ "7ec,56,63,1,40,0,°C,2233d8,6233d8,ff\n" //
+ "7ec,48,55,1,40,0,°C,2233d8,6233d8,ff\n" //
+ "7ec,40,47,1,40,0,°C,2233d8,6233d8,ff\n" //
+ "7ec,32,39,1,40,0,°C,2233d8,6233d8,ff\n" //
+ "7ec,24,31,1,40,0,°C,2233d8,6233d8,ff\n" //
+ "7ec,168,183,1,0,0,min,2233d9,6233d9,ff\n" //
+ "7ec,152,167,1,0,0,min,2233d9,6233d9,ff\n" //
+ "7ec,136,151,1,0,0,min,2233d9,6233d9,ff\n" //
+ "7ec,120,135,1,0,0,min,2233d9,6233d9,ff\n" //
+ "7ec,104,119,1,0,0,min,2233d9,6233d9,ff\n" //
+ "7ec,88,103,1,0,0,min,2233d9,6233d9,ff\n" //
+ "7ec,72,87,1,0,0,min,2233d9,6233d9,ff\n" //
+ "7ec,56,71,1,0,0,min,2233d9,6233d9,ff\n" //
+ "7ec,40,55,1,0,0,min,2233d9,6233d9,ff\n" //
+ "7ec,24,39,1,0,0,min,2233d9,6233d9,ff\n" //
;
fillDynamic (fieldDef);
}
// Copiado de DataLogger.java
// -------- Data Definitions copied from Driving Activity -- start ---
// for ISO-TP optimization to work, group all identical CAN ID's together when calling addListener
// free data
public static final String SID_Consumption = "1fd.48"; //EVC
public static final String SID_Pedal = "186.40"; //EVC
public static final String SID_MeanEffectiveTorque = "186.16"; //EVC
public static final String SID_RealSpeed = "5d7.0"; //ESC-ABS
public static final String SID_SoC = "654.25"; //EVC
public static final String SID_RangeEstimate = "654.42"; //EVC
public static final String SID_DriverBrakeWheel_Torque_Request = "130.44"; //UBP braking wheel torque the driver wants
public static final String SID_ElecBrakeWheelsTorqueApplied = "1f8.28"; //UBP 10ms
// ISO-TP data
// public static final String SID_EVC_SoC = "7ec.622002.24"; // (EVC)
// public static final String SID_EVC_RealSpeed = "7ec.622003.24"; // (EVC)
public static final String SID_EVC_Odometer = "7ec.622006.24"; // (EVC)
// public static final String SID_EVC_Pedal = "7ec.62202e.24"; // (EVC)
public static final String SID_EVC_TractionBatteryVoltage = "7ec.623203.24"; // (EVC)
public static final String SID_EVC_TractionBatteryCurrent = "7ec.623204.24"; // (EVC)
public static final String SID_MaxCharge = "7bb.6101.336";
// Copiado de AuxBatteryActivity.java
public static final String SID_AuxVoltage = "7ec.622005.24"; //"7bb.6101.224";
public static final String SID_AuxStatus = "638.37";
public static final String SID_VehicleState = "35c.5";
public static final String SID_ChargingStatusDisplay = "65b.41";
// Copiado de BatteryActivity.java
public static final String SID_MainsCurrentType = "793.625017.29";
public static final String SID_Phase1currentRMS = "793.622001.24";
public static final String SID_Phase2CurrentRMS = "793.62503A.24"; // Raw <= this seems to be instant DC coupled value
public static final String SID_Phase3CurrentRMS = "793.62503B.24";
public static final String SID_PhaseVoltage1 = "793.62502C.24"; // Raw
public static final String SID_PhaseVoltage2 = "793.62502D.24";
public static final String SID_PhaseVoltage3 = "793.62502E.24";
public static final String SID_InterPhaseVoltage12 = "793.62503F.24"; // Measured
public static final String SID_InterPhaseVoltage23 = "793.625041.24";
public static final String SID_InterPhaseVoltage31 = "793.625042.24";
public static final String SID_MainsActivePower = "793.62504a.24";
public static final String SID_GroundResistance = "793.625062.24";
public static final String SID_SupervisorState = "793.625063.24";
public static final String SID_CompletionStatus = "793.625064.24";

View File

@ -0,0 +1,35 @@
=======================
Renault Zoe
=======================
Vehicle Type: **RZ2**
This vehicle type supports the Renault Zoe(PH2)
----------------
Support Overview
----------------
=========================== ==============
Function Support Status
=========================== ==============
Hardware OVMS v3 (or later)
Vehicle Cable OBD-II to DB9 Data Cable for OVMS (1441200 right, or 1139300 left)
GSM Antenna 1000500 Open Vehicles OVMS GSM Antenna (or any compatible antenna)
GPS Antenna 1020200 Universal GPS Antenna (SMA Connector) (or any compatible antenna)
SOC Display Yes
Range Display Yes
GPS Location Yes (from modem module GPS)
Speed Display Yes
Temperature Display Yes (External Temp and Battery)
BMS v+t Display Yes
TPMS Display Zoe No
TPMS Display Kangoo No
Charge Status Display Yes
Charge Interruption Alerts No
Charge Control No
Cabin Pre-heat/cool Control No
Lock/Unlock Vehicle No
Valet Mode Control No
Others
=========================== ==============

View File

@ -0,0 +1,323 @@
/*
; Project: Open Vehicle Monitor System
; Date: 11th Sep 2019
;
; Changes:
; 1.0 Initial release
;
; (C) 2011 Michael Stegen / Stegen Electronics
; (C) 2011-2017 Mark Webb-Johnson
; (C) 2011 Sonny Chen @ EPRO/DX
; (C) 2018 Marcos Mezo
; (C) 2019 Thomas Heuer @Dimitrie78
; (C) 2022 Carsten Schmiemann (Zoe PH2 Integration)
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in
; all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
; THE SOFTWARE.
*/
#include "ovms_log.h"
static const char *TAG = "v-zoe-ph2";
#include <stdio.h>
#include <string>
#include <iomanip>
#include "pcp.h"
#include "ovms_metrics.h"
#include "ovms_events.h"
#include "ovms_config.h"
#include "ovms_command.h"
#include "metrics_standard.h"
#include "ovms_notify.h"
#include "ovms_peripherals.h"
#include "vehicle_renaultzoe.h"
void OvmsVehicleRenaultZoePh2::zoe_trip(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv) {
OvmsVehicleRenaultZoePh2* zoe = GetInstance(writer);
if (!zoe)
return;
zoe->CommandTrip(verbosity, writer);
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoePh2::CommandClimateControl(bool climatecontrolon) {
return NotImplemented;
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoePh2::CommandWakeup() {
if(!m_enable_write)
return Fail;
ESP_LOGI(TAG, "Send Wakeup Command");
if (IsZoe()) {
uint8_t data[8] = {0xf1, 0x04, 0x1f, 0xc5, 0x35, 0xfe, 0x65, 0x08};
canbus *obd;
obd = m_can1;
obd->WriteStandard(0x35C, 8, data);
data[1] = 0x06;
data[7] = 0x61;
vTaskDelay(50 / portTICK_PERIOD_MS);
obd->WriteStandard(0x35C, 8, data);
}
if (IsKangoo()) {
uint8_t data[8] = {0x10, 0x03, 0x00, 0x00, 0x08, 0xC0, 0x12, 0x00};
canbus *obd;
obd = m_can1;
obd->WriteStandard(0x35D, 8, data);
data[7] = 0x52;
vTaskDelay(50 / portTICK_PERIOD_MS);
obd->WriteStandard(0x35D, 8, data);
}
return Success;
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoePh2::CommandLock(const char* pin) {
if (IsKangoo()) {
CommandWakeup();
vTaskDelay(500 / portTICK_PERIOD_MS);
uint32_t txid = 0x745, rxid = 0x765;
uint8_t protocol = ISOTP_STD;
int timeout_ms = 100;
std::string request;
std::string response;
request = hexdecode("10C0");
int err = PollSingleRequest(m_can1, txid, rxid, request, response, timeout_ms, protocol);
request = hexdecode("30010001");
err = PollSingleRequest(m_can1, txid, rxid, request, response, timeout_ms, protocol);
if (err == POLLSINGLE_TXFAILURE)
{
ESP_LOGD(TAG, "ERROR: transmission failure (CAN bus error)");
return Fail;
}
else if (err < 0)
{
ESP_LOGD(TAG, "ERROR: timeout waiting for poller/response");
return Fail;
}
else if (err)
{
ESP_LOGD(TAG, "ERROR: request failed with response error code %02X\n", err);
return Fail;
}
StdMetrics.ms_v_env_locked->SetValue(true);
return Success;
}
return NotImplemented;
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoePh2::CommandUnlock(const char* pin) {
if (IsKangoo()) {
CommandWakeup();
vTaskDelay(500 / portTICK_PERIOD_MS);
uint32_t txid = 0x745, rxid = 0x765;
uint8_t protocol = ISOTP_STD;
int timeout_ms = 100;
std::string request;
std::string response;
request = hexdecode("10C0");
int err = PollSingleRequest(m_can1, txid, rxid, request, response, timeout_ms, protocol);
request = hexdecode("30010002");
err = PollSingleRequest(m_can1, txid, rxid, request, response, timeout_ms, protocol);
if (err == POLLSINGLE_TXFAILURE)
{
ESP_LOGD(TAG, "ERROR: transmission failure (CAN bus error)");
return Fail;
}
else if (err < 0)
{
ESP_LOGD(TAG, "ERROR: timeout waiting for poller/response");
return Fail;
}
else if (err)
{
ESP_LOGD(TAG, "ERROR: request failed with response error code %02X\n", err);
return Fail;
}
StdMetrics.ms_v_env_locked->SetValue(false);
return Success;
}
return NotImplemented;
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoePh2::CommandActivateValet(const char* pin) {
return NotImplemented;
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoePh2::CommandDeactivateValet(const char* pin) {
return NotImplemented;
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoePh2::CommandHomelink(int button, int durationms) {
#ifdef CONFIG_OVMS_COMP_MAX7317
if(m_enable_egpio) {
if (button == 0) {
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_3, 0);
vTaskDelay(500 / portTICK_PERIOD_MS);
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_3, 1);
return Success;
}
if (button == 1) {
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_4, 0);
vTaskDelay(500 / portTICK_PERIOD_MS);
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_4, 1);
return Success;
}
if (button == 2) {
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_5, 0);
vTaskDelay(500 / portTICK_PERIOD_MS);
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_5, 1);
return Success;
}
}
#endif
return NotImplemented;
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoePh2::CommandTrip(int verbosity, OvmsWriter* writer) {
metric_unit_t rangeUnit = (MyConfig.GetParamValue("vehicle", "units.distance") == "M") ? Miles : Kilometers;
writer->printf("Driven: %s\n", (char*) StdMetrics.ms_v_pos_trip->AsUnitString("-", rangeUnit, 1).c_str());
writer->printf("Energy used: %s\n", (char*) StdMetrics.ms_v_bat_energy_used->AsUnitString("-", Native, 3).c_str());
writer->printf("Energy recd: %s\n", (char*) StdMetrics.ms_v_bat_energy_recd->AsUnitString("-", Native, 3).c_str());
writer->printf("Energy Available: %s\n", (char*) mt_available_energy->AsUnitString("-", Native, 1).c_str());
return Success;
}
void OvmsVehicleRenaultZoePh2::NotifyTrip() {
StringWriter buf(200);
CommandTrip(COMMAND_RESULT_NORMAL, &buf);
MyNotify.NotifyString("info","xrz.trip",buf.c_str());
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoePh2::CommandStat(int verbosity, OvmsWriter* writer) {
metric_unit_t rangeUnit = (MyConfig.GetParamValue("vehicle", "units.distance") == "M") ? Miles : Kilometers;
bool chargeport_open = StdMetrics.ms_v_door_chargeport->AsBool();
if (chargeport_open)
{
std::string charge_mode = StdMetrics.ms_v_charge_mode->AsString();
std::string charge_state = StdMetrics.ms_v_charge_state->AsString();
bool show_details = !(charge_state == "done" || charge_state == "stopped");
// Translate mode codes:
if (charge_mode == "standard")
charge_mode = "Standard";
else if (charge_mode == "storage")
charge_mode = "Storage";
else if (charge_mode == "range")
charge_mode = "Range";
else if (charge_mode == "performance")
charge_mode = "Performance";
// Translate state codes:
if (charge_state == "charging")
charge_state = "Charging";
else if (charge_state == "topoff")
charge_state = "Topping off";
else if (charge_state == "done")
charge_state = "Charge Done";
else if (charge_state == "preparing")
charge_state = "Preparing";
else if (charge_state == "heating")
charge_state = "Charging, Heating";
else if (charge_state == "stopped")
charge_state = "Charge Stopped";
writer->printf("%s - %s\n", charge_mode.c_str(), charge_state.c_str());
if (show_details)
{
writer->printf("%s/%s\n",
(char*) StdMetrics.ms_v_charge_voltage->AsUnitString("-", Native, 1).c_str(),
(char*) StdMetrics.ms_v_charge_current->AsUnitString("-", Native, 1).c_str());
int duration_full = StdMetrics.ms_v_charge_duration_full->AsInt();
if (duration_full > 0)
writer->printf("Full: %d mins\n", duration_full);
int duration_soc = StdMetrics.ms_v_charge_duration_soc->AsInt();
if (duration_soc > 0)
writer->printf("%s: %d mins\n",
(char*) StdMetrics.ms_v_charge_limit_soc->AsUnitString("SOC", Native, 0).c_str(),
duration_soc);
int duration_range = StdMetrics.ms_v_charge_duration_range->AsInt();
if (duration_range > 0)
writer->printf("%s: %d mins\n",
(char*) StdMetrics.ms_v_charge_limit_range->AsUnitString("Range", rangeUnit, 0).c_str(),
duration_range);
}
}
else
{
writer->puts("Not charging");
}
writer->printf("SOC: %s\n", (char*) StdMetrics.ms_v_bat_soc->AsUnitString("-", Native, 1).c_str());
const char* range_ideal = StdMetrics.ms_v_bat_range_ideal->AsUnitString("-", rangeUnit, 0).c_str();
if (*range_ideal != '-')
writer->printf("Ideal range: %s\n", range_ideal);
const char* range_est = StdMetrics.ms_v_bat_range_est->AsUnitString("-", rangeUnit, 0).c_str();
if (*range_est != '-')
writer->printf("Est. range: %s\n", range_est);
const char* chargedkwh = StdMetrics.ms_v_charge_kwh->AsUnitString("-", Native, 3).c_str();
if (*chargedkwh != '-')
writer->printf("Energy charged: %s\n", chargedkwh);
const char* odometer = StdMetrics.ms_v_pos_odometer->AsUnitString("-", rangeUnit, 1).c_str();
if (*odometer != '-')
writer->printf("ODO: %s\n", odometer);
const char* cac = StdMetrics.ms_v_bat_cac->AsUnitString("-", Native, 1).c_str();
if (*cac != '-')
writer->printf("CAC: %s\n", cac);
const char* soh = StdMetrics.ms_v_bat_soh->AsUnitString("-", Native, 1).c_str();
if (*soh != '-')
writer->printf("SOH: %s\n", soh);
const char* avai_energy = mt_available_energy->AsUnitString("-", Native, 1).c_str();
if (*avai_energy != '-')
writer->printf("Energy Available: %s\n", avai_energy);
return Success;
}

View File

@ -0,0 +1,243 @@
/*
; Project: Open Vehicle Monitor System
; Date: 11th Sep 2019
;
; Changes:
; 1.0 Initial release
;
; (C) 2011 Michael Stegen / Stegen Electronics
; (C) 2011-2017 Mark Webb-Johnson
; (C) 2011 Sonny Chen @ EPRO/DX
; (C) 2018 Marcos Mezo
; (C) 2019 Thomas Heuer @Dimitrie78
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in
; all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
; THE SOFTWARE.
*/
#include <sdkconfig.h>
#ifdef CONFIG_OVMS_COMP_WEBSERVER
#include <stdio.h>
#include <string>
#include "ovms_metrics.h"
#include "ovms_events.h"
#include "ovms_config.h"
#include "ovms_command.h"
#include "metrics_standard.h"
#include "ovms_notify.h"
#include "ovms_webserver.h"
#include "vehicle_renaultzoe.h"
using namespace std;
#define _attr(text) (c.encode_html(text).c_str())
#define _html(text) (c.encode_html(text).c_str())
/**
* WebInit: register pages
*/
void OvmsVehicleRenaultZoePh2::WebInit()
{
// vehicle menu:
MyWebServer.RegisterPage("/xrz/features", "Features", WebCfgFeatures, PageMenu_Vehicle, PageAuth_Cookie);
MyWebServer.RegisterPage("/xrz/battery", "Battery config", WebCfgBattery, PageMenu_Vehicle, PageAuth_Cookie);
MyWebServer.RegisterPage("/xrz/battmon", "Battery Monitor", OvmsWebServer::HandleBmsCellMonitor, PageMenu_Vehicle, PageAuth_Cookie);
}
/**
* WebDeInit: deregister pages
*/
void OvmsVehicleRenaultZoePh2::WebDeInit()
{
MyWebServer.DeregisterPage("/xrz/features");
MyWebServer.DeregisterPage("/xrz/battery");
MyWebServer.DeregisterPage("/xrz/battmon");
}
/**
* WebCfgFeatures: configure general parameters (URL /xrz/features)
*/
void OvmsVehicleRenaultZoePh2::WebCfgFeatures(PageEntry_t& p, PageContext_t& c)
{
std::string error, info;
bool canwrite;
std::string vehicle_type;
if (c.method == "POST") {
// process form submission:
canwrite = (c.getvar("canwrite") == "yes");
vehicle_type = c.getvar("vehicle_type");
// validate:
if (vehicle_type != "") {
int v = atoi(vehicle_type.c_str());
if (v < 0 || v > 1) {
error += "<li data-input=\"vehicle_type\">Something went wrong</li>";
}
}
if (error == "") {
// success:
MyConfig.SetParamValueBool("xrz", "canwrite", canwrite);
MyConfig.SetParamValue("xrz", "vehicle.type", vehicle_type);
info = "<p class=\"lead\">Success!</p><ul class=\"infolist\">" + info + "</ul>";
c.head(200);
c.alert("success", info.c_str());
MyWebServer.OutputHome(p, c);
c.done();
return;
}
// output error, return to form:
error = "<p class=\"lead\">Error!</p><ul class=\"errorlist\">" + error + "</ul>";
c.head(400);
c.alert("danger", error.c_str());
}
else {
// read configuration:
canwrite = MyConfig.GetParamValueBool("xrz", "canwrite", false);
vehicle_type = MyConfig.GetParamValue("xrz", "vehicle.type", "0");
c.head(200);
}
// generate form:
c.panel_start("primary", "Renault Zoe/Kangoo feature configuration");
c.form_start(p.uri);
c.input_checkbox("Enable CAN write(Poll)", "canwrite", canwrite,
"<p>Controls overall CAN write access, some functions depend on this.</p>");
c.input_select_start("Vehicle type", "vehicle_type");
c.input_select_option("Zoe R240 (PH1)", "0", vehicle_type == "0");
c.input_select_option("Kangoo", "1", vehicle_type == "1");
c.input_select_end();
c.print("<hr>");
c.input_button("default", "Save");
c.form_end();
c.panel_end();
c.done();
}
/**
* WebCfgBattery: configure battery parameters (URL /xrz/battery)
*/
void OvmsVehicleRenaultZoePh2::WebCfgBattery(PageEntry_t& p, PageContext_t& c)
{
std::string error;
// rangeideal Ideal Range (Default: 160km)
// suffsoc Sufficient SOC [%] (Default: 0=disabled)
// suffrange Sufficient range [km] (Default: 0=disabled)
std::string rangeideal, battcapacity, suffrange, suffsoc;
if (c.method == "POST") {
// process form submission:
rangeideal = c.getvar("rangeideal");
battcapacity = c.getvar("battcapacity");
suffrange = c.getvar("suffrange");
suffsoc = c.getvar("suffsoc");
// check:
if (!rangeideal.empty()) {
int v = atoi(rangeideal.c_str());
if (v < 90 || v > 500)
error += "<li data-input=\"rangeideal\">Range Ideal must be of 80…500 km</li>";
}
if (!battcapacity.empty()) {
int v = atoi(rangeideal.c_str());
if (v < 90 || v > 500)
error += "<li data-input=\"battcapacity\">Battery Capacity must be of 10000…50000 Wh</li>";
}
if (!suffrange.empty()) {
float n = atof(suffrange.c_str());
if (n < 0)
error += "<li data-input=\"suffrange\">Sufficient range invalid, must be &ge; 0</li>";
}
if (!suffsoc.empty()) {
float n = atof(suffsoc.c_str());
if (n < 0 || n > 100)
error += "<li data-input=\"suffsoc\">Sufficient SOC invalid, must be 0…100</li>";
}
if (error == "") {
// store:
MyConfig.SetParamValue("xrz", "rangeideal", rangeideal);
MyConfig.SetParamValue("xrz", "battcapacity", battcapacity);
MyConfig.SetParamValue("xrz", "suffrange", suffrange);
MyConfig.SetParamValue("xrz", "suffsoc", suffsoc);
c.head(200);
c.alert("success", "<p class=\"lead\">Renault Zoe/Kangoo battery setup saved.</p>");
MyWebServer.OutputHome(p, c);
c.done();
return;
}
// output error, return to form:
error = "<p class=\"lead\">Error!</p><ul class=\"errorlist\">" + error + "</ul>";
c.head(400);
c.alert("danger", error.c_str());
}
else {
// read configuration:
rangeideal = MyConfig.GetParamValue("xrz", "rangeideal", "160");
battcapacity = MyConfig.GetParamValue("xrz", "battcapacity", "27000");
suffrange = MyConfig.GetParamValue("xrz", "suffrange", "0");
suffsoc = MyConfig.GetParamValue("xrz", "suffsoc", "0");
c.head(200);
}
// generate form:
c.panel_start("primary", "Renault Zoe/Kangoo Battery Setup");
c.form_start(p.uri);
c.fieldset_start("Charge control");
c.input_slider("Range Ideal", "rangeideal", 3, "km",
-1, atoi(rangeideal.c_str()), 160, 80, 500, 1,
"<p>Default 160km. Ideal Range...</p>");
c.input_slider("Battery Capacity", "battcapacity", 5, "Wh",
-1, atoi(battcapacity.c_str()), 27000, 10000, 50000, 100,
"<p>Default 27000. Battery Capacity...</p>");
c.input_slider("Sufficient range", "suffrange", 3, "km",
atof(suffrange.c_str()) > 0, atof(suffrange.c_str()), 75, 0, 150, 1,
"<p>Default 0=off. Notify/stop charge when reaching this level.</p>");
c.input_slider("Sufficient SOC", "suffsoc", 3, "%",
atof(suffsoc.c_str()) > 0, atof(suffsoc.c_str()), 80, 0, 100, 1,
"<p>Default 0=off. Notify/stop charge when reaching this level.</p>");
c.fieldset_end();
c.print("<hr>");
c.input_button("default", "Save");
c.form_end();
c.panel_end();
c.done();
}
#endif //CONFIG_OVMS_COMP_WEBSERVER

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,155 @@
/*
; Project: Open Vehicle Monitor System
; Date: 11th Sep 2019
;
; Changes:
; 0.1.0 Initial release
; - fork of vehicle_demo
;
; (C) 2011 Michael Stegen / Stegen Electronics
; (C) 2011-2017 Mark Webb-Johnson
; (C) 2011 Sonny Chen @ EPRO/DX
; (C) 2018 Marcos Mezo
; (C) 2019 Thomas Heuer @Dimitrie78
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in
; all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
; THE SOFTWARE.
*/
#ifndef __VEHICLE_RENAULTZOE_PH2_H__
#define __VEHICLE_RENAULTZOE_PH2_H__
#include <atomic>
#include "can.h"
#include "vehicle.h"
#include "ovms_log.h"
#include "ovms_config.h"
#include "ovms_metrics.h"
#include "ovms_command.h"
#include "freertos/timers.h"
#ifdef CONFIG_OVMS_COMP_WEBSERVER
#include "ovms_webserver.h"
#endif
// CAN buffer access macros: b=byte# 0..7 / n=nibble# 0..15
#define CAN_BYTE(b) data[b]
#define CAN_UINT(b) (((UINT)CAN_BYTE(b) << 8) | CAN_BYTE(b+1))
#define CAN_UINT24(b) (((uint32_t)CAN_BYTE(b) << 16) | ((UINT)CAN_BYTE(b+1) << 8) | CAN_BYTE(b+2))
#define CAN_UINT32(b) (((uint32_t)CAN_BYTE(b) << 24) | ((uint32_t)CAN_BYTE(b+1) << 16) | ((UINT)CAN_BYTE(b+2) << 8) | CAN_BYTE(b+3))
#define CAN_NIBL(b) (data[b] & 0x0f)
#define CAN_NIBH(b) (data[b] >> 4)
#define CAN_NIB(n) (((n)&1) ? CAN_NIBL((n)>>1) : CAN_NIBH((n)>>1))
#define POLLSTATE_OFF PollSetState(0);
#define POLLSTATE_ON PollSetState(1);
#define POLLSTATE_RUNNING PollSetState(2);
#define POLLSTATE_CHARGING PollSetState(3);
#define RZ_CANDATA_TIMEOUT 10
using namespace std;
class OvmsVehicleRenaultZoePh2 : public OvmsVehicle {
public:
OvmsVehicleRenaultZoePh2();
~OvmsVehicleRenaultZoePh2();
static OvmsVehicleRenaultZoePh2* GetInstance(OvmsWriter* writer=NULL);
void IncomingFrameCan1(CAN_frame_t* p_frame);
void IncomingPollReply(canbus* bus, uint16_t type, uint16_t pid, uint8_t* data, uint8_t length, uint16_t remain);
protected:
void IncomingEPS(uint16_t type, uint16_t pid, const char* data, uint16_t len);
void IncomingEVC(uint16_t type, uint16_t pid, const char* data, uint16_t len);
void IncomingBCB(uint16_t type, uint16_t pid, const char* data, uint16_t len);
void IncomingLBC(uint16_t type, uint16_t pid, const char* data, uint16_t len);
void IncomingUBP(uint16_t type, uint16_t pid, const char* data, uint16_t len);
void IncomingPEB(uint16_t type, uint16_t pid, const char* data, uint16_t len);
void car_on(bool isOn);
virtual void Ticker1(uint32_t ticker);
virtual void Ticker10(uint32_t ticker);
void HandleCharging();
void HandleEnergy();
int calcMinutesRemaining(float target, float charge_voltage, float charge_current);
OvmsCommand *cmd_zoe;
// Renault ZOE specific metrics
OvmsMetricFloat *mt_pos_odometer_start; // ODOmeter at Start
OvmsMetricBool *mt_bus_awake; // can-bus awake status
OvmsMetricFloat *mt_available_energy; // Available Energy
OvmsMetricFloat *mt_main_power_consumed; // Mains active power consumed
// Rnault Kangoo metrics
OvmsMetricFloat *mt_heatwater_temp; // Heat Water Temp
public:
void WebInit();
void WebDeInit();
static void WebCfgFeatures(PageEntry_t& p, PageContext_t& c);
static void WebCfgBattery(PageEntry_t& p, PageContext_t& c);
void ConfigChanged(OvmsConfigParam* param);
bool SetFeature(int key, const char* value);
const std::string GetFeature(int key);
public:
//virtual vehicle_command_t CommandSetChargeCurrent(uint16_t limit);
//virtual vehicle_command_t CommandStat(int verbosity, OvmsWriter* writer);
virtual vehicle_command_t CommandWakeup();
virtual vehicle_command_t CommandClimateControl(bool enable);
virtual vehicle_command_t CommandLock(const char* pin);
virtual vehicle_command_t CommandUnlock(const char* pin);
virtual vehicle_command_t CommandHomelink(int button, int durationms=1000);
virtual vehicle_command_t CommandActivateValet(const char* pin);
virtual vehicle_command_t CommandDeactivateValet(const char* pin);
virtual vehicle_command_t CommandTrip(int verbosity, OvmsWriter* writer);
virtual vehicle_command_t CommandStat(int verbosity, OvmsWriter* writer);
void NotifyTrip();
protected:
bool m_enable_write; // canwrite
char zoe_vin[8] = ""; // last 7 digits of full VIN
int m_range_ideal; // … Range Ideal (default 160 km)
int m_battery_capacity; // Battery Capacity (default 27000)
bool m_enable_egpio; // enable EGPIO for Homelink commands
bool m_reset_trip; // Reset trip when charging else when env on
int m_vehicle_type; // Vehicle type (Zoe, Kangoo...)
int m_reboot_ticker;
private:
unsigned int m_candata_timer;
unsigned int m_candata_poll;
public:
static void zoe_trip(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv);
protected:
string zoe_obd_rxbuf;
public:
bool IsZoe() {
return m_vehicle_type == 0;
}
bool IsKangoo() {
return m_vehicle_type == 1;
}
};
#endif //#ifndef __VEHICLE_RENAUTZOE_H__