   #define stricmp strcasecmp // strangely, arduino uses a different API
 
   if(!stricmp(cmd,"P")) {
-    state_switch(const_power,val);
+    state_switch(MODE_CONST_POWER, val);
   }
   else if(!stricmp(cmd,"V")) {
-    state_switch(const_volt,val);
+    state_switch(MODE_CONST_VOLT, val);
   }
   else if(!stricmp(cmd,"PWM")) {
-    state_switch(const_pwm,val);
+    state_switch(MODE_CONST_DUTY, val);
   }
   else if(!stricmp(cmd,"MPPT") && val) {
-    state_switch(mppt_on); 
+    state_switch(MODE_MPPT_ON); 
   }
   else if(!stricmp(cmd,"OFF") && val) {
-    state_switch(off);
+    state_switch(MODE_OFF);
   }
   else {
     Serial.print("{\"time\": ");

  
  static int old_sol_watts = 0;
  static int off_count = OFF_NUM;
  static int delta = PWM_INC;                        // variable used to modify pwm duty cycle for the ppt algorithm

  int pwm = power_status.pwm_duty;
  int sol_watts = power_status.sol_watts;

  lpf_out_volts.Init();
  lpf_in_amps.Init();

  state_switch(MODE_OFF);                     // start with charger state as off
  //state_switch(MODE_CONST_VOLT, 300);                       // start with charger state as off
}

//------------------------------------------------------------------------------------------------------
