Optimize Tilt Counting System and NVS Storage #34

Merged
ismail merged 3 commits from fix/1079-tilt-counting into dev 2025-08-20 12:44:38 +02:00
Owner

Summary

These changes optimize memory usage by consolidating tilt counters and improve NVS handling by fixing key names and documentation. The goal is to reduce memory footprint and make the NVS storage more maintainable.

TICKET-1079, TICKET-1081

Changes

  • Consolidated forward/reverse tilt counters into single uint16_t variable
  • Removed relay_chn_tilt_counter_t type from tilt control structure
  • Fixed NVS module tag name to match module name
  • Improved NVS key names with better descriptors
  • Added documentation for NVS keys
  • Updated affected test files
  • #1079: Memory optimization for tilt counting system
  • #1081: Improve NVS key names and documentation

Breaking Changes

  • Removed relay_chn_tilt_counter_t type
  • Changed NVS storage format for tilt counts
  • Modified tilt count function signatures

Migration Guide

  1. Replace relay_chn_tilt_counter_t with uint16_t:
// Old code
relay_chn_tilt_counter_t tilt_counter;

// New code
uint16_t tilt_count;
  1. Update NVS operations:
// Old code
relay_chn_nvs_get_tilt_count(ch, &forward_count, &reverse_count);

// New code
relay_chn_nvs_get_tilt_count(ch, &tilt_count);
  1. Modify test cases to use single count value:
// Old test code
TEST_ESP_OK(relay_chn_nvs_set_tilt_count(0, 100, 200));

// New test code
TEST_ESP_OK(relay_chn_nvs_set_tilt_count(0, tilt_count));
## Summary These changes optimize memory usage by consolidating tilt counters and improve NVS handling by fixing key names and documentation. The goal is to reduce memory footprint and make the NVS storage more maintainable. TICKET-1079, TICKET-1081 ## Changes - Consolidated forward/reverse tilt counters into single `uint16_t` variable - Removed `relay_chn_tilt_counter_t` type from tilt control structure - Fixed NVS module tag name to match module name - Improved NVS key names with better descriptors - Added documentation for NVS keys - Updated affected test files ## Related Issues - #1079: Memory optimization for tilt counting system - #1081: Improve NVS key names and documentation ## Breaking Changes - Removed `relay_chn_tilt_counter_t` type - Changed NVS storage format for tilt counts - Modified tilt count function signatures ## Migration Guide 1. Replace `relay_chn_tilt_counter_t` with `uint16_t`: ````c // Old code relay_chn_tilt_counter_t tilt_counter; // New code uint16_t tilt_count; ```` 2. Update NVS operations: ````c // Old code relay_chn_nvs_get_tilt_count(ch, &forward_count, &reverse_count); // New code relay_chn_nvs_get_tilt_count(ch, &tilt_count); ```` 3. Modify test cases to use single count value: ````c // Old test code TEST_ESP_OK(relay_chn_nvs_set_tilt_count(0, 100, 200)); // New test code TEST_ESP_OK(relay_chn_nvs_set_tilt_count(0, tilt_count)); ````
ismail added the Kind/Enhancement label 2025-08-20 12:44:03 +02:00
ismail self-assigned this 2025-08-20 12:44:03 +02:00
ismail added 3 commits 2025-08-20 12:44:04 +02:00
- Optimized tilt counting data by reducing the tilt counter variables into one for smaller memory footprint. So the `relay_chn_tilt_counter_t` type is replaced by a single `uint16_t` variable in the `relay_chn_tilt_ctl_t` structure. Hence the `relay_chn_tilt_counter_t` type has been removed since it is not necessary anymore.
- Refactored tilt count handling in NVS: consolidate forward and reverse counts into a single tilt count parameter.
- Updated NVS test files that affected by the data type and function signature changes.

Fixes #1079
Fix NVS module's tag string value to match the module name. IssueID #1081.
Fix key names with more approprite ones and add documentation for them. Fixes #1081.
ismail merged commit fe383d7003 into dev 2025-08-20 12:44:38 +02:00
Sign in to join this conversation.