Skip to content

weather detector refactor - #1319

Open
Developer-Butters wants to merge 1 commit into
PokemonAutomation:mainfrom
Developer-Butters:WeatherDetectorRefactor
Open

weather detector refactor#1319
Developer-Butters wants to merge 1 commit into
PokemonAutomation:mainfrom
Developer-Butters:WeatherDetectorRefactor

Conversation

@Developer-Butters

Copy link
Copy Markdown
Contributor

This pull request refactors and improves the weather icon detection logic for Pokémon LZA. The main change is a switch from a hard-coded template info table to using waterfill template matching. This should improve robustness. The test program is also updated to exercise and debug the new detection logic.

Weather Icon Detection Refactor and Improvements:

  • Replaced the static WeatherTemplateInfo table and related logic with a matcher-based approach using WaterfillTemplateMatcher and a new WeatherFullMatcher class, allowing for more flexible and robust template matching for each weather type.
  • Introduced supplemental_template_checks to handle additional region-of-interest template checks for specific weather types, improving detection accuracy and making it easier to add or modify checks.
  • Updated the WeatherIconDetector class to use the new matcher-based approach, removing unnecessary members and simplifying overlay logic.

Test Program and Integration Updates:

  • Updated the test program (TestProgramSwitch.cpp) to include the new weather detector and added a debug routine for visualizing and testing weather icon detection. [
    Code Cleanup:

  • Removed unused includes and the obsolete WeatherTemplateInfo struct from headers, reflecting the new detection approach.

@jw098

jw098 commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

FYI. There is a merge conflict here.

@Developer-Butters
Developer-Butters force-pushed the WeatherDetectorRefactor branch 2 times, most recently from d25b9c9 to e6d9d70 Compare July 30, 2026 00:57
@Mysticial

Copy link
Copy Markdown
Collaborator

Can you rebase? We recently added new test infra which we will need to add tests for this to.

I just pushed the PLZA test skeleton to master. Once you rebase, you'll be able to add tests for this weather detector.

Basically you'll want to add the weather detector test here: https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/Source/PokemonLZA/PokemonLZA_Tests.cpp#L17

Here is an example of what the new test structure looks like: https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/Source/PokemonLZA/Inference/PokemonLZA_DialogDetector.cpp#L477-L518

So you'll need to make that, then list the 30-some test files that you merged to the CommandLineTests repo. That way these can be automatically run with the rest of the other tests.

Refactored the weather detector to use waterfill instead of direct object comparison.
@Developer-Butters
Developer-Butters force-pushed the WeatherDetectorRefactor branch from e6d9d70 to f5afb33 Compare August 3, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants