fix ui glitch, disallow charging ctrl on uno

This commit is contained in:
Rick Lan
2020-03-29 00:06:08 +10:00
parent f6c54e6af1
commit 22a2cbb730
2 changed files with 23 additions and 12 deletions
+13 -10
View File
@@ -216,17 +216,20 @@ def thermald_thread():
if ts - ts_last_update_vars >= 10.:
modified = dp_get_last_modified()
if dp_last_modified != modified:
dragon_charging_ctrl = True if params.get('DragonChargingCtrl', encoding='utf8') == "1" else False
dp_temp_monitor = True if params.get('DragonEnableTempMonitor', encoding='utf8') == "1" else False
if dragon_charging_ctrl:
try:
dragon_to_discharge = int(params.get('DragonCharging', encoding='utf8'))
except (TypeError, ValueError):
dragon_to_discharge = 70
try:
dragon_to_charge = int(params.get('DragonDisCharging', encoding='utf8'))
except (TypeError, ValueError):
dragon_to_charge = 60
if not is_uno:
dragon_charging_ctrl = True if params.get('DragonChargingCtrl', encoding='utf8') == "1" else False
if dragon_charging_ctrl:
try:
dragon_to_discharge = int(params.get('DragonCharging', encoding='utf8'))
except (TypeError, ValueError):
dragon_to_discharge = 70
try:
dragon_to_charge = int(params.get('DragonDisCharging', encoding='utf8'))
except (TypeError, ValueError):
dragon_to_charge = 60
else:
dragon_charging_ctrl = False
dp_last_modified = modified
ts_last_update_vars = ts
+10 -2
View File
@@ -1,6 +1,14 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "common/util.h"
#include "common/timing.h"
#include "common/swaglog.h"
#include "common/touch.h"
#include "common/visionimg.h"
#include "common/params.h"
#include "ui.hpp"
static void ui_draw_sidebar_background(UIState *s, bool hasSidebar) {
@@ -57,7 +65,7 @@ static void ui_draw_sidebar_ip_addr(UIState *s, bool hasSidebar) {
const int network_ip_x = hasSidebar ? 58 : -(sbr_w);
const int network_ip_y = 255;
char network_ip_str[20];
char network_ip_str[15];
snprintf(network_ip_str, sizeof(network_ip_str), "%s", s->scene.ipAddr);
nvgFillColor(s->vg, COLOR_WHITE);
nvgFontSize(s->vg, 32);
@@ -91,7 +99,7 @@ static void ui_draw_sidebar_battery_icon(UIState *s, bool hasSidebar) {
static void ui_draw_sidebar_battery_text(UIState *s, bool hasSidebar) {
const int battery_img_h = 36;
const int battery_img_w = 76;
const int battery_img_w = 96;
const int battery_img_x = hasSidebar ? 150 : -(sbr_w);
const int battery_img_y = 305;