Subversion Repositories FlightCtrl

Rev

Rev 2108 | Rev 2119 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2108 Rev 2110
Line 32... Line 32...
32
  WDTCSR |= (1 << WDCE) | (1 << WDE);
32
  WDTCSR |= (1 << WDCE) | (1 << WDE);
33
  WDTCSR = 0;
33
  WDTCSR = 0;
Line 34... Line 34...
34
 
34
 
35
// This is strange: It should NOT be necessarty to do. But the call of the same,
35
// This is strange: It should NOT be necessarty to do. But the call of the same,
36
// in channelMap_readOrDefault (if eeprom read fails) just sets all to 0,0,0,....
36
// in channelMap_readOrDefault (if eeprom read fails) just sets all to 0,0,0,....
Line 37... Line 37...
37
channelMap_default();
37
  channelMap_default();
38
 
38
 
39
  // initalize modules
39
  // initalize modules
40
  output_init();
40
  output_init();
Line 74... Line 74...
74
  RED_ON;
74
  RED_ON;
75
  while (!checkDelay(timer))
75
  while (!checkDelay(timer))
76
    ;
76
    ;
Line 77... Line 77...
77
 
77
 
78
  timer = setDelay(200);
78
  timer = setDelay(200);
79
  outputSet(0,0);
79
  outputSet(0, 0);
80
  outputSet(1,1);
80
  outputSet(1, 1);
81
  RED_OFF;
81
  RED_OFF;
82
  GRN_ON;
82
  GRN_ON;
83
  while (!checkDelay(timer))
83
  while (!checkDelay(timer))
Line 117... Line 117...
117
      if (!analogDataReady) {
117
      if (!analogDataReady) {
118
        // Analog data should have been ready but is not!!
118
        // Analog data should have been ready but is not!!
119
        debugOut.digital[0] |= DEBUG_MAINLOOP_TIMER;
119
        debugOut.digital[0] |= DEBUG_MAINLOOP_TIMER;
120
      } else {
120
      } else {
121
        debugOut.digital[0] &= ~DEBUG_MAINLOOP_TIMER;
121
        debugOut.digital[0] &= ~DEBUG_MAINLOOP_TIMER;
122
 
122
          }
123
        J4HIGH;
123
        J4HIGH;
124
        // This is probably the correct order:
124
        // This is probably the correct order:
125
        // The attitude computation should not depend on anything from control (except maybe the estimation of control activity level)
125
        // The attitude computation should not depend on anything from control (except maybe the estimation of control activity level)
126
        // The control may depend on attitude - for example, attitude control uses pitch and roll angles, compass control uses yaw angle etc.
126
        // The control may depend on attitude - for example, attitude control uses pitch and roll angles, compass control uses yaw angle etc.
127
        // Flight control uses results from both.
127
        // Flight control uses results from both.
Line 169... Line 169...
169
          if (runFlightControl) { // Time for the next iteration was up before the current finished. Signal error.
169
          if (runFlightControl) { // Time for the next iteration was up before the current finished. Signal error.
170
        debugOut.digital[1] |= DEBUG_MAINLOOP_TIMER;
170
        debugOut.digital[1] |= DEBUG_MAINLOOP_TIMER;
171
      } else {
171
      } else {
172
        debugOut.digital[1] &= ~DEBUG_MAINLOOP_TIMER;
172
        debugOut.digital[1] &= ~DEBUG_MAINLOOP_TIMER;
173
          }      
173
          }      
174
    }
-
 
175
  }
174
  }
176
  return (1);
175
  return (1);
177
}
176
}