if (digitalRead(P1) == LOW) HP1 = 1;
else HP1 = 0;
In other words,
HP1 = !digitalRead(P1);
boolean button_P1 = handle_P1();
boolean button_P2 = handle_P2();
boolean button_P3 = handle_P3();
Pass an argument to ONE function - the pin number. Don't write three nearly identical functions.
boolean button_S1 = handle_S1();
boolean button_S2 = handle_S2();
boolean button_S3 = handle_S3();
Oops, make that 6.
buttonState = digitalRead(buttonPin);
Switches work so much better than buttons. The names do not contribute to understanding what the code does. Sure, you are reading a pin, but there is no clue as to why. What is connected to that pin? FOR WHAT PURPOSE?