Switch from GPLv2 to GPLv2+
[fw/altos] / ao-tools / lib / cc-telem.c
index ccd40ac2cb9db31e15501c57ab8bcfc6bbfaa287..678c078eb3183b7067b2406fd2ce23907483aa8d 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -101,6 +102,10 @@ cc_telem_parse(const char *input_line, struct cc_telem *telem)
                telem->flight = 0;
 
        cc_parse_int(&telem->rssi, words[5]);
+       if (version <= 2) {
+               /* Older telemetry versions mis-computed the rssi value */
+               telem->rssi = (telem->rssi + 74) / 2 - 74;
+       }
        cc_parse_string(telem->state, sizeof (telem->state), words[9]);
        cc_parse_int(&telem->tick, words[10]);
        cc_parse_int(&telem->accel, words[12]);