Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Long press on left pushbutton to trigger automatic web update

  • Loading branch information...
commit a431f9dc66566d2f7ec724cb34175767bd1db21a 1 parent 6413391
@sbourdeauducq sbourdeauducq authored
View
2  src/about.c
@@ -32,7 +32,7 @@ static void close_callback(mtk_event *e, void *arg)
static void flash_callback(mtk_event *e, void *arg)
{
- open_flash_window();
+ open_flash_window(0);
}
#define FLASH_OFFSET_MAC_ADDRESS (0x002200E0)
View
2  src/cp.c
@@ -155,7 +155,7 @@ static void cp_callback(mtk_event *e, void *arg)
open_rsswall_window();
break;
case CP_ITEM_WEBUPDATE:
- open_flash_window();
+ open_flash_window(0);
break;
case CP_ITEM_EDITOR:
View
4 src/flash.c
@@ -638,7 +638,7 @@ void init_flash()
file_dlg = create_filedialog("Open flash image", 0, "", flash_filedialog_ok_callback, NULL, NULL, NULL);
}
-void open_flash_window()
+void open_flash_window(int automatic)
{
if(w_open) return;
w_open = 1;
@@ -646,4 +646,6 @@ void open_flash_window()
flash_progress = 0;
update_progress();
mtk_cmd(appid, "w.open()");
+ if(automatic)
+ run_callback(NULL, (void *)ARG_WEB_UPDATE);
}
View
4 src/flash.h
@@ -1,6 +1,6 @@
/*
* Flickernoise
- * Copyright (C) 2010 Sebastien Bourdeauducq
+ * Copyright (C) 2010, 2011 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,6 +19,6 @@
#define __FLASH_H
void init_flash();
-void open_flash_window();
+void open_flash_window(int automatic);
#endif /* __FLASH_H */
View
13 src/guirender.c
@@ -1,6 +1,6 @@
/*
* Flickernoise
- * Copyright (C) 2010 Sebastien Bourdeauducq
+ * Copyright (C) 2010, 2011 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,10 +46,14 @@ static int stop_appid;
static void input_cb(mtk_event *e, int count);
+static int guirender_running;
static guirender_stop_callback callback;
-static void stop()
+void guirender_stop()
{
+ if(!guirender_running) return;
+ guirender_running = 0;
+
renderer_stop();
resmgr_release(RESOURCE_SAMPLER);
@@ -77,7 +81,7 @@ static void input_cb(mtk_event *e, int count)
for(i=0;i<count;i++) {
if(wait_release != -1) {
if((e[i].type == EVENT_TYPE_RELEASE) && (e[i].press.code == wait_release)) {
- stop();
+ guirender_stop();
mtk_input(&e[i+1], count-i-1);
return;
}
@@ -95,6 +99,9 @@ static void input_cb(mtk_event *e, int count)
int guirender(int appid, struct patch *p, guirender_stop_callback cb)
{
+ if(guirender_running) return 0;
+ guirender_running = 1;
+
if(!resmgr_acquire_multiple("renderer",
RESOURCE_AUDIO,
RESOURCE_DMX_IN,
View
3  src/guirender.h
@@ -1,6 +1,6 @@
/*
* Flickernoise
- * Copyright (C) 2010 Sebastien Bourdeauducq
+ * Copyright (C) 2010, 2011 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,5 +23,6 @@
typedef void (*guirender_stop_callback)();
int guirender(int appid, struct patch *p, guirender_stop_callback cb);
+void guirender_stop();
#endif /* __GUIRENDER_H */
View
17 src/shortcuts.c
@@ -27,8 +27,12 @@
#include "sysconfig.h"
#include "sysettings.h"
#include "fb.h"
+#include "guirender.h"
+#include "flash.h"
static int ctrl, alt;
+static int f9_pressed;
+static rtems_interval f9_press_time;
static int f10_pressed;
static rtems_interval f10_press_time;
@@ -53,6 +57,13 @@ static void shortcuts_callback(mtk_event *e, int count)
{
int i;
+
+ /* Handle long press on F9/left pushbutton */
+ if(f9_pressed
+ && ((rtems_clock_get_ticks_since_boot() - f9_press_time) > 200)) {
+ guirender_stop();
+ open_flash_window(1);
+ }
/* Handle long press on F10/middle pushbutton */
if(f10_pressed
&& ((rtems_clock_get_ticks_since_boot() - f10_press_time) > 200))
@@ -70,6 +81,10 @@ static void shortcuts_callback(mtk_event *e, int count)
switch_resolution();
else if(ctrl && (e[i].press.code == MTK_KEY_F2))
fbgrab(NULL);
+ else if(e[i].press.code == MTK_KEY_F9) {
+ f9_pressed = 1;
+ f9_press_time = rtems_clock_get_ticks_since_boot();
+ }
else if(e[i].press.code == MTK_KEY_F10) {
f10_pressed = 1;
f10_press_time = rtems_clock_get_ticks_since_boot();
@@ -79,6 +94,8 @@ static void shortcuts_callback(mtk_event *e, int count)
ctrl = 0;
else if(e[i].release.code == MTK_KEY_LEFTALT)
alt = 0;
+ else if(e[i].release.code == MTK_KEY_F9)
+ f9_pressed = 0;
else if(e[i].release.code == MTK_KEY_F10)
f10_pressed = 0;
}
Please sign in to comment.
Something went wrong with that request. Please try again.