Temp control working
Fix pid error Remove pointless static keywords
This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
/********************* (C) COPYRIGHT 2015 e-Design Co.,Ltd. ********************
|
|
||||||
File Name : Flash.h
|
|
||||||
Version : Author : bure
|
|
||||||
*******************************************************************************/
|
|
||||||
#ifndef __EXT_FLASH_H
|
|
||||||
#define __EXT_FLASH_H
|
|
||||||
#include "stm32f10x.h"
|
|
||||||
#define PAGESIZE 256
|
|
||||||
|
|
||||||
#define WREN 0x06 // Write enable instruction
|
|
||||||
#define READ 0x03 // Read from Memory instruction
|
|
||||||
#define RDSR 0x05 // Read Status Register instruction
|
|
||||||
#define PP 0x02 // Write to Memory instruction
|
|
||||||
#define PW 0x0A // Page write instruction
|
|
||||||
|
|
||||||
#define OK 0 //
|
|
||||||
#define SEC_ERR 1 //
|
|
||||||
#define TMAX 100000 //
|
|
||||||
|
|
||||||
#define WIP_Flag 0x01 // Write In Progress (WIP) flag
|
|
||||||
#define Dummy_Byte 0xA5
|
|
||||||
|
|
||||||
u8 FLASH_Prog(u32 Address, u16 Data);
|
|
||||||
void FLASH_Erase(u32 Address);
|
|
||||||
void ExtFlashPageWR(u8* pBuffer, u32 WriteAddr);
|
|
||||||
void ExtFlashDataRD(u8* pBuffer, u32 ReadAddr, u16 Lenght);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************* END OF FILE ******************************/
|
|
||||||
@@ -6,15 +6,10 @@
|
|||||||
|
|
||||||
#define PRODUCT_INFO "TS100"
|
#define PRODUCT_INFO "TS100"
|
||||||
#define MCU_TYPE "STM32F103T8"
|
#define MCU_TYPE "STM32F103T8"
|
||||||
#define ADC_TYPE "MCU's ADC"
|
|
||||||
#define FPGA_TYPE "None"
|
|
||||||
#define SCH_VER "2.46"
|
#define SCH_VER "2.46"
|
||||||
// #define SSD1316 1
|
|
||||||
// #define MFTSEEED "Manufacturer"
|
|
||||||
// #define MFTMINI "Manufacturer"
|
|
||||||
|
|
||||||
#define SPIx SPI1
|
#define SPIx SPI1
|
||||||
#define FLASH_PAGE 0x0400
|
|
||||||
//--------------------------- key Definitions ------------------------------//
|
//--------------------------- key Definitions ------------------------------//
|
||||||
#define KEY1_PIN GPIO_Pin_9 //PA8
|
#define KEY1_PIN GPIO_Pin_9 //PA8
|
||||||
#define KEY2_PIN GPIO_Pin_6 //PA6
|
#define KEY2_PIN GPIO_Pin_6 //PA6
|
||||||
@@ -33,23 +28,23 @@
|
|||||||
#define I2C2_DR_Address 0x40005810
|
#define I2C2_DR_Address 0x40005810
|
||||||
|
|
||||||
|
|
||||||
//--------------------------- OLED <EFBFBD><EFBFBD>ؿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD> ------------------------------//
|
//--------------------------- OLED ------------------------------//
|
||||||
#define OLED_RST_PIN GPIO_Pin_8 //PA9
|
#define OLED_RST_PIN GPIO_Pin_8 //PA9
|
||||||
#define OLED_RST() GPIO_ResetBits(GPIOA, OLED_RST_PIN)
|
#define OLED_RST() GPIO_ResetBits(GPIOA, OLED_RST_PIN)
|
||||||
#define OLED_ACT() GPIO_SetBits (GPIOA, OLED_RST_PIN)
|
#define OLED_ACT() GPIO_SetBits (GPIOA, OLED_RST_PIN)
|
||||||
|
|
||||||
//------------------------------ <EFBFBD><EFBFBD><EFBFBD>ȿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD> --------------------------------//
|
//------------------------------ --------------------------------//
|
||||||
#define HEAT_PIN GPIO_Pin_4
|
#define HEAT_PIN GPIO_Pin_4
|
||||||
|
|
||||||
#define HEAT_OFF() GPIOB->BRR = HEAT_PIN
|
#define HEAT_OFF() GPIOB->BRR = HEAT_PIN
|
||||||
#define HEAT_ON() GPIOB->BSRR = HEAT_PIN
|
#define HEAT_ON() GPIOB->BSRR = HEAT_PIN
|
||||||
|
|
||||||
//---------------------<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>--VB---------------------------------------//
|
//-----------------------VB---------------------------------------//
|
||||||
#define VB_PIN GPIO_Pin_1 //PB1(Ai9)
|
#define VB_PIN GPIO_Pin_1 //PB1(Ai9)
|
||||||
//----------------------------ADX345 INT1,INT2--------------------------------//
|
//----------------------------ADX345 INT1,INT2--------------------------------//
|
||||||
#define INT1_PIN GPIO_Pin_5 //PB5
|
#define INT1_PIN GPIO_Pin_5 //PB5
|
||||||
#define INT2_PIN GPIO_Pin_3 //PB3
|
#define INT2_PIN GPIO_Pin_3 //PB3
|
||||||
//------------------------------ GPIO <EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -------------------------------//
|
//------------------------------ GPIO -------------------------------//
|
||||||
|
|
||||||
#define GPIOA_OUTPUT() GPIOA->ODR = 0xFFFF;
|
#define GPIOA_OUTPUT() GPIOA->ODR = 0xFFFF;
|
||||||
#define GPIOA_L_DEF() GPIOA->CRL = 0x08888888; /* Ai7 K2 xxx xxx xxx xxx xxx xxx */
|
#define GPIOA_L_DEF() GPIOA->CRL = 0x08888888; /* Ai7 K2 xxx xxx xxx xxx xxx xxx */
|
||||||
@@ -59,7 +54,7 @@
|
|||||||
#define GPIOB_L_DEF() GPIOB->CRL = 0x44838800; /* SDA SCL It1 Po It2 xxx Ai9 Ai8 */
|
#define GPIOB_L_DEF() GPIOB->CRL = 0x44838800; /* SDA SCL It1 Po It2 xxx Ai9 Ai8 */
|
||||||
#define GPIOB_H_DEF() GPIOB->CRH = 0x88888888; /* xxx xxx xxx xxx xxx xxx xxx xxx */
|
#define GPIOB_H_DEF() GPIOB->CRH = 0x88888888; /* xxx xxx xxx xxx xxx xxx xxx xxx */
|
||||||
|
|
||||||
//--------------------------------- RCC <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---------------------------------//
|
//--------------------------------- RCC Clock Config ---------------------------------//
|
||||||
|
|
||||||
#define RCC_PLL_EN() RCC->CR |= 0x01000000;// PLL En
|
#define RCC_PLL_EN() RCC->CR |= 0x01000000;// PLL En
|
||||||
|
|
||||||
|
|||||||
@@ -335,7 +335,9 @@ void TIM2_ISR(void) {
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void TIM3_ISR(void) {
|
void TIM3_ISR(void) {
|
||||||
volatile static u8 heat_flag = 0; //heat flag == used to make the pin toggle
|
volatile static u8 heat_flag = 0; //heat flag == used to make the pin toggle
|
||||||
|
|
||||||
TIM_ClearITPendingBit(TIM3, TIM_IT_Update); // Clear interrupt flag
|
TIM_ClearITPendingBit(TIM3, TIM_IT_Update); // Clear interrupt flag
|
||||||
|
|
||||||
if (gTimeOut > 0)
|
if (gTimeOut > 0)
|
||||||
gTimeOut--;
|
gTimeOut--;
|
||||||
if (gMs_timeout > 0)
|
if (gMs_timeout > 0)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ struct _pid {
|
|||||||
s16 actualtemp; //Actual current temp of the tip
|
s16 actualtemp; //Actual current temp of the tip
|
||||||
s16 err; //Error term
|
s16 err; //Error term
|
||||||
s16 err_last; //last error term
|
s16 err_last; //last error term
|
||||||
u32 ht_time; //
|
s32 ht_time; //
|
||||||
u16 kp, ki, kd; //Constants for the PID Controller
|
u16 kp, ki, kd; //Constants for the PID Controller
|
||||||
s32 integral; //
|
s32 integral; //
|
||||||
} pid;
|
} pid;
|
||||||
@@ -135,7 +135,7 @@ u16 Pid_Realize(s16 temp) {
|
|||||||
pid.actualtemp = temp;
|
pid.actualtemp = temp;
|
||||||
pid.err = pid.settemp - pid.actualtemp; //
|
pid.err = pid.settemp - pid.actualtemp; //
|
||||||
|
|
||||||
if (pid.err >= 500)
|
if (pid.err >= 500)//error is > 50 degrees
|
||||||
index = 0;
|
index = 0;
|
||||||
else {
|
else {
|
||||||
index = 1;
|
index = 1;
|
||||||
@@ -143,7 +143,7 @@ u16 Pid_Realize(s16 temp) {
|
|||||||
}
|
}
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
if (pid.settemp < pid.actualtemp) {
|
if (pid.settemp < pid.actualtemp) {//cooling down
|
||||||
d_err = pid.actualtemp - pid.settemp;
|
d_err = pid.actualtemp - pid.settemp;
|
||||||
if (d_err > 20) {
|
if (d_err > 20) {
|
||||||
pid.integral = 0; //
|
pid.integral = 0; //
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
/********************* (C) COPYRIGHT 2015 e-Design Co.,Ltd. ********************
|
|
||||||
File Name : Flash.c
|
|
||||||
Version : Author : bure
|
|
||||||
*******************************************************************************/
|
|
||||||
#include "APP_Version.h"
|
|
||||||
#include "Flash.h"
|
|
||||||
#include "Bios.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
Function: FLASH_Prog
|
|
||||||
Description: Programs the data into the system flash at the specified address
|
|
||||||
*******************************************************************************/
|
|
||||||
u8 FLASH_Prog(u32 Address, u16 Data) {
|
|
||||||
if (FLASH_WaitForLastOperation(WAIT_TIMES) != FLASH_TIMEOUT)
|
|
||||||
FLASH_ClearFlag(
|
|
||||||
FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);
|
|
||||||
return FLASH_ProgramHalfWord(Address, Data);
|
|
||||||
}
|
|
||||||
/*******************************************************************************
|
|
||||||
Function: FLASH_Erase
|
|
||||||
Description: Erases a page of flash
|
|
||||||
Inputs: Starting address for the page to erase
|
|
||||||
*******************************************************************************/
|
|
||||||
void FLASH_Erase(u32 Address) {
|
|
||||||
if (Address % FLASH_PAGE == 0) { // FLASH Page start (1K/Page)
|
|
||||||
if (FLASH_WaitForLastOperation(WAIT_TIMES) != FLASH_TIMEOUT) //wait for last op to finish
|
|
||||||
FLASH_ClearFlag(
|
|
||||||
FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);
|
|
||||||
FLASH_ErasePage(Address); // FLASH Page erase
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/********************************* END OF FILE ******************************/
|
|
||||||
@@ -27,64 +27,38 @@ u32 gKey_in;
|
|||||||
u8 gLongkey_flag = 0;
|
u8 gLongkey_flag = 0;
|
||||||
u8 gAlarm_type = 1;
|
u8 gAlarm_type = 1;
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Get_CalFlag
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ȡУ״̬
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:NULL
|
|
||||||
<20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>:У״̬<D7B4><CCAC>־
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
u32 Get_CalFlag(void) {
|
u32 Get_CalFlag(void) {
|
||||||
return gCalib_flag;
|
return gCalib_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Get_gKey
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>״̬
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:NULL
|
|
||||||
<20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>:<3A><><EFBFBD><EFBFBD>״̬
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
u32 Get_gKey(void) {
|
u32 Get_gKey(void) {
|
||||||
return gKey_in;
|
return gKey_in;
|
||||||
}
|
}
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Set_gKey
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD>ð<EFBFBD><C3B0><EFBFBD>״̬
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:Ҫ<><D2AA><EFBFBD>õİ<C3B5><C4B0><EFBFBD>״̬
|
|
||||||
<20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>:NULL
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void Set_gKey(u32 key) {
|
void Set_gKey(u32 key) {
|
||||||
gKey_in = key;
|
gKey_in = key;
|
||||||
}
|
}
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Set_LongKeyFlag
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:0 :<3A><><EFBFBD><EFBFBD><EFBFBD>Գ<EFBFBD><D4B3><EFBFBD><EFBFBD><EFBFBD> 1: <20><><EFBFBD>Գ<EFBFBD><D4B3><EFBFBD>
|
|
||||||
<20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>:NULL
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void Set_LongKeyFlag(u32 flag) {
|
void Set_LongKeyFlag(u32 flag) {
|
||||||
gLongkey_flag = flag;
|
gLongkey_flag = flag;
|
||||||
}
|
}
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Get_AlarmType
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:NULL
|
|
||||||
<20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
0:<3A><><EFBFBD><EFBFBD>
|
|
||||||
1:sensor - err
|
|
||||||
2:<3A><><EFBFBD><EFBFBD>
|
|
||||||
3:<3A><>ѹ
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
u8 Get_AlarmType(void) {
|
u8 Get_AlarmType(void) {
|
||||||
return gAlarm_type;
|
return gAlarm_type;
|
||||||
}
|
}
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Set_AlarmType
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
0:<3A><><EFBFBD><EFBFBD>
|
|
||||||
1:sen - err
|
|
||||||
2:<3A><><EFBFBD><EFBFBD>
|
|
||||||
3:<3A><>ѹ
|
|
||||||
<20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>:NULL
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void Set_AlarmType(u8 type) {
|
void Set_AlarmType(u8 type) {
|
||||||
gAlarm_type = type;
|
gAlarm_type = type;
|
||||||
@@ -107,7 +81,7 @@ int Read_Vb(u8 flag) {
|
|||||||
gAlarm_type = HIGH_VOLTAGE;
|
gAlarm_type = HIGH_VOLTAGE;
|
||||||
return H_ALARM; //<2F><><EFBFBD><EFBFBD>3500
|
return H_ALARM; //<2F><><EFBFBD><EFBFBD>3500
|
||||||
}
|
}
|
||||||
tmp = (tmp * 10 / 144); //<2F><>ѹvb = 3.3 * 85 *ad / 40950
|
tmp = (tmp * 10 / 144); //<2F><>ѹvb = 3.3 * 85 *ad / 40950 -> In X10 voltage
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
if (i == 2) {
|
if (i == 2) {
|
||||||
@@ -126,10 +100,7 @@ int Read_Vb(u8 flag) {
|
|||||||
return (i + 1);
|
return (i + 1);
|
||||||
}
|
}
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Scan_Key
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD>(50msÿ<73><C3BF>)
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:NULL
|
|
||||||
<20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>:NULL
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void Scan_Key(void) {
|
void Scan_Key(void) {
|
||||||
static u32 p_cnt = 0, key_statuslast = 0;
|
static u32 p_cnt = 0, key_statuslast = 0;
|
||||||
@@ -143,11 +114,11 @@ void Scan_Key(void) {
|
|||||||
if (key_state == 0)
|
if (key_state == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gLongkey_flag == 1) { //LongKey_flag :<3A><><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
if (gLongkey_flag == 1) { //LongKey_flag -> we are looking for a long press or a quick press
|
||||||
if (key_statuslast == key_state) {
|
if (key_statuslast == key_state) {
|
||||||
p_cnt++;
|
p_cnt++;
|
||||||
if (p_cnt > 21)
|
if (p_cnt > 21)
|
||||||
Set_gKey(KEY_CN | key_state); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
Set_gKey(KEY_CN | key_state);
|
||||||
} else {
|
} else {
|
||||||
p_cnt = 0;
|
p_cnt = 0;
|
||||||
key_statuslast = key_state;
|
key_statuslast = key_state;
|
||||||
@@ -162,10 +133,7 @@ void Scan_Key(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Get_SlAvg
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:avg_data ƽ<><C6BD><EFBFBD><EFBFBD>ADֵ
|
|
||||||
<20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>:<3A><><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
u32 Get_SlAvg(u32 avg_data) {
|
u32 Get_SlAvg(u32 avg_data) {
|
||||||
static u32 sum_avg = 0;
|
static u32 sum_avg = 0;
|
||||||
@@ -200,13 +168,13 @@ u32 Get_AvgAd(void) {
|
|||||||
This is read by turning off the heater
|
This is read by turning off the heater
|
||||||
Then read the output of the op-amp that is connected across the connections
|
Then read the output of the op-amp that is connected across the connections
|
||||||
*/
|
*/
|
||||||
static u32 ad_sum = 0;
|
u32 ad_sum = 0;
|
||||||
static u32 max = 0, min = 5000;
|
u32 max = 0, min = 5000;
|
||||||
u32 ad_value, avg_data, slide_data = 0;
|
u32 ad_value, avg_data;
|
||||||
|
|
||||||
Set_HeatingTime(0); //set the remaining time to zero
|
Set_HeatingTime(0); //set the remaining time to zero
|
||||||
HEAT_OFF(); //heater must be off
|
HEAT_OFF(); //heater must be off
|
||||||
Delay_HalfMs(25); //wait for the heater to time out
|
Delay_HalfMs(50); //wait for the heater to time out
|
||||||
gMeas_cnt = 10; //how many measurements to make
|
gMeas_cnt = 10; //how many measurements to make
|
||||||
|
|
||||||
while (gMeas_cnt > 0) {
|
while (gMeas_cnt > 0) {
|
||||||
@@ -221,14 +189,12 @@ u32 Get_AvgAd(void) {
|
|||||||
ad_sum = ad_sum - max - min; //remove the two outliers
|
ad_sum = ad_sum - max - min; //remove the two outliers
|
||||||
avg_data = ad_sum / 8; //take the average
|
avg_data = ad_sum / 8; //take the average
|
||||||
|
|
||||||
slide_data = Get_SlAvg(avg_data);
|
return Get_SlAvg(avg_data);
|
||||||
ad_sum = 0;
|
|
||||||
min = 5000;
|
|
||||||
max = 0;
|
|
||||||
}
|
}
|
||||||
gMeas_cnt--;
|
gMeas_cnt--;
|
||||||
}
|
}
|
||||||
return slide_data; //gSlide_data;
|
return 0; //should never ever hit here
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@@ -311,10 +277,7 @@ void Zero_Calibration(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Get_Temp
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>ȶ<EFBFBD><C8B6>¶<EFBFBD>,<2C><><EFBFBD><EFBFBD>AD<41><44><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
|
||||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:wk_temp <20><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
|
||||||
<20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>:ʵ<><CAB5><EFBFBD>¶<EFBFBD>
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
s16 Get_Temp(s16 wk_temp) {
|
s16 Get_Temp(s16 wk_temp) {
|
||||||
int ad_value, cool_tmp, compensation = 0;
|
int ad_value, cool_tmp, compensation = 0;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include "Bios.h"
|
#include "Bios.h"
|
||||||
#include "I2C.h"
|
#include "I2C.h"
|
||||||
#include "Flash.h"
|
|
||||||
#include "MMA8652FC.h"
|
#include "MMA8652FC.h"
|
||||||
#include "UI.h"
|
#include "UI.h"
|
||||||
#include "Oled.h"
|
#include "Oled.h"
|
||||||
|
|||||||
@@ -720,7 +720,7 @@ void Print_Integer(s32 data, u8 posi) {
|
|||||||
char str[8];
|
char str[8];
|
||||||
|
|
||||||
Clear_Screen();
|
Clear_Screen();
|
||||||
sprintf(str, "%d", data);
|
sprintf(str, "%ld", data);
|
||||||
Display_Str(posi, str);
|
Display_Str(posi, str);
|
||||||
}
|
}
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user