Sometimes I see things like this…
if (input(DIGITAL_IN1) == HIGH)
{
...
}
if (input(DIGITAL_IN2) == HIGH)
{
...
}
if (input(DIGITAL_IN3) == HIGH)
{
...
}
This code led me to having to open schematics and figure out what digital input 1, 2 and 3 where.
So I used the free CodeBlocks editor refactor “Rename Symbol” feature to change their names to:
if (input(ROBOT_ON_FIRE_IN1) == HIGH)
{
...
}
if (input(BATTERY_OVERLOAD_IN2) == HIGH)
{
...
}
if (input(DUST_BIN_FULL_IN3) == HIGH)
{
...
}
…but using names that made sense for my application ;-)
Someone must have thought it was important to include the input number (IN1, IN2 and IN3) — possibly so they would not need to look through defines to see what value goes to what input — so I kept those in my names.
But now, when I find this code months down the line, I’ll immediately know which function is most likely detecting that the robot is on fire.
Pretty easy, isnt’ it?
Until next rename…