Skip to content

Fix/reserved word as variable brakes the application #465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

georgi-s
Copy link
Contributor

This commit improves the variable validation process in the Blockly Arduino generator:

  1. Added a new validateVariable function that performs comprehensive validation:

    • Checks for empty or whitespace-only names
    • Validates against reserved Arduino words
    • Ensures names don't start with numbers
    • Verifies names contain only valid characters (letters, numbers, underscores)
  2. Implemented a flag system to prevent multiple alerts from appearing simultaneously:

    • Added an alertShown flag to track when an alert is displayed
    • Added a timeout to reset the flag after 1 second
    • Consolidated error messages to show only one alert regardless of which validation fails
  3. Updated variable handling in setVariableFunction and getVariableFunction:

    • Added proper error handling for non-existent variables
    • Integrated the new validation function
    • Improved code formatting and readability

These changes ensure a better user experience by providing clear, non-repetitive feedback when invalid variable names are used.

Eric Thieme-Garmann and others added 24 commits March 25, 2025 12:03
…nders

- Added new top-view camera angle renders for sensors:
  * BME680 (sensorBME680 v9.png)
  * HDC1080 (senseBox-HDC1080_v22 v4.png)
  * SMT50 (SMT50 v2.png)
  * Water Temperature Sensor (Wassertemperatur Sensor v2.png)
  * SCD30 (SCD30 v1.png)
  * HCSR04 (hc-sr04.png)

- Standardized rendering specifications:
  * All PNG files must be rendered in 1920x1080 (16:9 aspect ratio)
  * This ensures consistent appearance across all sensor graphics
  * Future renders must follow these dimensions for uniformity

- Unified sensor display sizes in simulator:
  * Set maxWidth='64%' for all sensor components
  * Applied to ensure consistent scaling across all sensors
  * This setting maintains proper proportions in the simulator view

Note for future developers:
When adding new sensor graphics, please ensure:
1. Renders are created in 1920x1080 (16:9) resolution
2. Top-view camera angle is used for consistency
3. Set maxWidth='64%' in the sensor's React component
4. Test scaling behavior in simulator before committing
@mariopesch
Copy link
Member

@felixerdy @georgi-s i think this PR superseeds this one with a simpler solution: #467

@mariopesch mariopesch closed this May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants