显示信息
This commit is contained in:
1 parent
05afd19e80
commit
c9633041ab
3 files changed
+47
-2
No files matched your search
@@ -15,6 +15,9 @@
|
|||||||
#include "freemaster_client.h"
|
#include "freemaster_client.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <lvgl/ui_data_labels.h>
|
||||||
|
|
||||||
|
int Work_Program_DATA=0;
|
||||||
#include "INI/config.h"
|
#include "INI/config.h"
|
||||||
#include "data/Variable.h"
|
#include "data/Variable.h"
|
||||||
|
|
||||||
@@ -102,6 +105,14 @@ static void screen_w_w_event_handler (lv_event_t *e)
|
|||||||
switch (code) {
|
switch (code) {
|
||||||
case LV_EVENT_CLICKED:
|
case LV_EVENT_CLICKED:
|
||||||
{
|
{
|
||||||
|
if(Work_Program_DATA)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -256,3 +256,33 @@ void update_led_o(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前时间字符串,格式:2025/01/25 13:55:11
|
||||||
|
* @param buf 输出缓冲区
|
||||||
|
* @param size 缓冲区大小(建议 >= 22)
|
||||||
|
* @return 成功返回 buf,失败返回 NULL
|
||||||
|
*/
|
||||||
|
char* get_time_str(char *buf, size_t size)
|
||||||
|
{
|
||||||
|
time_t now;
|
||||||
|
struct tm *tm_info;
|
||||||
|
|
||||||
|
if (buf == RT_NULL || size < 22)
|
||||||
|
return RT_NULL;
|
||||||
|
|
||||||
|
now = rt_time_get(); // 获取当前时间戳(秒)
|
||||||
|
tm_info = localtime(&now); // 转为本地时间
|
||||||
|
|
||||||
|
if (tm_info == RT_NULL)
|
||||||
|
{
|
||||||
|
rt_strncpy(buf, "invalid", size - 1);
|
||||||
|
buf[size - 1] = '\0';
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式:2025/01/25 13:55:11 (注意两个空格)
|
||||||
|
strftime(buf, size, "%Y/%m/%d %H:%M:%S", tm_info);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
@@ -10,10 +10,12 @@
|
|||||||
#ifndef APPLICATIONS_LVGL_UI_DATA_LABELS_H_
|
#ifndef APPLICATIONS_LVGL_UI_DATA_LABELS_H_
|
||||||
#define APPLICATIONS_LVGL_UI_DATA_LABELS_H_
|
#define APPLICATIONS_LVGL_UI_DATA_LABELS_H_
|
||||||
|
|
||||||
#define select_WorkOrder_DATA "SELECT WorkOrder,Dyelot,ReDye,\
|
#define select_WorkOrder_DATA "SELECT ProgramName,Time,\
|
||||||
ProgramName,StartTime,EndTime,Time,lock,State,ColorName,\
|
StartTime,EndTime,WorkOrder,Dyelot,ReDye,lock,State,ColorName,\
|
||||||
ColorNumber,Client,ClothWeight,ClothSpecies,BathRatio,Total,\
|
ColorNumber,Client,ClothWeight,ClothSpecies,BathRatio,Total,\
|
||||||
Remark,USER FROM WorkOrder WHERE State=101 AND EndTime >"
|
Remark,USER FROM WorkOrder WHERE State=101 AND EndTime >"
|
||||||
|
#define select_Program_DATA "SELECT ProgramName,Time FROM ProgramName"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char WorkOrder[32];
|
char WorkOrder[32];
|
||||||
char Dyelot[32]; // 单号
|
char Dyelot[32]; // 单号
|
||||||
@@ -82,4 +84,6 @@ void update_io_labels(void);
|
|||||||
void update_led_i(void);
|
void update_led_i(void);
|
||||||
void update_led_o(void);
|
void update_led_o(void);
|
||||||
|
|
||||||
|
char* get_time_str(char *buf, size_t size);
|
||||||
|
|
||||||
#endif /* APPLICATIONS_LVGL_UI_DATA_LABELS_H_ */
|
#endif /* APPLICATIONS_LVGL_UI_DATA_LABELS_H_ */
|
||||||
Reference in new issue
Block a user