mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-04-06 03:58:02 +08:00
Allow switching camera in QR code reader.
This commit is contained in:
parent
271fa1c838
commit
089f7ca782
@ -316,6 +316,14 @@ static void remoteinstall_qr_update(ui_view* view, void* data, float* progress,
|
||||
return;
|
||||
}
|
||||
|
||||
if(hidKeysDown() & KEY_X) {
|
||||
remoteinstall_qr_stop_capture(installData);
|
||||
|
||||
installData->captureInfo.camera = installData->captureInfo.camera == CAMERA_OUTER ? CAMERA_INNER : CAMERA_OUTER;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(!installData->capturing) {
|
||||
Result capRes = task_capture_cam(&installData->captureInfo);
|
||||
if(R_FAILED(capRes)) {
|
||||
@ -397,6 +405,8 @@ static void remoteinstall_scan_qr_code() {
|
||||
data->captureInfo.width = QR_IMAGE_WIDTH;
|
||||
data->captureInfo.height = QR_IMAGE_HEIGHT;
|
||||
|
||||
data->captureInfo.camera = CAMERA_OUTER;
|
||||
|
||||
data->captureInfo.finished = true;
|
||||
|
||||
data->qrContext = quirc_new();
|
||||
@ -424,7 +434,7 @@ static void remoteinstall_scan_qr_code() {
|
||||
|
||||
data->tex = screen_allocate_free_texture();
|
||||
|
||||
info_display("QR Code Install", "B: Return", false, data, remoteinstall_qr_update, remoteinstall_qr_draw_top);
|
||||
info_display("QR Code Install", "B: Return, X: Switch Camera", false, data, remoteinstall_qr_update, remoteinstall_qr_draw_top);
|
||||
}
|
||||
|
||||
static void remoteinstall_manually_enter_urls_onresponse(ui_view* view, void* data, SwkbdButton button, const char* response) {
|
||||
|
@ -25,13 +25,15 @@ static void task_capture_cam_thread(void* arg) {
|
||||
u16* buffer = (u16*) calloc(1, bufferSize);
|
||||
if(buffer != NULL) {
|
||||
if(R_SUCCEEDED(res = camInit())) {
|
||||
if(R_SUCCEEDED(res = CAMU_SetSize(SELECT_OUT1, SIZE_CTR_TOP_LCD, CONTEXT_A))
|
||||
&& R_SUCCEEDED(res = CAMU_SetOutputFormat(SELECT_OUT1, OUTPUT_RGB_565, CONTEXT_A))
|
||||
&& R_SUCCEEDED(res = CAMU_SetFrameRate(SELECT_OUT1, FRAME_RATE_30))
|
||||
&& R_SUCCEEDED(res = CAMU_SetNoiseFilter(SELECT_OUT1, true))
|
||||
&& R_SUCCEEDED(res = CAMU_SetAutoExposure(SELECT_OUT1, true))
|
||||
&& R_SUCCEEDED(res = CAMU_SetAutoWhiteBalance(SELECT_OUT1, true))
|
||||
&& R_SUCCEEDED(res = CAMU_Activate(SELECT_OUT1))) {
|
||||
int cam = data->camera == CAMERA_OUTER ? SELECT_OUT1 : SELECT_IN1;
|
||||
|
||||
if(R_SUCCEEDED(res = CAMU_SetSize(cam, SIZE_CTR_TOP_LCD, CONTEXT_A))
|
||||
&& R_SUCCEEDED(res = CAMU_SetOutputFormat(cam, OUTPUT_RGB_565, CONTEXT_A))
|
||||
&& R_SUCCEEDED(res = CAMU_SetFrameRate(cam, FRAME_RATE_30))
|
||||
&& R_SUCCEEDED(res = CAMU_SetNoiseFilter(cam, true))
|
||||
&& R_SUCCEEDED(res = CAMU_SetAutoExposure(cam, true))
|
||||
&& R_SUCCEEDED(res = CAMU_SetAutoWhiteBalance(cam, true))
|
||||
&& R_SUCCEEDED(res = CAMU_Activate(cam))) {
|
||||
u32 transferUnit = 0;
|
||||
|
||||
if(R_SUCCEEDED(res = CAMU_GetBufferErrorInterruptEvent(&events[EVENT_BUFFER_ERROR], PORT_CAM1))
|
||||
|
@ -81,10 +81,16 @@ typedef struct titledb_info_s {
|
||||
meta_info meta;
|
||||
} titledb_info;
|
||||
|
||||
typedef enum capture_cam_camera_e {
|
||||
CAMERA_OUTER,
|
||||
CAMERA_INNER
|
||||
} capture_cam_camera;
|
||||
|
||||
typedef struct capture_cam_data_s {
|
||||
u16* buffer;
|
||||
s16 width;
|
||||
s16 height;
|
||||
capture_cam_camera camera;
|
||||
|
||||
Handle mutex;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user