Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions protocol/tagtinker_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ static inline bool tagtinker_profile_uses_ui_page(const TagTinkerTagProfile* pro
return profile && tagtinker_type_uses_ui_page(profile->type_code);
}

/* Page number shown to the user for a protocol page. HD tags show protocol
* pages 0-7 as 1-8, like the text page picker: the image written to protocol
* page N is the one "Change Page N+1" displays (issue #26). Color 2.6 uses
* the UI page number on the wire, so it is shown as-is. */
static inline uint8_t tagtinker_page_to_ui(const TagTinkerTagProfile* profile, uint8_t proto_page) {
return tagtinker_profile_uses_ui_page(profile) ? proto_page : (uint8_t)(proto_page + 1U);
}

static inline void tagtinker_profile_glass_size(
const TagTinkerTagProfile* profile,
uint16_t* width,
Expand Down
24 changes: 15 additions & 9 deletions scenes/tagtinker_scene_image_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@ enum {
ImageOptionTransmit,
};

static const TagTinkerTagProfile* image_option_profile(const TagTinkerApp* app) {
if(app->selected_target < 0 || app->selected_target >= app->target_count) return NULL;
return &app->targets[app->selected_target].profile;
}

/* The list index is the protocol page (0-7); the label is the page number
* the user sees everywhere else (1-8 on HD tags). */
static void image_option_set_page_text(const TagTinkerApp* app, VariableItem* item, uint8_t page) {
char buf[4];
snprintf(buf, sizeof(buf), "%u", tagtinker_page_to_ui(image_option_profile(app), page));
variable_item_set_current_value_text(item, buf);
}

static void image_option_page_changed(VariableItem* item) {
TagTinkerApp* app = variable_item_get_context(item);
app->image_tx_job.page = variable_item_get_current_value_index(item);
app->img_page = app->image_tx_job.page;

char buf[4];
snprintf(buf, sizeof(buf), "%u", app->image_tx_job.page);
variable_item_set_current_value_text(item, buf);
image_option_set_page_text(app, item, app->image_tx_job.page);
}

static void image_option_enter_cb(void* ctx, uint32_t index) {
Expand All @@ -39,11 +49,7 @@ void tagtinker_scene_image_options_on_enter(void* ctx) {
VariableItem* item =
variable_item_list_add(list, "Page", 8, image_option_page_changed, app);
variable_item_set_current_value_index(item, job->page);
{
char buf[4];
snprintf(buf, sizeof(buf), "%u", job->page);
variable_item_set_current_value_text(item, buf);
}
image_option_set_page_text(app, item, job->page);

/* Position, compression and frame-repeat are intentionally fixed here:
* pages are the only knob that meaningfully changes per-image, the rest
Expand Down
6 changes: 5 additions & 1 deletion scenes/tagtinker_scene_synced_image_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ void tagtinker_scene_synced_image_list_on_enter(void* ctx) {
sizeof(synced_image_labels[menu_idx]),
"%sP%u %s",
image->resampled ? "~ " : "",
image->page,
tagtinker_page_to_ui(
(app->selected_target >= 0 && app->selected_target < app->target_count) ?
&app->targets[app->selected_target].profile :
NULL,
image->page),
image->job_id);
synced_image_menu_map[menu_idx] = (uint8_t)i;
submenu_add_item(
Expand Down