mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-13 05:28:14 +08:00
OK
This commit is contained in:
@@ -70,7 +70,7 @@ int application_start(void)
|
|||||||
int i;
|
int i;
|
||||||
os_log("Start %s",VERSION);
|
os_log("Start %s",VERSION);
|
||||||
|
|
||||||
char main_num=0;
|
//char main_num=0;
|
||||||
OSStatus err = kNoErr;
|
OSStatus err = kNoErr;
|
||||||
|
|
||||||
// Create mico system context and read application's config data from flash
|
// Create mico system context and read application's config data from flash
|
||||||
@@ -151,7 +151,7 @@ int application_start(void)
|
|||||||
require_noerr(err, exit);
|
require_noerr(err, exit);
|
||||||
PowerInit();
|
PowerInit();
|
||||||
|
|
||||||
uint32_t power_last = 0xffffffff;
|
//uint32_t power_last = 0xffffffff;
|
||||||
AppHttpdStart(); // start http server thread
|
AppHttpdStart(); // start http server thread
|
||||||
char* power_buf = malloc(128);
|
char* power_buf = malloc(128);
|
||||||
if (!power_buf) goto exit;
|
if (!power_buf) goto exit;
|
||||||
|
|||||||
@@ -8,11 +8,8 @@
|
|||||||
#include "user_function.h"
|
#include "user_function.h"
|
||||||
#include "user_power.h"
|
#include "user_power.h"
|
||||||
|
|
||||||
mico_timer_t power_timer;
|
|
||||||
|
|
||||||
PowerRecord power_record = { 1, { 0 } };
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
mico_timer_t power_timer;
|
||||||
static uint32_t clock_count_last = 0;
|
static uint32_t clock_count_last = 0;
|
||||||
static uint32_t clock_count = 0; //纳秒数
|
static uint32_t clock_count = 0; //纳秒数
|
||||||
static uint32_t timer_count = 0; //一秒定时器
|
static uint32_t timer_count = 0; //一秒定时器
|
||||||
@@ -49,8 +46,9 @@ static void PowerTimerHandler(void* arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
uint32_t p_count = 0;
|
|
||||||
|
|
||||||
|
uint32_t p_count = 0;
|
||||||
|
PowerRecord power_record = { 1,{ 0 } };
|
||||||
char power_record_str[1101] = { 0 };
|
char power_record_str[1101] = { 0 };
|
||||||
|
|
||||||
void SetPowerRecord(PowerRecord* pr, uint32_t pw)
|
void SetPowerRecord(PowerRecord* pr, uint32_t pw)
|
||||||
@@ -78,7 +76,7 @@ float n_1s = 0; //功率中断次数
|
|||||||
mico_time_t t_x = 0; //当前秒*1000
|
mico_time_t t_x = 0; //当前秒*1000
|
||||||
mico_time_t past_ms = 0; //系统运行的毫秒数
|
mico_time_t past_ms = 0; //系统运行的毫秒数
|
||||||
mico_time_t rest_x_ms = 0; //距离当前秒走过的毫秒数
|
mico_time_t rest_x_ms = 0; //距离当前秒走过的毫秒数
|
||||||
mico_time_t rest_y_ms = 0; //距离下一秒差的秒数
|
mico_time_t rest_y_ms = 0; //距离下一秒差的毫秒数
|
||||||
|
|
||||||
static void PowerIrqHandler(void* arg)
|
static void PowerIrqHandler(void* arg)
|
||||||
{
|
{
|
||||||
@@ -111,7 +109,7 @@ static void PowerIrqHandler(void* arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//一般不会出现这个情况, 所以不管了...哈哈哈~
|
//一般不会出现这种情况, 所以不管了...哈哈哈~
|
||||||
SetPowerRecord(&power_record, 123456);
|
SetPowerRecord(&power_record, 123456);
|
||||||
SetPowerRecord(&power_record, past_ms);
|
SetPowerRecord(&power_record, past_ms);
|
||||||
SetPowerRecord(&power_record, t_x);
|
SetPowerRecord(&power_record, t_x);
|
||||||
@@ -125,7 +123,7 @@ void PowerInit(void)
|
|||||||
|
|
||||||
MicoGpioInitialize(POWER, INPUT_PULL_UP);
|
MicoGpioInitialize(POWER, INPUT_PULL_UP);
|
||||||
//mico_rtos_init_timer(&power_timer, 1000, PowerTimerHandler, NULL);
|
//mico_rtos_init_timer(&power_timer, 1000, PowerTimerHandler, NULL);
|
||||||
mico_rtos_start_timer(&power_timer);
|
//mico_rtos_start_timer(&power_timer);
|
||||||
|
|
||||||
MicoGpioEnableIRQ(POWER, IRQ_TRIGGER_FALLING_EDGE, PowerIrqHandler, NULL);
|
MicoGpioEnableIRQ(POWER, IRQ_TRIGGER_FALLING_EDGE, PowerIrqHandler, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user