substracting the activated mask when a mapping is found regardless of already activated or not

This commit is contained in:
Vincent-FK 2021-04-05 15:44:42 +02:00
parent 3e0babfb0c
commit 1e1cbf719b

View File

@ -134,10 +134,7 @@ static void apply_mapping(mapping_list_t *list, uint32_t gpio_mask)
#endif // DEBUG_GPIO
if (mapping->activated == false) {
/* Mapping is not yet active, subtract the matching GPIOs from
* the current GPIO mask and activate it
*/
gpio_mask ^= mapping->gpio_mask;
/* Activate mapping */
mapping->activated = true;
if (mapping->type == MAPPING_KEY) {
@ -152,6 +149,11 @@ static void apply_mapping(mapping_list_t *list, uint32_t gpio_mask)
system(mapping->value.command);
}
}
/* Subtract the matching GPIOs from
* the current GPIO mask and activate it
*/
gpio_mask ^= mapping->gpio_mask;
} else if (mapping->activated) {
/* Non-matching activated mapping, deactivate it */