Skip to content

Commit d5a4349

Browse files
authored
Update main.cc
1 parent 145ce56 commit d5a4349

File tree

1 file changed

+11
-7
lines changed
  • arc_design_contest/2021/HUST_SmartMeter/src

1 file changed

+11
-7
lines changed

arc_design_contest/2021/HUST_SmartMeter/src/main.cc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,16 @@ float EnvTemp_High_Threshold=30;
7676
uint8_t sta;
7777
//**********************************************************
7878

79-
void PrintEvent(sample_data_node_ptr front){
79+
void PrintEvent(sample_data_node_ptr front)
80+
{
8081
for(uint32_t i=0;i<WIN_LENGTH;i++){
8182
front = front->next_ptr;
8283
EMBARC_PRINTF("%d,%d,%d\n",front->IRMS,-(front->active_power),-(front->reactive_power));
8384
}
8485
}
8586

86-
bool connect_cloud(){
87+
bool connect_cloud()
88+
{
8789
EMBARC_PRINTF("Connnecting to the cloud platform...\r\n");
8890
board_delay_ms(500, 1);
8991
//检查ESP8266
@@ -119,7 +121,8 @@ bool connect_cloud(){
119121
return CONNECT_OK;
120122
}
121123

122-
int main(void){
124+
int main(void)
125+
{
123126
//************************初始化*************************
124127
EMBARC_PRINTF(" Initialize begin!\r\n");
125128
if(ATT7053_init(att7053, 1200000)!=E_OK){
@@ -171,7 +174,7 @@ int main(void){
171174
uint8_t DDS_State = (app_state & (uint8_t)1)==1;
172175
uint8_t Fan_State = (app_state & (uint8_t)2)==2;
173176
uint8_t cnt_2s=0;
174-
if(++cnt_2s>=20){//
177+
if(++cnt_2s>=20){
175178
cnt_2s=0;
176179
sprintf(mqtt_message,
177180
"{\"method\":\"thing.service.property.set\",\"id\":\"123\",\"params\":{\
@@ -189,7 +192,7 @@ int main(void){
189192
Fan_State,
190193
DDS_State
191194
);
192-
EMBARC_PRINTF("massage=%s\r\n",mqtt_message);
195+
EMBARC_PRINTF("massage=%s\r\n",mqtt_message);
193196
_mqtt.PublishData("/sys/a1HJbdW0mhX/ARC01/thing/event/property/post",mqtt_message,0);
194197
}
195198
if(UART_RX_STA){
@@ -198,14 +201,15 @@ int main(void){
198201
memset(_mqtt.rxbuf,0,_mqtt.rxlen);
199202
UART_RX_STA = 0;
200203
}
201-
////********************************************************************************************
204+
//********************************************************************************************
202205
data_buffer = data_buffer->next_ptr;
203206
num++;
204207
msleep(100);
205208
}
206209
}
207210

208-
float string2float(char *buf){
211+
float string2float(char *buf)
212+
{
209213
float res=0;
210214
int postive=1;
211215
if((*buf)=='-'){

0 commit comments

Comments
 (0)