mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-23 23:12:04 +08:00
Merge branch 'devel-en' into devel-zht
This commit is contained in:
@@ -79,6 +79,7 @@ Supported Cars
|
||||
| Honda | CR-V 2015-16 | Touring | Yes | Yes | 25mph<sup>1</sup>| 12mph | Nidec |
|
||||
| Honda | CR-V 2017-19 | Honda Sensing | Yes | Stock | 0mph | 12mph | Bosch |
|
||||
| Honda | CR-V Hybrid 2017-2019 | Honda Sensing | Yes | Stock | 0mph | 12mph | Bosch |
|
||||
| Honda | Fit 2018-19 | Honda Sensing | Yes | Yes | 25mph<sup>1</sup>| 12mph | Inverted Nidec |
|
||||
| Honda | Odyssey 2018-19 | Honda Sensing | Yes | Yes | 25mph<sup>1</sup>| 0mph | Inverted Nidec |
|
||||
| Honda | Passport 2019 | All | Yes | Yes | 25mph<sup>1</sup>| 12mph | Inverted Nidec |
|
||||
| Honda | Pilot 2016-18 | Honda Sensing | Yes | Yes | 25mph<sup>1</sup>| 12mph | Nidec |
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <GLES3/gl3.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#include "nanovg.h"
|
||||
#define NANOVG_GLES3_IMPLEMENTATION
|
||||
#include "nanovg_gl.h"
|
||||
#include "nanovg_gl_utils.h"
|
||||
|
||||
#include "framebuffer.h"
|
||||
#include "spinner.h"
|
||||
|
||||
// external resources linked in
|
||||
extern const unsigned char _binary_opensans_semibold_ttf_start[];
|
||||
extern const unsigned char _binary_opensans_semibold_ttf_end[];
|
||||
|
||||
extern const unsigned char _binary_img_spinner_track_png_start[];
|
||||
extern const unsigned char _binary_img_spinner_track_png_end[];
|
||||
|
||||
extern const unsigned char _binary_img_spinner_comma_png_start[];
|
||||
extern const unsigned char _binary_img_spinner_comma_png_end[];
|
||||
|
||||
int spin(int argc, char** argv) {
|
||||
int err;
|
||||
|
||||
const char* spintext = NULL;
|
||||
if (argc == 1) {
|
||||
spintext = argv[0];
|
||||
} else if (argc >= 2) {
|
||||
spintext = argv[1];
|
||||
}
|
||||
|
||||
// spinner
|
||||
int fb_w, fb_h;
|
||||
EGLDisplay display;
|
||||
EGLSurface surface;
|
||||
FramebufferState *fb = framebuffer_init("spinner", 0x00001000, false,
|
||||
&display, &surface, &fb_w, &fb_h);
|
||||
assert(fb);
|
||||
|
||||
NVGcontext *vg = nvgCreateGLES3(NVG_ANTIALIAS | NVG_STENCIL_STROKES);
|
||||
assert(vg);
|
||||
|
||||
int font = nvgCreateFontMem(vg, "Bold", (unsigned char*)_binary_opensans_semibold_ttf_start, _binary_opensans_semibold_ttf_end-_binary_opensans_semibold_ttf_start, 0);
|
||||
assert(font >= 0);
|
||||
|
||||
int spinner_img = nvgCreateImageMem(vg, 0, (unsigned char*)_binary_img_spinner_track_png_start, _binary_img_spinner_track_png_end - _binary_img_spinner_track_png_start);
|
||||
assert(spinner_img >= 0);
|
||||
int spinner_img_s = 360;
|
||||
int spinner_img_x = ((fb_w/2)-(spinner_img_s/2));
|
||||
int spinner_img_y = 260;
|
||||
int spinner_img_xc = (fb_w/2);
|
||||
int spinner_img_yc = (fb_h/2)-100;
|
||||
int spinner_comma_img = nvgCreateImageMem(vg, 0, (unsigned char*)_binary_img_spinner_comma_png_start, _binary_img_spinner_comma_png_end - _binary_img_spinner_comma_png_start);
|
||||
assert(spinner_comma_img >= 0);
|
||||
|
||||
for (int cnt = 0; ; cnt++) {
|
||||
glClearColor(0.1, 0.1, 0.1, 1.0);
|
||||
glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
nvgBeginFrame(vg, fb_w, fb_h, 1.0f);
|
||||
|
||||
// background
|
||||
nvgBeginPath(vg);
|
||||
NVGpaint bg = nvgLinearGradient(vg, fb_w, 0, fb_w, fb_h,
|
||||
nvgRGBA(0, 0, 0, 175), nvgRGBA(0, 0, 0, 255));
|
||||
nvgFillPaint(vg, bg);
|
||||
nvgRect(vg, 0, 0, fb_w, fb_h);
|
||||
nvgFill(vg);
|
||||
|
||||
// spin track
|
||||
nvgSave(vg);
|
||||
nvgTranslate(vg, spinner_img_xc, spinner_img_yc);
|
||||
nvgRotate(vg, (3.75*M_PI * cnt/120.0));
|
||||
nvgTranslate(vg, -spinner_img_xc, -spinner_img_yc);
|
||||
NVGpaint spinner_imgPaint = nvgImagePattern(vg, spinner_img_x, spinner_img_y,
|
||||
spinner_img_s, spinner_img_s, 0, spinner_img, 0.6f);
|
||||
nvgBeginPath(vg);
|
||||
nvgFillPaint(vg, spinner_imgPaint);
|
||||
nvgRect(vg, spinner_img_x, spinner_img_y, spinner_img_s, spinner_img_s);
|
||||
nvgFill(vg);
|
||||
nvgRestore(vg);
|
||||
|
||||
// comma
|
||||
NVGpaint comma_imgPaint = nvgImagePattern(vg, spinner_img_x, spinner_img_y,
|
||||
spinner_img_s, spinner_img_s, 0, spinner_comma_img, 1.0f);
|
||||
nvgBeginPath(vg);
|
||||
nvgFillPaint(vg, comma_imgPaint);
|
||||
nvgRect(vg, spinner_img_x, spinner_img_y, spinner_img_s, spinner_img_s);
|
||||
nvgFill(vg);
|
||||
|
||||
// message
|
||||
if (spintext) {
|
||||
nvgTextAlign(vg, NVG_ALIGN_CENTER | NVG_ALIGN_TOP);
|
||||
nvgFontSize(vg, 96.0f);
|
||||
nvgText(vg, fb_w/2, (fb_h*2/3)+24, spintext, NULL);
|
||||
}
|
||||
|
||||
nvgEndFrame(vg);
|
||||
eglSwapBuffers(display, surface);
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef COMMON_SPINNER_H
|
||||
#define COMMON_SPINNER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int spin(int argc, char** argv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -29,7 +29,6 @@ def main(gctx=None):
|
||||
dragon_enable_mixplorer = True if params.get('DragonEnableMixplorer') == "1" else False
|
||||
dragon_boot_tomtom = True if params.get("DragonBootTomTom") == "1" else False
|
||||
dragon_boot_autonavi = True if params.get("DragonBootAutonavi") == "1" else False
|
||||
dragon_greypanda_mode = True if params.get('DragonGreyPandaMode') == "1" else False
|
||||
tomtom_is_running = False
|
||||
autonavi_is_running = False
|
||||
mixplorer_is_running = False
|
||||
@@ -40,46 +39,40 @@ def main(gctx=None):
|
||||
frame = 0
|
||||
start_delay = None
|
||||
stop_delay = None
|
||||
high_accuracy_mode_enabled = False
|
||||
|
||||
put_nonblocking('DragonRunTomTom', '0')
|
||||
put_nonblocking('DragonRunAutonavi', '0')
|
||||
put_nonblocking('DragonRunMixplorer', '0')
|
||||
|
||||
# we want to disable all app when boot
|
||||
system("pm disable %s ; pm disable %s ; pm disable %s" % (tomtom, autonavi, mixplorer))
|
||||
system("pm disable %s" % tomtom)
|
||||
system("pm disable %s" % autonavi)
|
||||
system("pm disable %s" % mixplorer)
|
||||
|
||||
thermal_sock = messaging.sub_sock(service_list['thermal'].port)
|
||||
|
||||
while dragon_enable_tomtom or dragon_enable_autonavi or dragon_enable_mixplorer:
|
||||
if (dragon_enable_tomtom or dragon_enable_autonavi) and not high_accuracy_mode_enabled:
|
||||
if dragon_greypanda_mode:
|
||||
system("settings put secure location_providers_allowed -gps,network,wifi")
|
||||
system("settings put secure location_providers_allowed +gps")
|
||||
else:
|
||||
system("settings put secure location_providers_allowed +gps,network,wifi")
|
||||
high_accuracy_mode_enabled = True
|
||||
|
||||
# allow user to manually start/stop app
|
||||
if dragon_enable_tomtom:
|
||||
status = params.get('DragonRunTomTom')
|
||||
if not status == "0":
|
||||
tomtom_is_running = exec_app(status, tomtom, tomtom_main)
|
||||
put_nonblocking('DragonRunTomTom', '0')
|
||||
params.put('DragonRunTomTom', '0')
|
||||
manual_tomtom = status != "0"
|
||||
|
||||
if dragon_enable_autonavi:
|
||||
status = params.get('DragonRunAutonavi')
|
||||
if not status == "0":
|
||||
autonavi_is_running = exec_app(status, autonavi, autonavi_main)
|
||||
put_nonblocking('DragonRunAutonavi', '0')
|
||||
params.put('DragonRunAutonavi', '0')
|
||||
manual_autonavi = status != "0"
|
||||
|
||||
if dragon_enable_mixplorer:
|
||||
status = params.get('DragonRunMixplorer')
|
||||
if not status == "0":
|
||||
mixplorer_is_running = exec_app(status, mixplorer, mixplorer_main)
|
||||
put_nonblocking('DragonRunMixplorer', '0')
|
||||
params.put('DragonRunMixplorer', '0')
|
||||
|
||||
# if manual control is set, we do not allow any of the auto actions
|
||||
auto_tomtom = not manual_tomtom and dragon_enable_tomtom and dragon_boot_tomtom
|
||||
@@ -142,7 +135,8 @@ def main(gctx=None):
|
||||
|
||||
def exec_app(status, app, app_main):
|
||||
if status == "1":
|
||||
system("pm enable %s && am start -n %s/%s" % (app, app, app_main))
|
||||
system("pm enable %s" % app)
|
||||
system("am start -n %s/%s" % (app, app_main))
|
||||
return True
|
||||
if status == "-1":
|
||||
system("pm disable %s" % app)
|
||||
|
||||
+1
-1
@@ -1525,7 +1525,7 @@ static void ui_draw_infobar(UIState *s) {
|
||||
|
||||
nvgBeginPath(s->vg);
|
||||
nvgRoundedRect(s->vg, rect_x, rect_y, rect_w, rect_h, 15);
|
||||
nvgFillColor(s->vg, nvgRGBA(0, 0, 0, 100));
|
||||
nvgFillColor(s->vg, nvgRGBA(0, 0, 0, 150));
|
||||
nvgFill(s->vg);
|
||||
|
||||
nvgFontSize(s->vg, hasSidebar? 40:50);
|
||||
|
||||
Reference in New Issue
Block a user