Skip to content

Commit

Permalink
remove textual support for nanoS
Browse files Browse the repository at this point in the history
  • Loading branch information
chcmedeiros committed Mar 11, 2024
1 parent 3f198df commit c48c58c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 0 additions & 6 deletions app/src/common/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,13 @@ extern "C" {
#include "coin.h"

#define OUTPUT_HANDLER_SIZE 600
#if defined(TARGET_NANOS)
#undef OUTPUT_HANDLER_SIZE
#define OUTPUT_HANDLER_SIZE 450
#endif

#define MAX_CONTENT_SIZE 550
#define MAX_TITLE_SIZE 40
#define PRINTABLE_TITLE_SIZE 17
#define PRINTABLE_PAGINATED_TITLE_SIZE 10
#define SCREEN_BREAK ":"
#define SCREEN_INDENT ">"
#define TITLE_TRUNCATE_REPLACE "---"
#define END_OF_STRING_SIZE

const char *parser_getErrorDescription(parser_error_t err);

Expand Down
6 changes: 6 additions & 0 deletions app/src/common/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,15 @@ static parser_tx_t tx_obj;

const char *tx_parse(tx_type_e type)
{
#if defined(COMPILE_TEXTUAL)
if (type != tx_json && type != tx_textual) {
return parser_getErrorDescription(parser_value_out_of_range);
}
#else
if (type != tx_json) {
return parser_getErrorDescription(parser_value_out_of_range);
}
#endif

MEMZERO(&tx_obj, sizeof(tx_obj));
tx_obj.tx_type = type;
Expand Down
7 changes: 6 additions & 1 deletion app/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ parser_error_t parser_parse(parser_context_t *ctx,
CHECK_PARSER_ERR(parser_init_context(ctx, data, dataLen))
ctx->tx_obj = tx_obj;
if (tx_obj->tx_type == tx_textual) {
#if defined(COMPILE_TEXTUAL)
CHECK_PARSER_ERR(_read_text_tx(ctx, tx_obj))
#endif
} else {
CHECK_PARSER_ERR(_read_json_tx(ctx, tx_obj))
}
Expand Down Expand Up @@ -311,6 +313,7 @@ __Z_INLINE parser_error_t parser_formatAmount(uint16_t amountToken,
return parser_formatAmountItem(showItemTokenIdx, outVal, outValLen, showPageIdx, &dummy);
}

#if defined(COMPILE_TEXTUAL)
__Z_INLINE parser_error_t parser_screenPrint(const parser_context_t *ctx,
Cbor_container *container,
char *outKey, uint16_t outKeyLen,
Expand Down Expand Up @@ -478,6 +481,7 @@ __Z_INLINE parser_error_t parser_getTextualItem(const parser_context_t *ctx,

return parser_ok;
}
#endif

__Z_INLINE parser_error_t parser_getJsonItem(const parser_context_t *ctx,
uint8_t displayIdx,
Expand Down Expand Up @@ -535,11 +539,12 @@ parser_error_t parser_getItem(const parser_context_t *ctx,
uint8_t pageIdx, uint8_t *pageCount) {

if (ctx->tx_obj->tx_type == tx_textual) {
#if defined(COMPILE_TEXTUAL)
CHECK_PARSER_ERR(parser_getTextualItem(ctx,displayIdx,
outKey, outKeyLen,
outVal, outValLen,
pageIdx, pageCount));

#endif
} else {
CHECK_PARSER_ERR(parser_getJsonItem(ctx,displayIdx,
outKey, outKeyLen,
Expand Down

0 comments on commit c48c58c

Please sign in to comment.