Skip to content

Commit 2477834

Browse files
update tapterm.json by serial connection
1 parent 5105db3 commit 2477834

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

tmk_core/protocol/nrf/bmp.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,20 @@ int parse_qmk_config(void)
387387
}
388388

389389
BMPAPI->logger.info("Update tapping term");
390+
391+
// copy settings to bootloader region
392+
bmp_qmk_config_t *p_qmk_config;
393+
uint32_t qmk_config_file_len;
394+
BMPAPI->app.get_file(QMK_RECORD, (uint8_t**)&p_qmk_config, &qmk_config_file_len);
395+
if (p_qmk_config == NULL)
396+
{
397+
BMPAPI->app.save_file(QMK_RECORD);
398+
BMPAPI->app.get_file(QMK_RECORD, (uint8_t**)&p_qmk_config, &qmk_config_file_len);
399+
if (p_qmk_config == NULL) return 1;
400+
}
401+
402+
memcpy(p_qmk_config, &bmp_qmk_config, sizeof(bmp_qmk_config));
403+
390404
return 0;
391405
}
392406

@@ -887,18 +901,6 @@ int load_tapping_term_file()
887901

888902
int save_tapping_term_file()
889903
{
890-
bmp_qmk_config_t *p_qmk_config;
891-
uint32_t qmk_config_file_len;
892-
BMPAPI->app.get_file(QMK_RECORD, (uint8_t**)&p_qmk_config, &qmk_config_file_len);
893-
if (p_qmk_config == NULL)
894-
{
895-
BMPAPI->app.save_file(QMK_RECORD);
896-
BMPAPI->app.get_file(QMK_RECORD, (uint8_t**)&p_qmk_config, &qmk_config_file_len);
897-
if (p_qmk_config == NULL) return 1;
898-
}
899-
900-
memcpy(p_qmk_config, &bmp_qmk_config, sizeof(bmp_qmk_config));
901-
902904
return BMPAPI->app.save_file(QMK_RECORD);
903905
}
904906

tmk_core/protocol/nrf/config_file_util.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,8 @@ void tapping_term_config_to_json_conv(bmp_qmk_config_t const * const conf,
943943
break;
944944
}
945945
}
946-
written = snprintf(json, json_len, "}}");
946+
947+
// remove trailing comma and close bracket
948+
written = snprintf(json - 4, json_len, "\r\n}}");
947949
}
948950

0 commit comments

Comments
 (0)