]> www.fi.muni.cz Git - heater.git/commitdiff
New button meanings:
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sun, 21 Dec 2014 21:38:48 +0000 (22:38 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sun, 21 Dec 2014 21:38:48 +0000 (22:38 +0100)
- any long button press switches the system off
- short button press only increases or decreases the power level

firmware/main.c

index d238fa8703dbe799425071e98e07f26185666c43..95cf70aaf02f9dca561e08d34b55bb856aefc964 100644 (file)
  * Buttons:
  * There are two buttons (+ and -). Any button can wake the system up from
  * the power-down state.
- * TODO: When the system is woken up by the "-" button,
- * it starts with the minimum output power, when it is woken up by the "+"
- * button, it start with the maximum output power.
  * When running, the "-" button is used for decreasing the output power,
  * the "+" button is for increasing it.
- * When on the lowest power state, the "-" button switches the system off.
- * Long "-" button press switches the system off, long "+" button
- * press sets the output power to maximum.
+ * Any long button press switches the system off.
  *
  * Status LED:
  * When powering up by a button press, the LED goes on to provide a visual
@@ -439,19 +434,12 @@ static void button_pressed(unsigned char button, unsigned char long_press)
 {
        // ignore simlultaneous button 1 and 2 press
        if (long_press) {
-               if (button == 1) {
-                       power_down();
-                       return;
-               } else if (button == 2) {
-                       power_level = N_POWER_LEVELS-1;
-               }
+               power_down();
+               return;
        } else { // short press
                if (button == 1) {
                        if (power_level > 0) {
                                --power_level;
-                       } else {
-                               power_down();
-                               return;
                        }
                } else if (button == 2) {
                        if (power_level < N_POWER_LEVELS-1) {