test LeadTimeCounter maybe ok

This commit is contained in:
YiChin
2020-05-21 12:43:53 +08:00
parent 323dc2cf77
commit 8b94eaa6dd
5 changed files with 16 additions and 6 deletions
@@ -29,7 +29,7 @@
*/
#define BOARD_7C8C
#define BOARD_ANGUS
typedef struct _formula{
@@ -5,8 +5,8 @@
#define VERSION_DATE_YEAR 20
#define VERSION_DATE_MONTH 5
#define VERSION_DATE_DAY 21
#define VERSION_DATE_HOUR 11
#define VERSION_DATE_MINUTE 3
#define VERSION_DATE_HOUR 12
#define VERSION_DATE_MINUTE 43
// this is NOT the version hash !!
// it's the last version hash
@@ -665,6 +665,7 @@ static bool NotifyReset;
static bool ADCReset;
static bool EliteWorkReset;
static bool LeadTimeReset;
static bool firstNotifyFlag;
//static bool NotifyReady = false;
static void InitFlag();
@@ -103,7 +103,7 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
GPT.DeltaGptimerCounter = GPT.GptimerCounter - GPT.GptimerCounter0;
GPT.GptimerCounter0 = GPT.GptimerCounter;
//INSTRUCTION.NotifyRate = 1000;
//INSTRUCTION.NotifyRate = 500;
if(EliteWorkReset){
if(INSTRUCTION.eliteFxn == ZT_CURVE || INSTRUCTION.eliteFxn == VT_CURVE || INSTRUCTION.eliteFxn == IT_CURVE){
@@ -116,12 +116,16 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
GPT.LeadTimeCounter = GPT.LeadTimeCounter + GPT.DeltaGptimerCounter;
if(LeadTimeReset && GPT.LeadTimeCounter <= 100){
if(LeadTimeReset && GPT.LeadTimeCounter <= 2000){
VscanReset = true;
testcount += 1;
InputNotify(NOTIFY_IMPEDANCE, testcount);
}else{
if(firstNotifyFlag){
GPT.NotifyCounter = INSTRUCTION.NotifyRate - 20;
firstNotifyFlag = false;
}
LeadTimeReset = false;
InputNotify(NOTIFY_IMPEDANCE, testcount);
@@ -169,6 +173,9 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
if(GPT.NotifyCounter >= INSTRUCTION.NotifyRate){
GPT.NotifyCounter -= INSTRUCTION.NotifyRate;
notify_flag = true;
if(VscanReset){
notify_flag = false;
}
if(notify_flag){
SendNotify();
notify_flag = false;
@@ -322,8 +329,8 @@ static void InitEliteGPtimer() {
// GPT.DeltaGptimerCounter = 0;
GPT.SampleRate_counter = INSTRUCTION.SampleRate - 10;
// GPT.StepTimeCounter = 0;
GPT.NotifyCounter = INSTRUCTION.NotifyRate - 110;
GPT.VscanRateCounter = INSTRUCTION.VscanRate - 1;
firstNotifyFlag = true;
}
static void InitEliteFlag() {
@@ -562,6 +562,8 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
elite_gptimer_start();
// Application main loops
GPT.GptimerCounter0 = GPT.GptimerCounter;
for (;;) {
// Waits for a signal to the semaphore associated with the calling thread.
// Note that the semaphore associated with a thread is signaled when a