Project

General

Profile

Revision 5ea63f0d

ID5ea63f0d950a9dca70d33f48d0f0e68a8e28f0d2
Parent eb7af729

Added by unknown about 10 years ago

Working version before truck weekend

View differences:

arduino/RadioBuggyMega/RadioBuggyMega.ino
74 74
}
75 75

  
76 76
int convert_rc_to_steering(int rc_angle) {
77
  int out = (rc_angle/4)+(90*3/4)+39;
78
  if(out < 105 || out > 160) {
77
  //Inverter for 2.4 GHz racecar received
78
  rc_angle = 180-rc_angle;
79
  int out = (rc_angle/4)+(90*3/4)+36;
80
  if(out < 100 || out > 155) {
79 81
    Serial.println("FAKFAKFAK SERVO OUT OF RANGE");
80 82
    Serial.println(out);
81
    out = 129;
83
    out = 125;
82 84
  }
83 85
  return out;
84 86
}
......
109 111
    raw_thr = receiver_get_angle(THR_INDEX);
110 112
    smoothed_thr = filter_loop(&thr_state, raw_thr);
111 113
    // TODO make this code...less...something
112
    if(smoothed_thr < 90) {
114
    if(smoothed_thr < 70) {
113 115
      brake_drop();
114 116
    } else {
115 117
      brake_raise();

Also available in: Unified diff