Commit 9f16ce0e authored by 高士达's avatar 高士达

Merge branch 'CJL' into 'dev'

Cjl

See merge request !118
parents 4c7695d4 bab91c00
......@@ -65,115 +65,115 @@ typedef enum {
following is an example for different system frequencies */
//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
#if HAS_BOOTLOADER
const uint8_t user_opt_data[4] __attribute__((used)) __attribute__((section(".ARM.__AT_0x000080C0"))) =
#else
const uint8_t user_opt_data[4] __attribute__((used)) __attribute__((section(".ARM.__AT_0x000000C0"))) =
#endif
{
/**
* @brief WDT Control BYTE
* Please refer to the user manual for details.
* 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
* --------|---------|---------|-------|-------|-------|-------|----------
* WDTINT | WINDOW1 | WINDOW0 | WDTON | WDCS2 | WDCS1 | WDCS0 | WDSTBYON
* --------|---------|---------|-------|-------|-------|-------|----------
*/
// <h> WDT Control Option Byte (C0H)
// <e.4> Enable WDT (WDTON)
// <o.5..6> Watchdog timer window open period setting <2=> 75% <3=> 100%
// <o.1..3> Watchdog timer overflow time setting <0=> 2^6/fIL <1=> 2^7/fIL
// <2=> 2^8/fIL <3=> 2^9/fIL
// <4=> 2^11/fIL <5=> 2^13/fIL
// <6=> 2^14/fIL <7=> 2^16/fIL
// <e.0> Operation in Standby mode setting (WDSTBYON)
// <i> WDT Operaton in SLEEP/DEEPSLEEP mode.
// </e>
// <e.7> interrupt enable
// <i> interval interrupt is generated when 75% + 1/2 fIL of the overflow time is reached.
// </e>
// </e>
// </h>
0x7C,//0xEF,
/**
* @brief LVD Control BYTE (C1H)
* Please refer to the user manual for details.
* 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
* -------|-------|-------|-------|-------|-------|---------|----------
* VPOC2 | VPOC1 | VPOC0 | 1 | LVIS1 | LVIS0 | LVIMDS1 | LVIMDS0
* -------|-------|-------|-------|-------|-------|---------|----------
*/
// <h> LVD Control Option Byte (C1H)
// <o.0..7> Voltage detection setting (VLVD) <0xFF=> ( LVD OFF )
// <0x3D=> VLVD = 1.88V/1.84V ( interrupt mode )
// <0x39=> VLVD = 1.98V/1.94V ( interrupt mode )
// <0x35=> VLVD = 2.09V/2.04V ( interrupt mode )
// <0x5D=> VLVD = 2.50V/2.45V ( interrupt mode )
// <0x59=> VLVD = 2.61V/2.55V ( interrupt mode )
// <0x55=> VLVD = 2.71V/2.65V ( interrupt mode )
// <0x7D=> VLVD = 2.81V/2.75V ( interrupt mode )
// <0x79=> VLVD = 2.92V/2.86V ( interrupt mode )
// <0x75=> VLVD = 3.02V/2.96V ( interrupt mode )
// <0x3F=> VLVD = 1.88V/1.84V ( reset mode )
// <0x3B=> VLVD = 1.98V/1.94V ( reset mode )
// <0x37=> VLVD = 2.09V/2.04V ( reset mode )
// <0x5F=> VLVD = 2.50V/2.45V ( reset mode )
// <0x5B=> VLVD = 2.61V/2.55V ( reset mode )
// <0x57=> VLVD = 2.71V/2.65V ( reset mode )
// <0x7F=> VLVD = 2.81V/2.75V ( reset mode )
// <0x7B=> VLVD = 2.92V/2.86V ( reset mode )
// <0x77=> VLVD = 3.02V/2.96V ( reset mode )
// <0x3A=> VLVDH = 1.98V/1.94V, VLVDL = 1.84V ( interrupt & reset mode )
// <0x36=> VLVDH = 2.09V/2.04V, VLVDL = 1.84V ( interrupt & reset mode )
// <0x32=> VLVDH = 3.13V/3.06V, VLVDL = 1.84V ( interrupt & reset mode )
// <0x5A=> VLVDH = 2.61V/2.55V, VLVDL = 2.45V ( interrupt & reset mode )
// <0x56=> VLVDH = 2.71V/2.65V, VLVDL = 2.45V ( interrupt & reset mode )
// <0x52=> VLVDH = 3.75V/3.67V, VLVDL = 2.45V ( interrupt & reset mode )
// <0x7A=> VLVDH = 2.92V/2.86V, VLVDL = 2.75V ( interrupt & reset mode )
// <0x76=> VLVDH = 3.02V/2.96V, VLVDL = 2.75V ( interrupt & reset mode )
// <0x72=> VLVDH = 4.06V/3.98V, VLVDL = 2.75V ( interrupt & reset mode )
// <i> Please setting the item for interrupt & reset mode
// </h>
0x73,
/**
* @brief HOCO Control BYTE (FRQSEL)
* Please refer to the user manual for details.
* 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
* -------|-------|-------|---------|---------|---------|---------|---------
* 1 | 1 | 1 | FRQSEL4 | FRQSEL3 | FRQSEL2 | FRQSEL1 | FRQSEL0
* -------|-------|-------|---------|---------|---------|---------|---------
*/
// <h> HOCO Control Option Byte (C2H)
// <o.0..4> High-speed OCO clock setting <0xF8=> fHOCO = 64MHz, fIH = 64MHz
// <0xF0=> fHOCO = 48MHz, fIH = 48MHz
// <0xE8=> fHOCO = 32MHz, fIH = 32MHz
// <0xE0=> fHOCO = 24MHz, fIH = 24MHz
// <0xE9=> fHOCO = 32MHz, fIH = 16MHz
// <0xE1=> fHOCO = 24MHz, fIH = 12MHz
// <0xEA=> fHOCO = 32MHz, fIH = 8MHz
// <0xE2=> fHOCO = 24MHz, fIH = 6MHz
// <0xEB=> fHOCO = 32MHz, fIH = 4MHz
// <0xE3=> fHOCO = 24MHz, fIH = 3MHz
// <0xEC=> fHOCO = 32MHz, fIH = 2MHz
// <0xED=> fHOCO = 32MHz, fIH = 1MHz
// </h>
0xE8,
/**
* @brief Flash Protect Control BYTE
* Please refer to the user manual for details.
*/
// <h> OCD Control Option Byte (C3H)
// <o.0..7> On-chip debug setting (OCDEN) <0xFF=> Enable <0xC3=> Disable
// <i> OCDM(500004H) == 0x3C && OCDEN == 0xC3: Debugger can not erease/write/read Flash.
// <i> OCDM(500004H) != 0x3C && OCDEN == 0xC3: Debugger can only chip erease Flash but cannot write/read Flash.
// </h>
0xFF
};
//#if HAS_BOOTLOADER
//const uint8_t user_opt_data[4] __attribute__((used)) __attribute__((section(".ARM.__AT_0x000080C0"))) =
//#else
//const uint8_t user_opt_data[4] __attribute__((used)) __attribute__((section(".ARM.__AT_0x000000C0"))) =
//#endif
//{
//
///**
// * @brief WDT Control BYTE
// * Please refer to the user manual for details.
// * 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
// * --------|---------|---------|-------|-------|-------|-------|----------
// * WDTINT | WINDOW1 | WINDOW0 | WDTON | WDCS2 | WDCS1 | WDCS0 | WDSTBYON
// * --------|---------|---------|-------|-------|-------|-------|----------
// */
//// <h> WDT Control Option Byte (C0H)
//// <e.4> Enable WDT (WDTON)
//// <o.5..6> Watchdog timer window open period setting <2=> 75% <3=> 100%
//// <o.1..3> Watchdog timer overflow time setting <0=> 2^6/fIL <1=> 2^7/fIL
//// <2=> 2^8/fIL <3=> 2^9/fIL
//// <4=> 2^11/fIL <5=> 2^13/fIL
//// <6=> 2^14/fIL <7=> 2^16/fIL
//// <e.0> Operation in Standby mode setting (WDSTBYON)
//// <i> WDT Operaton in SLEEP/DEEPSLEEP mode.
//// </e>
//// <e.7> interrupt enable
//// <i> interval interrupt is generated when 75% + 1/2 fIL of the overflow time is reached.
//// </e>
//// </e>
//// </h>
// 0x7C,//0xEF,
//
///**
// * @brief LVD Control BYTE (C1H)
// * Please refer to the user manual for details.
// * 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
// * -------|-------|-------|-------|-------|-------|---------|----------
// * VPOC2 | VPOC1 | VPOC0 | 1 | LVIS1 | LVIS0 | LVIMDS1 | LVIMDS0
// * -------|-------|-------|-------|-------|-------|---------|----------
// */
//// <h> LVD Control Option Byte (C1H)
//// <o.0..7> Voltage detection setting (VLVD) <0xFF=> ( LVD OFF )
//// <0x3D=> VLVD = 1.88V/1.84V ( interrupt mode )
//// <0x39=> VLVD = 1.98V/1.94V ( interrupt mode )
//// <0x35=> VLVD = 2.09V/2.04V ( interrupt mode )
//// <0x5D=> VLVD = 2.50V/2.45V ( interrupt mode )
//// <0x59=> VLVD = 2.61V/2.55V ( interrupt mode )
//// <0x55=> VLVD = 2.71V/2.65V ( interrupt mode )
//// <0x7D=> VLVD = 2.81V/2.75V ( interrupt mode )
//// <0x79=> VLVD = 2.92V/2.86V ( interrupt mode )
//// <0x75=> VLVD = 3.02V/2.96V ( interrupt mode )
//// <0x3F=> VLVD = 1.88V/1.84V ( reset mode )
//// <0x3B=> VLVD = 1.98V/1.94V ( reset mode )
//// <0x37=> VLVD = 2.09V/2.04V ( reset mode )
//// <0x5F=> VLVD = 2.50V/2.45V ( reset mode )
//// <0x5B=> VLVD = 2.61V/2.55V ( reset mode )
//// <0x57=> VLVD = 2.71V/2.65V ( reset mode )
//// <0x7F=> VLVD = 2.81V/2.75V ( reset mode )
//// <0x7B=> VLVD = 2.92V/2.86V ( reset mode )
//// <0x77=> VLVD = 3.02V/2.96V ( reset mode )
//// <0x3A=> VLVDH = 1.98V/1.94V, VLVDL = 1.84V ( interrupt & reset mode )
//// <0x36=> VLVDH = 2.09V/2.04V, VLVDL = 1.84V ( interrupt & reset mode )
//// <0x32=> VLVDH = 3.13V/3.06V, VLVDL = 1.84V ( interrupt & reset mode )
//// <0x5A=> VLVDH = 2.61V/2.55V, VLVDL = 2.45V ( interrupt & reset mode )
//// <0x56=> VLVDH = 2.71V/2.65V, VLVDL = 2.45V ( interrupt & reset mode )
//// <0x52=> VLVDH = 3.75V/3.67V, VLVDL = 2.45V ( interrupt & reset mode )
//// <0x7A=> VLVDH = 2.92V/2.86V, VLVDL = 2.75V ( interrupt & reset mode )
//// <0x76=> VLVDH = 3.02V/2.96V, VLVDL = 2.75V ( interrupt & reset mode )
//// <0x72=> VLVDH = 4.06V/3.98V, VLVDL = 2.75V ( interrupt & reset mode )
//// <i> Please setting the item for interrupt & reset mode
//// </h>
// 0x73,
//
///**
// * @brief HOCO Control BYTE (FRQSEL)
// * Please refer to the user manual for details.
// * 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
// * -------|-------|-------|---------|---------|---------|---------|---------
// * 1 | 1 | 1 | FRQSEL4 | FRQSEL3 | FRQSEL2 | FRQSEL1 | FRQSEL0
// * -------|-------|-------|---------|---------|---------|---------|---------
// */
//// <h> HOCO Control Option Byte (C2H)
//// <o.0..4> High-speed OCO clock setting <0xF8=> fHOCO = 64MHz, fIH = 64MHz
//// <0xF0=> fHOCO = 48MHz, fIH = 48MHz
//// <0xE8=> fHOCO = 32MHz, fIH = 32MHz
//// <0xE0=> fHOCO = 24MHz, fIH = 24MHz
//// <0xE9=> fHOCO = 32MHz, fIH = 16MHz
//// <0xE1=> fHOCO = 24MHz, fIH = 12MHz
//// <0xEA=> fHOCO = 32MHz, fIH = 8MHz
//// <0xE2=> fHOCO = 24MHz, fIH = 6MHz
//// <0xEB=> fHOCO = 32MHz, fIH = 4MHz
//// <0xE3=> fHOCO = 24MHz, fIH = 3MHz
//// <0xEC=> fHOCO = 32MHz, fIH = 2MHz
//// <0xED=> fHOCO = 32MHz, fIH = 1MHz
//// </h>
// 0xE8,
//
///**
// * @brief Flash Protect Control BYTE
// * Please refer to the user manual for details.
// */
//// <h> OCD Control Option Byte (C3H)
//// <o.0..7> On-chip debug setting (OCDEN) <0xFF=> Enable <0xC3=> Disable
//// <i> OCDM(500004H) == 0x3C && OCDEN == 0xC3: Debugger can not erease/write/read Flash.
//// <i> OCDM(500004H) != 0x3C && OCDEN == 0xC3: Debugger can only chip erease Flash but cannot write/read Flash.
//// </h>
// 0xFF
//
//};
//-------- <<< end of configuration section >>> ------------------
/** @} */ /* End of group Configuration_of_User_Option_Byte */
......
......@@ -64,7 +64,7 @@ void Data_User_Mileage_KL30Init(void)
{
ODOInit.Offset = TempBuf[1];
}
ODOInit.MaxValue = 1999990;
ODOInit.MaxValue = 3218672;//英里199999
Data_ODO_KL30_Init(DataODOBuf, &ODOInit, Func.EEPromWrite_Cbk);
(void)Data_User_EEPROM_Read(EM_TRIP_BLOCK, TempBuf + 3, 2);
......@@ -85,7 +85,7 @@ void Data_User_Mileage_KL30Init(void)
TripInit[EM_TRIP_A].Offset = TempBuf[4];
}
//TripInit[EM_TRIP_A].Offset = TempBuf[4];
TripInit[EM_TRIP_A].MaxValue = 9999; /* 最大999.9km 进行复位 */
TripInit[EM_TRIP_A].MaxValue = 16099; /* 英里最大999.9km 进行复位 */
TripInit[EM_TRIP_A].IsRestart = 1u;
//TripInit[EM_TRIP_B].Stamp = 0xFFFFFFFFu;
......@@ -297,7 +297,7 @@ void Services_Mileage_Callback(void)
//Data_Mileage_ISR();
Data_ODO_Processing();
Data_Trip_Processing();
//Trip_Clear_Km_Service();
Trip_Clear_Km_Service();
}
/**
......@@ -319,6 +319,10 @@ uint32_t Get_ODO_Value(void)
{
ODO = Data_ODO_Read();
}
if(ODO >= 199999)
{
ODO = 199999;
}
return ODO;
}
......@@ -371,7 +375,7 @@ void Unit_Convert_Service(void)
{
if (Data_Read_Trip(EM_TRIP_A) > 9999) /* 当前单位在KM时,里程大于999.9KM进行清零 */
{
Data_Write_Trip(EM_TRIP_A, 9999);
Data_Write_Trip(EM_TRIP_A, 0);
}
}
......
......@@ -312,13 +312,13 @@
#define CheckSumErr 7 // Checksum Error
#define UnknownPartID 8 // Unknown Part ID
#define SWV 0x126 // 0x100 = 1.00 software version 软件版本号
#define SWV 0x127 // 0x100 = 1.00 software version 软件版本号
#define HWV 0x103 // 0x100 = 1.00 hardware version 硬件版本号
#define BTV 0x100 // 0x100 = 1.00 bootloader version boot程序版本号
#define INTLV 0x126 // 0x100 = 1.00 internal version 内部版本号
#define INTLV 0x127 // 0x100 = 1.00 internal version 内部版本号
#define PROG_Y 0x24 // 0x24 = 2024年, program year
#define PROG_M 0x10 // 0x03 = 3月, program month
#define PROG_D 0x09 // 0x19 = 19日, program day
#define PROG_M 0x11 // 0x03 = 3月, program month
#define PROG_D 0x07 // 0x19 = 19日, program day
/******************************************************************************
Bootloader Variable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment