mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-26 03:39:58 -07:00
Formatting & New updated IR
This commit is contained in:
@@ -28,22 +28,22 @@ static const uint16_t MAX_LENGTH[3][4][MAX_QRCODE_VERSION] = {
|
||||
// Numeric
|
||||
{41, 77, 127, 187, 255, 322, 370, 461, 552, 652, 772}, // Low
|
||||
{34, 63, 101, 149, 202, 255, 293, 365, 432, 513, 604}, // Medium
|
||||
{27, 48, 77, 111, 144, 178, 207, 259, 312, 364, 427}, // Quartile
|
||||
{17, 34, 58, 82, 106, 139, 154, 202, 235, 288, 331}, // High
|
||||
{27, 48, 77, 111, 144, 178, 207, 259, 312, 364, 427}, // Quartile
|
||||
{17, 34, 58, 82, 106, 139, 154, 202, 235, 288, 331}, // High
|
||||
},
|
||||
{
|
||||
// Alphanumeric
|
||||
{25, 47, 77, 114, 154, 195, 224, 279, 335, 395, 468}, // Low
|
||||
{20, 38, 61, 90, 122, 154, 178, 221, 262, 311, 366}, // Medium
|
||||
{16, 29, 47, 67, 87, 108, 125, 157, 189, 221, 259}, // Quartile
|
||||
{10, 20, 35, 50, 64, 84, 93, 122, 143, 174, 200}, // High
|
||||
{20, 38, 61, 90, 122, 154, 178, 221, 262, 311, 366}, // Medium
|
||||
{16, 29, 47, 67, 87, 108, 125, 157, 189, 221, 259}, // Quartile
|
||||
{10, 20, 35, 50, 64, 84, 93, 122, 143, 174, 200}, // High
|
||||
},
|
||||
{
|
||||
// Binary
|
||||
{17, 32, 53, 78, 106, 134, 154, 192, 230, 271, 321}, // Low
|
||||
{14, 26, 42, 62, 84, 106, 122, 152, 180, 213, 251}, // Medium
|
||||
{11, 20, 32, 46, 60, 74, 86, 108, 130, 151, 177}, // Quartile
|
||||
{7, 14, 24, 34, 44, 58, 64, 84, 98, 119, 137}, // High
|
||||
{14, 26, 42, 62, 84, 106, 122, 152, 180, 213, 251}, // Medium
|
||||
{11, 20, 32, 46, 60, 74, 86, 108, 130, 151, 177}, // Quartile
|
||||
{7, 14, 24, 34, 44, 58, 64, 84, 98, 119, 137}, // High
|
||||
},
|
||||
};
|
||||
|
||||
@@ -72,12 +72,17 @@ typedef struct {
|
||||
* @returns a character corresponding to the ecc level
|
||||
*/
|
||||
static char get_ecc_char(uint8_t ecc) {
|
||||
switch (ecc) {
|
||||
case 0: return 'L';
|
||||
case 1: return 'M';
|
||||
case 2: return 'Q';
|
||||
case 3: return 'H';
|
||||
default: return '?';
|
||||
switch(ecc) {
|
||||
case 0:
|
||||
return 'L';
|
||||
case 1:
|
||||
return 'M';
|
||||
case 2:
|
||||
return 'Q';
|
||||
case 3:
|
||||
return 'H';
|
||||
default:
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,12 +91,17 @@ static char get_ecc_char(uint8_t ecc) {
|
||||
* @returns a character corresponding to the mode
|
||||
*/
|
||||
static char get_mode_char(uint8_t mode) {
|
||||
switch (mode) {
|
||||
case 0: return 'N';
|
||||
case 1: return 'A';
|
||||
case 2: return 'B';
|
||||
case 3: return 'K';
|
||||
default: return '?';
|
||||
switch(mode) {
|
||||
case 0:
|
||||
return 'N';
|
||||
case 1:
|
||||
return 'A';
|
||||
case 2:
|
||||
return 'B';
|
||||
case 3:
|
||||
return 'K';
|
||||
default:
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,68 +124,108 @@ static void render_callback(Canvas* canvas, void* ctx) {
|
||||
uint8_t font_height = canvas_current_font_height(canvas);
|
||||
uint8_t width = canvas_width(canvas);
|
||||
uint8_t height = canvas_height(canvas);
|
||||
if (instance->loading) {
|
||||
canvas_draw_str_aligned(canvas, width / 2, height / 2, AlignCenter, AlignCenter, "Loading...");
|
||||
} else if (instance->qrcode) {
|
||||
if(instance->loading) {
|
||||
canvas_draw_str_aligned(
|
||||
canvas, width / 2, height / 2, AlignCenter, AlignCenter, "Loading...");
|
||||
} else if(instance->qrcode) {
|
||||
uint8_t size = instance->qrcode->size;
|
||||
uint8_t pixel_size = height / size;
|
||||
uint8_t top = (height - pixel_size * size) / 2;
|
||||
uint8_t left = ((instance->show_stats ? 65 : width) - pixel_size * size) / 2;
|
||||
for (uint8_t y = 0; y < size; y++) {
|
||||
for (uint8_t x = 0; x < size; x++) {
|
||||
if (qrcode_getModule(instance->qrcode, x, y)) {
|
||||
if (pixel_size == 1) {
|
||||
for(uint8_t y = 0; y < size; y++) {
|
||||
for(uint8_t x = 0; x < size; x++) {
|
||||
if(qrcode_getModule(instance->qrcode, x, y)) {
|
||||
if(pixel_size == 1) {
|
||||
canvas_draw_dot(canvas, left + x * pixel_size, top + y * pixel_size);
|
||||
} else {
|
||||
canvas_draw_box(canvas, left + x * pixel_size, top + y * pixel_size, pixel_size, pixel_size);
|
||||
canvas_draw_box(
|
||||
canvas,
|
||||
left + x * pixel_size,
|
||||
top + y * pixel_size,
|
||||
pixel_size,
|
||||
pixel_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (instance->show_stats) {
|
||||
if(instance->show_stats) {
|
||||
top = 10;
|
||||
left = 66;
|
||||
|
||||
FuriString* str = furi_string_alloc();
|
||||
|
||||
if (!instance->edit || instance->selected_idx == 0) {
|
||||
if(!instance->edit || instance->selected_idx == 0) {
|
||||
furi_string_printf(str, "Ver: %i", instance->set_version);
|
||||
canvas_draw_str(canvas, left + 5, top + font_height, furi_string_get_cstr(str));
|
||||
if (instance->selected_idx == 0) {
|
||||
canvas_draw_triangle(canvas, left, top + font_height / 2, font_height - 4, 4, CanvasDirectionLeftToRight);
|
||||
if(instance->selected_idx == 0) {
|
||||
canvas_draw_triangle(
|
||||
canvas,
|
||||
left,
|
||||
top + font_height / 2,
|
||||
font_height - 4,
|
||||
4,
|
||||
CanvasDirectionLeftToRight);
|
||||
}
|
||||
if (instance->edit) {
|
||||
if(instance->edit) {
|
||||
uint8_t arrow_left = left + 5 + canvas_string_width(canvas, "Ver: 8") / 2;
|
||||
canvas_draw_triangle(canvas, arrow_left, top, font_height - 4, 4, CanvasDirectionBottomToTop);
|
||||
canvas_draw_triangle(canvas, arrow_left, top + font_height + 1, font_height - 4, 4, CanvasDirectionTopToBottom);
|
||||
canvas_draw_triangle(
|
||||
canvas, arrow_left, top, font_height - 4, 4, CanvasDirectionBottomToTop);
|
||||
canvas_draw_triangle(
|
||||
canvas,
|
||||
arrow_left,
|
||||
top + font_height + 1,
|
||||
font_height - 4,
|
||||
4,
|
||||
CanvasDirectionTopToBottom);
|
||||
}
|
||||
}
|
||||
|
||||
if (!instance->edit || instance->selected_idx == 1) {
|
||||
if(!instance->edit || instance->selected_idx == 1) {
|
||||
furi_string_printf(str, "ECC: %c", get_ecc_char(instance->set_ecc));
|
||||
canvas_draw_str(canvas, left + 5, 2 * font_height + top + 2, furi_string_get_cstr(str));
|
||||
if (instance->selected_idx == 1) {
|
||||
canvas_draw_triangle(canvas, left, 3 * font_height / 2 + top + 2, font_height - 4, 4, CanvasDirectionLeftToRight);
|
||||
canvas_draw_str(
|
||||
canvas, left + 5, 2 * font_height + top + 2, furi_string_get_cstr(str));
|
||||
if(instance->selected_idx == 1) {
|
||||
canvas_draw_triangle(
|
||||
canvas,
|
||||
left,
|
||||
3 * font_height / 2 + top + 2,
|
||||
font_height - 4,
|
||||
4,
|
||||
CanvasDirectionLeftToRight);
|
||||
}
|
||||
if (instance->edit) {
|
||||
if(instance->edit) {
|
||||
uint8_t arrow_left = left + 5 + canvas_string_width(canvas, "ECC: H") / 2;
|
||||
canvas_draw_triangle(canvas, arrow_left, font_height + top + 2, font_height - 4, 4, CanvasDirectionBottomToTop);
|
||||
canvas_draw_triangle(canvas, arrow_left, 2 * font_height + top + 3, font_height - 4, 4, CanvasDirectionTopToBottom);
|
||||
canvas_draw_triangle(
|
||||
canvas,
|
||||
arrow_left,
|
||||
font_height + top + 2,
|
||||
font_height - 4,
|
||||
4,
|
||||
CanvasDirectionBottomToTop);
|
||||
canvas_draw_triangle(
|
||||
canvas,
|
||||
arrow_left,
|
||||
2 * font_height + top + 3,
|
||||
font_height - 4,
|
||||
4,
|
||||
CanvasDirectionTopToBottom);
|
||||
}
|
||||
}
|
||||
|
||||
if (!instance->edit) {
|
||||
if(!instance->edit) {
|
||||
furi_string_printf(str, "Mod: %c", get_mode_char(instance->qrcode->mode));
|
||||
canvas_draw_str(canvas, left + 5, 3 * font_height + top + 4, furi_string_get_cstr(str));
|
||||
canvas_draw_str(
|
||||
canvas, left + 5, 3 * font_height + top + 4, furi_string_get_cstr(str));
|
||||
}
|
||||
|
||||
furi_string_free(str);
|
||||
}
|
||||
} else {
|
||||
uint8_t margin = (height - font_height * 2) / 3;
|
||||
canvas_draw_str_aligned(canvas, width / 2, margin, AlignCenter, AlignTop, "Could not load qrcode.");
|
||||
if (instance->too_long) {
|
||||
canvas_draw_str_aligned(
|
||||
canvas, width / 2, margin, AlignCenter, AlignTop, "Could not load qrcode.");
|
||||
if(instance->too_long) {
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str(canvas, width / 2, margin * 2 + font_height, "Message is too long.");
|
||||
}
|
||||
@@ -192,7 +242,7 @@ static void render_callback(Canvas* canvas, void* ctx) {
|
||||
static void input_callback(InputEvent* input_event, void* ctx) {
|
||||
furi_assert(input_event);
|
||||
furi_assert(ctx);
|
||||
if (input_event->type == InputTypeShort) {
|
||||
if(input_event->type == InputTypeShort) {
|
||||
QRCodeApp* instance = ctx;
|
||||
furi_message_queue_put(instance->input_queue, input_event, 0);
|
||||
}
|
||||
@@ -205,9 +255,9 @@ static void input_callback(InputEvent* input_event, void* ctx) {
|
||||
*/
|
||||
static bool is_numeric(const char* str, uint16_t len) {
|
||||
furi_assert(str);
|
||||
while (len > 0) {
|
||||
while(len > 0) {
|
||||
char c = str[--len];
|
||||
if (c < '0' || c > '9') return false;
|
||||
if(c < '0' || c > '9') return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -219,19 +269,12 @@ static bool is_numeric(const char* str, uint16_t len) {
|
||||
*/
|
||||
static bool is_alphanumeric(const char* str, uint16_t len) {
|
||||
furi_assert(str);
|
||||
while (len > 0) {
|
||||
while(len > 0) {
|
||||
char c = str[--len];
|
||||
if (c >= '0' && c <= '9') continue;
|
||||
if (c >= 'A' && c <= 'Z') continue;
|
||||
if (c == ' '
|
||||
|| c == '$'
|
||||
|| c == '%'
|
||||
|| c == '*'
|
||||
|| c == '+'
|
||||
|| c == '-'
|
||||
|| c == '.'
|
||||
|| c == '/'
|
||||
|| c == ':')
|
||||
if(c >= '0' && c <= '9') continue;
|
||||
if(c >= 'A' && c <= 'Z') continue;
|
||||
if(c == ' ' || c == '$' || c == '%' || c == '*' || c == '+' || c == '-' || c == '.' ||
|
||||
c == '/' || c == ':')
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
@@ -277,8 +320,9 @@ static bool rebuild_qrcode(QRCodeApp* instance, uint8_t version, uint8_t ecc) {
|
||||
uint16_t len = strlen(cstr);
|
||||
instance->qrcode = qrcode_alloc(version);
|
||||
|
||||
int8_t res = qrcode_initBytes(instance->qrcode, instance->qrcode->modules, version, ecc, (uint8_t*)cstr, len);
|
||||
if (res != 0) {
|
||||
int8_t res = qrcode_initBytes(
|
||||
instance->qrcode, instance->qrcode->modules, version, ecc, (uint8_t*)cstr, len);
|
||||
if(res != 0) {
|
||||
FURI_LOG_E(TAG, "Could not create qrcode");
|
||||
|
||||
qrcode_free(instance->qrcode);
|
||||
@@ -300,11 +344,11 @@ static bool qrcode_load_string(QRCodeApp* instance, FuriString* str) {
|
||||
furi_assert(str);
|
||||
|
||||
furi_check(furi_mutex_acquire(instance->mutex, FuriWaitForever) == FuriStatusOk);
|
||||
if (instance->message) {
|
||||
if(instance->message) {
|
||||
furi_string_free(instance->message);
|
||||
instance->message = NULL;
|
||||
}
|
||||
if (instance->qrcode) {
|
||||
if(instance->qrcode) {
|
||||
qrcode_free(instance->qrcode);
|
||||
instance->qrcode = NULL;
|
||||
}
|
||||
@@ -319,15 +363,17 @@ static bool qrcode_load_string(QRCodeApp* instance, FuriString* str) {
|
||||
uint16_t len = strlen(cstr);
|
||||
|
||||
instance->message = furi_string_alloc_set(str);
|
||||
if (!instance->message) {
|
||||
if(!instance->message) {
|
||||
FURI_LOG_E(TAG, "Could not allocate message");
|
||||
break;
|
||||
}
|
||||
|
||||
// figure out the qrcode "mode"
|
||||
uint8_t mode = MODE_BYTE;
|
||||
if (is_numeric(cstr, len)) mode = MODE_NUMERIC;
|
||||
else if (is_alphanumeric(cstr, len)) mode = MODE_ALPHANUMERIC;
|
||||
if(is_numeric(cstr, len))
|
||||
mode = MODE_NUMERIC;
|
||||
else if(is_alphanumeric(cstr, len))
|
||||
mode = MODE_ALPHANUMERIC;
|
||||
|
||||
// Figure out the smallest qrcode version that'll fit all of the data -
|
||||
// we prefer the smallest version to maximize the pixel size of each
|
||||
@@ -336,11 +382,11 @@ static bool qrcode_load_string(QRCodeApp* instance, FuriString* str) {
|
||||
// number, so we'll add one later.
|
||||
uint8_t ecc = ECC_LOW;
|
||||
uint8_t version = 0;
|
||||
while (version < MAX_QRCODE_VERSION && MAX_LENGTH[mode][ecc][version] < len) {
|
||||
while(version < MAX_QRCODE_VERSION && MAX_LENGTH[mode][ecc][version] < len) {
|
||||
version++;
|
||||
}
|
||||
|
||||
if (version == MAX_QRCODE_VERSION) {
|
||||
if(version == MAX_QRCODE_VERSION) {
|
||||
instance->too_long = true;
|
||||
break;
|
||||
}
|
||||
@@ -350,13 +396,13 @@ static bool qrcode_load_string(QRCodeApp* instance, FuriString* str) {
|
||||
// above that ECC_LOW (0) works... don't forget to add one to that
|
||||
// version number...
|
||||
ecc = ECC_HIGH;
|
||||
while (MAX_LENGTH[mode][ecc][version] < len) {
|
||||
while(MAX_LENGTH[mode][ecc][version] < len) {
|
||||
ecc--;
|
||||
}
|
||||
version++;
|
||||
|
||||
// Build the qrcode
|
||||
if (!rebuild_qrcode(instance, version, ecc)) {
|
||||
if(!rebuild_qrcode(instance, version, ecc)) {
|
||||
furi_string_free(instance->message);
|
||||
instance->message = NULL;
|
||||
break;
|
||||
@@ -365,7 +411,7 @@ static bool qrcode_load_string(QRCodeApp* instance, FuriString* str) {
|
||||
instance->min_version = instance->set_version = version;
|
||||
instance->max_ecc_at_min_version = instance->set_ecc = ecc;
|
||||
result = true;
|
||||
} while (false);
|
||||
} while(false);
|
||||
|
||||
instance->loading = false;
|
||||
|
||||
@@ -391,27 +437,26 @@ static bool qrcode_load_file(QRCodeApp* instance, const char* file_path) {
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
|
||||
do {
|
||||
if (!flipper_format_file_open_existing(file, file_path)) break;
|
||||
if(!flipper_format_file_open_existing(file, file_path)) break;
|
||||
|
||||
uint32_t version = 0;
|
||||
if (!flipper_format_read_header(file, temp_str, &version)) break;
|
||||
if (furi_string_cmp_str(temp_str, QRCODE_FILETYPE)
|
||||
|| version != QRCODE_FILE_VERSION) {
|
||||
if(!flipper_format_read_header(file, temp_str, &version)) break;
|
||||
if(furi_string_cmp_str(temp_str, QRCODE_FILETYPE) || version != QRCODE_FILE_VERSION) {
|
||||
FURI_LOG_E(TAG, "Incorrect file format or version");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!flipper_format_read_string(file, "Message", temp_str)) {
|
||||
if(!flipper_format_read_string(file, "Message", temp_str)) {
|
||||
FURI_LOG_E(TAG, "Message is missing");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!qrcode_load_string(instance, temp_str)) {
|
||||
if(!qrcode_load_string(instance, temp_str)) {
|
||||
break;
|
||||
}
|
||||
|
||||
result = true;
|
||||
} while (false);
|
||||
} while(false);
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
flipper_format_free(file);
|
||||
@@ -454,8 +499,8 @@ static QRCodeApp* qrcode_app_alloc() {
|
||||
* @param qrcode_app The app to free
|
||||
*/
|
||||
static void qrcode_app_free(QRCodeApp* instance) {
|
||||
if (instance->message) furi_string_free(instance->message);
|
||||
if (instance->qrcode) qrcode_free(instance->qrcode);
|
||||
if(instance->message) furi_string_free(instance->message);
|
||||
if(instance->qrcode) qrcode_free(instance->qrcode);
|
||||
|
||||
gui_remove_view_port(instance->gui, instance->view_port);
|
||||
furi_record_close(RECORD_GUI);
|
||||
@@ -475,14 +520,14 @@ int32_t qrcode_app(void* p) {
|
||||
FuriString* file_path = furi_string_alloc();
|
||||
|
||||
do {
|
||||
if (p && strlen(p)) {
|
||||
if(p && strlen(p)) {
|
||||
furi_string_set(file_path, (const char*)p);
|
||||
} else {
|
||||
furi_string_set(file_path, QRCODE_FOLDER);
|
||||
|
||||
DialogsFileBrowserOptions browser_options;
|
||||
dialog_file_browser_set_basic_options(
|
||||
&browser_options, QRCODE_EXTENSION, &I_qrcode_10px);
|
||||
&browser_options, QRCODE_EXTENSION, &I_qrcode_10px);
|
||||
browser_options.hide_ext = true;
|
||||
browser_options.base_path = QRCODE_FOLDER;
|
||||
|
||||
@@ -490,26 +535,27 @@ int32_t qrcode_app(void* p) {
|
||||
bool res = dialog_file_browser_show(dialogs, file_path, file_path, &browser_options);
|
||||
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
if (!res) {
|
||||
if(!res) {
|
||||
FURI_LOG_E(TAG, "No file selected");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!qrcode_load_file(instance, furi_string_get_cstr(file_path))) {
|
||||
if(!qrcode_load_file(instance, furi_string_get_cstr(file_path))) {
|
||||
FURI_LOG_E(TAG, "Unable to load file");
|
||||
}
|
||||
|
||||
InputEvent input;
|
||||
while (furi_message_queue_get(instance->input_queue, &input, FuriWaitForever) == FuriStatusOk) {
|
||||
while(furi_message_queue_get(instance->input_queue, &input, FuriWaitForever) ==
|
||||
FuriStatusOk) {
|
||||
furi_check(furi_mutex_acquire(instance->mutex, FuriWaitForever) == FuriStatusOk);
|
||||
|
||||
if (input.key == InputKeyBack) {
|
||||
if (instance->message) {
|
||||
if(input.key == InputKeyBack) {
|
||||
if(instance->message) {
|
||||
furi_string_free(instance->message);
|
||||
instance->message = NULL;
|
||||
}
|
||||
if (instance->qrcode) {
|
||||
if(instance->qrcode) {
|
||||
qrcode_free(instance->qrcode);
|
||||
instance->qrcode = NULL;
|
||||
}
|
||||
@@ -517,43 +563,49 @@ int32_t qrcode_app(void* p) {
|
||||
instance->edit = false;
|
||||
furi_mutex_release(instance->mutex);
|
||||
break;
|
||||
} else if (input.key == InputKeyRight) {
|
||||
} else if(input.key == InputKeyRight) {
|
||||
instance->show_stats = true;
|
||||
} else if (input.key == InputKeyLeft) {
|
||||
} else if(input.key == InputKeyLeft) {
|
||||
instance->show_stats = false;
|
||||
} else if (instance->show_stats && !instance->loading && instance->qrcode) {
|
||||
if (input.key == InputKeyUp) {
|
||||
if (!instance->edit) {
|
||||
} else if(instance->show_stats && !instance->loading && instance->qrcode) {
|
||||
if(input.key == InputKeyUp) {
|
||||
if(!instance->edit) {
|
||||
instance->selected_idx = MAX(0, instance->selected_idx - 1);
|
||||
} else {
|
||||
if (instance->selected_idx == 0 && instance->set_version < MAX_QRCODE_VERSION) {
|
||||
if(instance->selected_idx == 0 &&
|
||||
instance->set_version < MAX_QRCODE_VERSION) {
|
||||
instance->set_version++;
|
||||
} else if (instance->selected_idx == 1) {
|
||||
uint8_t max_ecc = instance->set_version == instance->min_version ? instance->max_ecc_at_min_version : ECC_HIGH;
|
||||
if (instance->set_ecc < max_ecc) {
|
||||
} else if(instance->selected_idx == 1) {
|
||||
uint8_t max_ecc = instance->set_version == instance->min_version ?
|
||||
instance->max_ecc_at_min_version :
|
||||
ECC_HIGH;
|
||||
if(instance->set_ecc < max_ecc) {
|
||||
instance->set_ecc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (input.key == InputKeyDown) {
|
||||
if (!instance->edit) {
|
||||
} else if(input.key == InputKeyDown) {
|
||||
if(!instance->edit) {
|
||||
instance->selected_idx = MIN(1, instance->selected_idx + 1);
|
||||
} else {
|
||||
if (instance->selected_idx == 0 && instance->set_version > instance->min_version) {
|
||||
if(instance->selected_idx == 0 &&
|
||||
instance->set_version > instance->min_version) {
|
||||
instance->set_version--;
|
||||
if (instance->set_version == instance->min_version) {
|
||||
instance->set_ecc = MAX(instance->set_ecc, instance->max_ecc_at_min_version);
|
||||
if(instance->set_version == instance->min_version) {
|
||||
instance->set_ecc =
|
||||
MAX(instance->set_ecc, instance->max_ecc_at_min_version);
|
||||
}
|
||||
} else if (instance->selected_idx == 1 && instance->set_ecc > 0) {
|
||||
} else if(instance->selected_idx == 1 && instance->set_ecc > 0) {
|
||||
instance->set_ecc--;
|
||||
}
|
||||
}
|
||||
} else if (input.key == InputKeyOk) {
|
||||
if (instance->edit && (instance->set_version != instance->qrcode->version || instance->set_ecc != instance->qrcode->ecc)) {
|
||||
} else if(input.key == InputKeyOk) {
|
||||
if(instance->edit && (instance->set_version != instance->qrcode->version ||
|
||||
instance->set_ecc != instance->qrcode->ecc)) {
|
||||
QRCode* qrcode = instance->qrcode;
|
||||
instance->loading = true;
|
||||
|
||||
if (rebuild_qrcode(instance, instance->set_version, instance->set_ecc)) {
|
||||
if(rebuild_qrcode(instance, instance->set_version, instance->set_ecc)) {
|
||||
qrcode_free(qrcode);
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Could not rebuild qrcode");
|
||||
@@ -572,12 +624,12 @@ int32_t qrcode_app(void* p) {
|
||||
view_port_update(instance->view_port);
|
||||
}
|
||||
|
||||
if (p && strlen(p)) {
|
||||
if(p && strlen(p)) {
|
||||
// if started with an arg, exit instead
|
||||
// of looping back to the browser
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
} while(true);
|
||||
|
||||
furi_string_free(file_path);
|
||||
qrcode_app_free(instance);
|
||||
|
||||
Reference in New Issue
Block a user