Skip to content

Commit

Permalink
anniversary bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ClimbSnail committed Jun 5, 2022
1 parent c6a6f30 commit 3401f28
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 14 deletions.
2 changes: 2 additions & 0 deletions HoloCubic_Firmware/src/HoloCubic_AIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ void setup()
app_controller->app_install(&anniversary_app);
app_controller->app_install(&heartbeat_app, APP_TYPE_BACKGROUND);

// 自启动APP
app_controller->app_auto_start();
// 优先显示屏幕 加快视觉上的开机时间
app_controller->main_process(&mpu.action_info);

Expand Down
4 changes: 2 additions & 2 deletions HoloCubic_Firmware/src/app/heartbeat/heartbeat.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef APP_EXAMPLE_H
#define APP_EXAMPLE_H
#ifndef APP_HEARTBEAT_H
#define APP_HEARTBEAT_H

#include "sys/interface.h"

Expand Down
4 changes: 2 additions & 2 deletions HoloCubic_Firmware/src/app/heartbeat/heartbeat_gui.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef APP_EXAMPLE_GUI_H
#define APP_EXAMPLE_GUI_H
#ifndef APP_HEARTBEAT_GUI_H
#define APP_HEARTBEAT_GUI_H

#ifdef __cplusplus
extern "C"
Expand Down
14 changes: 12 additions & 2 deletions HoloCubic_Firmware/src/app/server/web_setting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ String file_size(int bytes)
"<label class=\"input\"><span>屏幕方向 (0~5可选)</span><input type=\"text\"name=\"rotation\"value=\"%s\"></label>" \
"<label class=\"input\"><span>操作方向(0~15可选)</span><input type=\"text\"name=\"mpu_order\"value=\"%s\"></label>" \
"<label class=\"input\"><span>MPU6050自动校准</span><input class=\"radio\" type=\"radio\" value=\"0\" name=\"auto_calibration_mpu\" %s>关闭<input class=\"radio\" type=\"radio\" value=\"1\" name=\"auto_calibration_mpu\" %s>开启</label>" \
"<label class=\"input\"><span>开机自启的APP名字</span><input type=\"text\"name=\"auto_start_app\"value=\"%s\"></label>" \
"</label><input class=\"btn\" type=\"submit\" name=\"submit\" value=\"保存\"></form>"

#define RGB_SETTING "<form method=\"GET\" action=\"saveRgbConf\">" \
Expand Down Expand Up @@ -202,6 +203,7 @@ void sys_setting()
char max_brightness[32];
char time[32];
char auto_calibration_mpu[32];
char auto_start_app[32];
// 读取数据
app_controller->send_to(SERVER_APP_NAME, "AppCtrl", APP_MESSAGE_READ_CFG,
NULL, NULL);
Expand All @@ -225,21 +227,25 @@ void sys_setting()
(void *)"time", time);
app_controller->send_to(SERVER_APP_NAME, "AppCtrl", APP_MESSAGE_GET_PARAM,
(void *)"auto_calibration_mpu", auto_calibration_mpu);
app_controller->send_to(SERVER_APP_NAME, "AppCtrl", APP_MESSAGE_GET_PARAM,
(void *)"auto_start_app", auto_start_app);
SysUtilConfig cfg = app_controller->sys_cfg;
// 主要为了处理启停MPU自动校准的单选框
if (0 == cfg.auto_calibration_mpu)
{
sprintf(buf, SYS_SETTING,
ssid_0, password_0,
power_mode, backLight, rotation,
mpu_order, "checked=\"checked\"", "");
mpu_order, "checked=\"checked\"", "",
auto_start_app);
}
else
{
sprintf(buf, SYS_SETTING,
ssid_0, password_0,
power_mode, backLight, rotation,
mpu_order, "", "checked=\"checked\"");
mpu_order, "", "checked=\"checked\"",
auto_start_app);
}
webpage = buf;
Send_HTML(webpage);
Expand Down Expand Up @@ -474,6 +480,10 @@ void saveSysConf(void)
APP_MESSAGE_SET_PARAM,
(void *)"auto_calibration_mpu",
(void *)server.arg("auto_calibration_mpu").c_str());
app_controller->send_to(SERVER_APP_NAME, "AppCtrl",
APP_MESSAGE_SET_PARAM,
(void *)"auto_start_app",
(void *)server.arg("auto_start_app").c_str());
// 持久化数据
app_controller->send_to(SERVER_APP_NAME, "AppCtrl", APP_MESSAGE_WRITE_CFG,
NULL, NULL);
Expand Down
3 changes: 2 additions & 1 deletion HoloCubic_Firmware/src/common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef COMMON_H
#define COMMON_H

#define AIO_VERSION "2.0.7"
#define AIO_VERSION "2.0.8"

#include "Arduino.h"
#include "driver/rgb_led.h"
Expand Down Expand Up @@ -57,6 +57,7 @@ struct SysUtilConfig
String password_1;
String ssid_2;
String password_2;
String auto_start_app; // 开机自启的APP名字
uint8_t power_mode; // 功耗模式(0为节能模式 1为性能模式)
uint8_t backLight; // 屏幕亮度(1-100)
uint8_t rotation; // 屏幕旋转方向
Expand Down
17 changes: 16 additions & 1 deletion HoloCubic_Firmware/src/sys/app_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void AppController::init(void)
app_control_gui_init();
appList[0] = new APP_OBJ();
appList[0]->app_image = &app_loading;
appList[0]->app_name = "None";
appList[0]->app_name = "Loading...";
appTypeList[0] = APP_TYPE_REAL_TIME;
app_control_display_scr(appList[cur_app_index]->app_image,
appList[cur_app_index]->app_name,
Expand Down Expand Up @@ -114,6 +114,21 @@ int AppController::app_uninstall(const APP_OBJ *app)
return 0;
}

int AppController::app_auto_start()
{
// APP自启动
int index = this->getAppIdxByName(sys_cfg.auto_start_app.c_str());
if (index < 0)
{
// 没找到相关的APP
return 0;
}
// 进入自启动的APP
app_exit_flag = 1; // 进入app, 如果已经在
cur_app_index = index;
(*(appList[cur_app_index]->app_init))(this); // 执行APP初始化
}

int AppController::main_process(ImuAction *act_info)
{
if (ACTIVE_TYPE::UNKNOWN != act_info->active)
Expand Down
1 change: 1 addition & 0 deletions HoloCubic_Firmware/src/sys/app_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class AppController
~AppController();
void init(void);
void Display(void); // 显示接口
int app_auto_start();
// 将APP注册到app_controller中
int app_install(APP_OBJ *app,
APP_TYPE app_type = APP_TYPE_REAL_TIME);
Expand Down
17 changes: 15 additions & 2 deletions HoloCubic_Firmware/src/sys/app_controller_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ void AppController::read_config(SysUtilConfig *cfg)
cfg->rotation = 4; // 屏幕旋转方向
cfg->auto_calibration_mpu = 1; // 是否自动校准陀螺仪 0关闭自动校准 1打开自动校准
cfg->mpu_order = 0; // 操作方向
cfg->auto_start_app = "none"; // 无指定开机自启APP
this->write_config(cfg);
}
else
{
// 解析数据
char *param[11] = {0};
analyseParam(info, 11, param);
char *param[12] = {0};
analyseParam(info, 12, param);
cfg->ssid_0 = param[0];
cfg->password_0 = param[1];
cfg->ssid_1 = param[2];
Expand All @@ -40,6 +41,7 @@ void AppController::read_config(SysUtilConfig *cfg)
cfg->rotation = atol(param[8]);
cfg->auto_calibration_mpu = atol(param[9]);
cfg->mpu_order = atol(param[10]);
cfg->auto_start_app = param[11]; // 开机自启APP的name
}
}

Expand Down Expand Up @@ -73,6 +75,9 @@ void AppController::write_config(SysUtilConfig *cfg)
memset(tmp, 0, 25);
snprintf(tmp, 25, "%u\n", cfg->mpu_order);
w_data += tmp;

w_data = w_data + cfg->auto_start_app + "\n";

g_flashCfg.writeFile(APP_CTRL_CONFIG_PATH, w_data.c_str());

// 立即生效相关配置
Expand Down Expand Up @@ -336,6 +341,10 @@ void AppController::deal_config(APP_MESSAGE_TYPE type,
{
snprintf(value, 32, "%u", rgb_cfg.time);
}
else if (!strcmp(key, "auto_start_app"))
{
snprintf(value, 32, "%s", sys_cfg.auto_start_app.c_str());
}
}
break;
case APP_MESSAGE_SET_PARAM:
Expand Down Expand Up @@ -400,6 +409,10 @@ void AppController::deal_config(APP_MESSAGE_TYPE type,
{
rgb_cfg.time = atol(value);
}
else if (!strcmp(key, "auto_start_app"))
{
sys_cfg.auto_start_app = value;
}
}
break;
case APP_MESSAGE_READ_CFG:
Expand Down
1 change: 1 addition & 0 deletions HoloCubic_Firmware/src/sys/app_controller_gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void display_app_scr_init(const void *src_img_path, const char *app_name)
lv_obj_align(pre_app_name, pre_app_image, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);

lv_scr_load_anim(app_scr, LV_SCR_LOAD_ANIM_NONE, 300, 300, false);
ANIEND
// lv_scr_load(app_scr); // 加载屏幕
}

Expand Down
1 change: 1 addition & 0 deletions HoloCubic_Firmware/src/sys/app_controller_gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern "C"

#include "lvgl.h"
extern const lv_img_dsc_t app_loading;
extern const lv_img_dsc_t app_loading1;

#ifdef __cplusplus
} /* extern "C" */
Expand Down
16 changes: 12 additions & 4 deletions 硬件版本说明.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,22 @@ v1.0和v2.0版本均在稚晖君原版的基础上修改的。v1.0和v2.0适配
v1.0的左右加固座偏宽,v2.0优化了这个缺陷。

#### 屏幕板
适配所有的主板。以下为版本说明。推荐打样1.2mm厚度。
适配所有的主板。以下为版本说明。推荐打样1.2mm厚度。_注:文件夹中放有排错使用的点位电压图"Metal(DCDC)屏幕板参考电压"_
##### v1.2
是在稚晖君原版的基础上增加了一路LDO 662K来分摊主板上LDO的电流压力,大大降低了发热以及重启的问题。可不做任何改动替换稚晖君原版,只适合Metal版本外壳(包括原版Metal外壳)。
##### v1.5
在v1.2基础上修改PCB布局,使之布局接近与Naive版本,便于查通用问题。
在v1.2基础上修改PCB布局,使之布局接近与Naive版本,便于查通用问题。_注:文件夹中有稚晖军原版屏幕板的点位电压图"Naive原版屏幕板参考电压(Ver4.1).png",因为电路与改版的接近,可具有一定的参考价值_
##### v2.0
屏幕板上在原有LDO方案增加了DC-DC方案(两方案共存,需要二选一焊接)。
* 如果焊上ME6211则与v1.5版本屏幕板几乎一致(注v1.5版本使用的LDO是662K).
* 如果焊接了DC-DC电路,请将主板的LDO去掉(屏幕板会自动给主板供电),则完全解决发热问题(可用于跑满血状态的AIO固件,体验最好)。

#### 主板
本主板是基于稚晖军原naive主板修改,pin2pin将LP2992更换为ME6211,更换TF卡槽(便宜易买)。本主板适用于本文件夹中所有的屏幕板以及外壳。注:所有Metal主板都与Naive主板一模一样。推荐打样1.2mm厚度。
各版本主板都是基于稚晖军原naive主板修改。注:所有Metal主板都与Naive主板一模一样。推荐打样1.2mm厚度。文件里的主板适用于本文件夹中所有的屏幕板以及外壳。
##### v1.3
pin2pin将LP2992更换为ME6211。WS2818 5050更换成了侧灯的WS2812 4020版本。(注:此版本不推荐制作,请优先做V2.0版本的主板)
##### v2.0
pin2pin将LP2992更换为ME6211。更换TF卡槽(便宜易买)。但为了保证与原版尽可能一致,RGB灯依旧使用原版的WS2812 5050


# Naive版本
Expand All @@ -42,4 +46,8 @@ Naive磁吸底座(下部镂空款)增加了TF卡槽部分的开窗,方便
* 如果焊接了DC-DC电路,请将主板的LDO去掉(屏幕板会自动给主板供电),则完全解决发热问题(可用于跑满血状态的AIO固件,体验最好)。

#### 主板
本主板是基于稚晖军原naive主板修改,pin2pin将LP2992更换为ME6211,更换TF卡槽(便宜易买)。本主板适用于本文件夹中所有的屏幕板以及外壳。注:所有Metal主板都与Naive主板一模一样。推荐打样1.2mm厚度。
各版本主板都是基于稚晖军原naive主板修改。注:所有Metal主板都与Naive主板一模一样。推荐打样1.2mm厚度。文件里的主板适用于本文件夹中所有的屏幕板以及外壳。
##### v1.3
pin2pin将LP2992更换为ME6211。WS2818 5050更换成了侧灯的WS2812 4020版本。(注:此版本不推荐制作,请优先做V2.0版本的主板)
##### v2.0
pin2pin将LP2992更换为ME6211。更换TF卡槽(便宜易买)。但为了保证与原版尽可能一致,RGB灯依旧使用原版的WS2812 5050

0 comments on commit 3401f28

Please sign in to comment.