sh: add videocapture function (x² key) in debug mode
This commit is contained in:
parent
af8bacd271
commit
b1e39d3ab6
|
@ -49,6 +49,8 @@ static bool timeout_popup(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
static bool videocapture = false;
|
||||
|
||||
void pe_debug_init(void)
|
||||
{
|
||||
usb_interface_t const *intf[] = { &usb_ff_bulk, NULL };
|
||||
|
@ -110,4 +112,17 @@ void pe_debug_screenshot(void)
|
|||
usb_fxlink_screenshot(true);
|
||||
}
|
||||
|
||||
void pe_debug_toggle_videocapture(void)
|
||||
{
|
||||
videocapture = !videocapture;
|
||||
}
|
||||
|
||||
void pe_debug_run_videocapture(void)
|
||||
{
|
||||
if(videocapture) {
|
||||
usb_open_wait();
|
||||
usb_fxlink_videocapture(true);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* PE_DEBUG */
|
||||
|
|
|
@ -33,12 +33,20 @@ void pe_debug_kmalloc(char const *prefix);
|
|||
/* Take a screenshot. */
|
||||
void pe_debug_screenshot(void);
|
||||
|
||||
/* Toggle video capture. */
|
||||
void pe_debug_toggle_videocapture(void);
|
||||
|
||||
/* Send a video capture frame if video capture is enabled. */
|
||||
void pe_debug_run_videocapture(void);
|
||||
|
||||
#if !PE_DEBUG
|
||||
#define PE_DEBUG_NOOP do {} while(0)
|
||||
#define pe_debug_init(...) PE_DEBUG_NOOP
|
||||
#define pe_debug_printf(...) PE_DEBUG_NOOP
|
||||
#define pe_debug_kmalloc(...) PE_DEBUG_NOOP
|
||||
#define pe_debug_screenshot(...) PE_DEBUG_NOOP
|
||||
#define pe_debug_init(...) PE_DEBUG_NOOP
|
||||
#define pe_debug_printf(...) PE_DEBUG_NOOP
|
||||
#define pe_debug_kmalloc(...) PE_DEBUG_NOOP
|
||||
#define pe_debug_screenshot(...) PE_DEBUG_NOOP
|
||||
#define pe_debug_toggle_videocapture(...) PE_DEBUG_NOOP
|
||||
#define pe_debug_run_videocapture(...) PE_DEBUG_NOOP
|
||||
#endif
|
||||
|
||||
#endif /* __PYTHONEXTRA_DEBUG_H */
|
||||
|
|
|
@ -130,6 +130,14 @@ static bool async_filter(key_event_t ev)
|
|||
return false;
|
||||
}
|
||||
|
||||
#if PE_DEBUG
|
||||
if(ev.key == KEY_SQUARE) {
|
||||
if(ev.type == KEYEV_DOWN)
|
||||
pe_debug_toggle_videocapture();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -181,6 +189,7 @@ void pe_draw(void)
|
|||
DIMAGE_NONE);
|
||||
#endif
|
||||
dupdate();
|
||||
pe_debug_run_videocapture();
|
||||
}
|
||||
|
||||
//=== Application control functions ===//
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "py/runtime.h"
|
||||
#include "py/obj.h"
|
||||
#include "debug.h"
|
||||
#include <gint/display.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -72,6 +73,7 @@ static mp_obj_t show_screen(void)
|
|||
void pe_enter_graphics_mode(void);
|
||||
pe_enter_graphics_mode();
|
||||
dupdate();
|
||||
pe_debug_run_videocapture();
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
// considered relevant for high-level Python development).
|
||||
//---
|
||||
|
||||
#include "debug.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/objtuple.h"
|
||||
#include "objgintimage.h"
|
||||
|
@ -229,6 +230,7 @@ STATIC mp_obj_t modgint_dupdate(void)
|
|||
{
|
||||
pe_enter_graphics_mode();
|
||||
dupdate();
|
||||
pe_debug_run_videocapture();
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue