   {
     // initialize interface
     selected = 0;
-    display_changed = false;
+    saving = false;
+    last_selected_env = 0;
+    last_gate = false;
 
     // load/initialize ADSR values
-    load_params(0, (uint8_t *)v, 4);
-    for(uint8_t i = 0; i < 4; ++i)
+    load_params(0, (uint8_t *)v, 8);
+    for(uint8_t i = 0; i < 8; ++i)
     {
       if(v[i] < 0)
       {


#define V_MAX                 43

struct DU_ADSR_Values {
  uint16_t A;  // ms
  uint16_t D;  // ms

      if(gate)
      {
        uint16_t elapsed = millis() - gate_time;
        if(elapsed < adsr_values[env].A)
        {
          // attack
          cv_current = ENV_PEAK * ENV_SATURATION * (1.0 - exp(-(float(elapsed) / float(adsr_values[env].A))));
        }
        else
        {
          // decay/sustain
          cv_current = adsr_values[env].S + (ENV_PEAK - adsr_values[env].S)
              * exp(ENV_DECAY_COEFF * (float(elapsed - adsr_values[env].A) / float(adsr_values[env].D)));
        }
      }
      else
