diff --git a/firmware/src/console/pr_dbg.hh b/firmware/src/console/pr_dbg.hh index 77a8e8674..728d549ce 100644 --- a/firmware/src/console/pr_dbg.hh +++ b/firmware/src/console/pr_dbg.hh @@ -17,10 +17,10 @@ inline constexpr bool PRINT_WARN = true; inline constexpr bool PRINT_INFO = true; // Debug: temporary messges used for debugging -inline constexpr bool PRINT_DEBUG = true; +inline constexpr bool PRINT_DEBUG = false; // Trace: detailed log of execution -inline constexpr bool PRINT_TRACE = true; +inline constexpr bool PRINT_TRACE = false; // Dump: large amounts of verbose data inline constexpr bool PRINT_DUMP = false; diff --git a/firmware/src/patch_file/open_patch_manager.hh b/firmware/src/patch_file/open_patch_manager.hh index 0b6315eea..a5ef44a2d 100644 --- a/firmware/src/patch_file/open_patch_manager.hh +++ b/firmware/src/patch_file/open_patch_manager.hh @@ -93,7 +93,6 @@ public: if (view_patch_) return &view_patch_->patch; else { - pr_err("Tried to get_view_patch when viewpatch is null.\n"); return nullptr; } } @@ -121,7 +120,6 @@ public: if (view_patch_) return view_patch_->loc.vol; else { - pr_err("Tried to get_view_patch_vol() for null view_patch\n"); return Volume::MaxVolumes; } } diff --git a/firmware/src/patch_file/open_patches.hh b/firmware/src/patch_file/open_patches.hh index 4f183f18a..c93e2e2e3 100644 --- a/firmware/src/patch_file/open_patches.hh +++ b/firmware/src/patch_file/open_patches.hh @@ -29,7 +29,6 @@ struct OpenPatchList { return nullptr; if (auto it = std::ranges::find(list, hash, &OpenPatch::loc_hash); it != list.end()) { - pr_dbg("range found\n"); return &(*it); } return nullptr; @@ -49,19 +48,16 @@ struct OpenPatchList { OpenPatch *emplace_back(PatchLocation const &loc) { auto &openpatch = list.emplace_back(loc); - dump(); return &openpatch; } bool remove(PatchLocHash hash) { auto num_erased = std::erase_if(list, [=](auto &e) { return e.loc_hash == hash; }); - dump(); return num_erased > 0; } void remove(std::list::iterator item) { list.erase(item); - dump(); } void remove_last() { @@ -85,13 +81,12 @@ struct OpenPatchList { } private: - void dump() { + void dump_open_patches() { unsigned i = 0; size_t total_size = 0; - pr_dbg("________\n"); for (auto &p : list) { - auto sz = p.patch.patch_size(); + auto sz = patch_size(p.patch); total_size += sz; pr_dbg("[%d] %d:%s: %s #%d [%zu B]\n", i++, @@ -102,7 +97,35 @@ private: sz); } pr_dbg("TOTAL: %zu\n", total_size); - pr_dbg("________\n"); + } + + static size_t patch_size(PatchData const &p) { + auto sz = sizeof(PatchData); + sz += p.module_slugs.size() * sizeof(BrandModuleSlug); + + sz += p.int_cables.size() * sizeof(InternalCable); + for (auto const &cable : p.int_cables) + sz += cable.ins.size() * sizeof(Jack); + + sz += p.mapped_ins.size() * sizeof(MappedInputJack); + for (auto const &in : p.mapped_ins) + sz += in.ins.size() * sizeof(Jack); + + sz += p.mapped_outs.size() * sizeof(MappedOutputJack); + + sz += p.static_knobs.size() * sizeof(StaticParam); + + sz += p.knob_sets.size() * sizeof(MappedKnobSet); + for (auto const &knob_set : p.knob_sets) + sz += knob_set.set.size() * sizeof(MappedKnob); + + sz += p.module_states.size() * sizeof(ModuleInitState); + for (auto const &state : p.module_states) + sz += state.state_data.size() * sizeof(char); + + sz += p.midi_maps.set.size() * sizeof(MappedKnob); + + return sz; } private: diff --git a/shared/patch/patch_data.hh b/shared/patch/patch_data.hh index 7ddd5d2e3..aa0d6ff3b 100644 --- a/shared/patch/patch_data.hh +++ b/shared/patch/patch_data.hh @@ -331,35 +331,6 @@ struct PatchData { return module_id; } - size_t patch_size() { - auto sz = sizeof(PatchData); - sz += module_slugs.size() * sizeof(BrandModuleSlug); - - sz += int_cables.size() * sizeof(InternalCable); - for (auto const &cable : int_cables) - sz += cable.ins.size() * sizeof(Jack); - - sz += mapped_ins.size() * sizeof(MappedInputJack); - for (auto const &in : mapped_ins) - sz += in.ins.size() * sizeof(Jack); - - sz += mapped_outs.size() * sizeof(MappedOutputJack); - - sz += static_knobs.size() * sizeof(StaticParam); - - sz += knob_sets.size() * sizeof(MappedKnobSet); - for (auto const &knob_set : knob_sets) - sz += knob_set.set.size() * sizeof(MappedKnob); - - sz += module_states.size() * sizeof(ModuleInitState); - for (auto const &state : module_states) - sz += state.state_data.size() * sizeof(char); - - sz += midi_maps.set.size() * sizeof(MappedKnob); - - return sz; - } - private: //non-const version for private use only MappedKnob *_get_mapped_knob(uint32_t set_id, uint32_t module_id, uint32_t param_id) {