rc_proto: imu and gps send at pow 4
authorOlivier Matz <zer0@droids-corp.org>
Tue, 25 Nov 2014 22:20:43 +0000 (23:20 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Tue, 25 Nov 2014 22:20:43 +0000 (23:20 +0100)
mainboard/rc_proto.c

index cfe250e..cca8a78 100644 (file)
@@ -128,6 +128,8 @@ static struct callout rc_proto_timer;
  * the previous PL value (0 or 4) so we can alternate. */
 int8_t power_level_global = -1;
 
+#define POW_IMU_GPS 4
+
 /* update power level when we receive the answer from DB. The request is sent by
  * rc_proto_rx_power_probe(). */
 static int8_t update_power_level(int8_t retcode, void *frame, unsigned len,
@@ -844,10 +846,7 @@ static void rc_proto_cb(struct callout_mgr *cm, struct callout *tim, void *arg)
        if (rc_proto_flags & RC_PROTO_FLAGS_TX_GPS_POS) {
                diff = t - prev_gps_pos;
                if (diff > rc_proto_timers.send_gps_pos_ms) {
-                       pow_probe++;
-                       if (pow_probe > 4)
-                               pow_probe = 0;
-                       rc_proto_send_gps_pos(rc_proto_dstaddr, pow_probe);
+                       rc_proto_send_gps_pos(rc_proto_dstaddr, POW_IMU_GPS);
                        prev_gps_pos = t;
                }
        }
@@ -856,10 +855,7 @@ static void rc_proto_cb(struct callout_mgr *cm, struct callout *tim, void *arg)
        if (rc_proto_flags & RC_PROTO_FLAGS_TX_IMU_POS) {
                diff = t - prev_imu_pos;
                if (diff > rc_proto_timers.send_imu_pos_ms) {
-                       pow_probe++;
-                       if (pow_probe > 4)
-                               pow_probe = 0;
-                       rc_proto_send_imu_pos(rc_proto_dstaddr, pow_probe);
+                       rc_proto_send_imu_pos(rc_proto_dstaddr, POW_IMU_GPS);
                        prev_imu_pos = t;
                }
        }