[actuators] fix and clean

This commit is contained in:
Gautier Hattenberger
2012-10-19 22:54:38 +02:00
parent f30b8d6469
commit 67768facc4
13 changed files with 15 additions and 51 deletions
+1 -1
View File
@@ -214,7 +214,7 @@
<firmware name="lisa_test_progs">
<target name="test_led" board="lisa_l_1.1"/>
<target name="test_uart" board="lisa_l_1.1"/>
<!--target name="test_servos" board="lisa_l_1.1"/-->
<target name="test_servos" board="lisa_l_1.1"/>
<target name="test_telemetry" board="lisa_l_1.1"/>
<target name="test_baro" board="lisa_l_1.1"/>
<target name="test_imu_b2" board="lisa_l_1.1"/>
+1 -1
View File
@@ -11,7 +11,7 @@
<target name="test_led" board="lisa_m_2.0"/>
<target name="test_sys_time" board="lisa_m_2.0"/>
<target name="test_uart" board="lisa_m_2.0"/>
<!--target name="test_servos" board="lisa_m_2.0"/-->
<target name="test_servos" board="lisa_m_2.0"/>
<target name="test_telemetry" board="lisa_m_2.0"/>
<target name="test_baro" board="lisa_m_2.0"/>
<target name="test_rc_spektrum" board="lisa_m_2.0"/>
-1
View File
@@ -140,7 +140,6 @@ test_servos.srcs = $(COMMON_TEST_SRCS)
test_servos.CFLAGS += -I$(SRC_LISA)
test_servos.LDFLAGS += -lm
test_servos.srcs += $(SRC_LISA)/test_servos.c
test_servos.srcs += subsystems/actuators/actuators_pwm.c
test_servos.srcs += $(SRC_ARCH)/subsystems/actuators/actuators_pwm_arch.c
ifeq ($(BOARD), lisa_m)
test_servos.CFLAGS += -DUSE_SERVOS_7AND8
@@ -82,6 +82,7 @@ nps.srcs += $(SRC_FIRMWARE)/telemetry.c \
subsystems/datalink/downlink.c \
$(SRC_ARCH)/ivy_transport.c
nps.srcs += subsystems/actuators.c
nps.srcs += $(SRC_FIRMWARE)/commands.c
nps.srcs += $(SRC_FIRMWARE)/datalink.c
@@ -1,5 +1,4 @@
$(TARGET).CFLAGS += -DACTUATORS
$(TARGET).srcs += subsystems/actuators/actuators_pwm.c
$(TARGET).srcs += $(SRC_ARCH)/subsystems/actuators/actuators_pwm_arch.c
@@ -19,9 +19,10 @@
* Boston, MA 02111-1307, USA.
*/
#include "std.h"
#include "subsystems/actuators.h"
#include "subsystems/actuators/actuators_pwm_arch.h"
#include "std.h"
#include BOARD_CONFIG
#include "generated/airframe.h"
/* 40 Hz */
#ifndef SERVOS_PERIOD
@@ -115,6 +115,4 @@ extern const uint8_t pwm_latch_value;
PWMLER = pwm_latch_value; \
}
extern void actuators_pwm_arch_init(void);
#endif /* ACTUATORS_PWM_ARCH_H */
@@ -23,7 +23,6 @@
* STM32 PWM servos handling.
*/
#include "subsystems/actuators.h"
#include "subsystems/actuators/actuators_pwm_arch.h"
#include <libopencm3/stm32/f1/gpio.h>
@@ -40,7 +40,6 @@
extern int32_t actuators_pwm_values[ACTUATORS_PWM_NB];
extern void actuators_pwm_arch_init(void);
extern void actuators_pwm_commit(void);
#define SERVOS_TICS_OF_USEC(_v) (_v)
+3 -3
View File
@@ -42,7 +42,7 @@ int main(void) {
static inline void main_init( void ) {
mcu_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
actuators_init();
ActuatorsPwmInit();
}
static inline void main_periodic( void ) {
@@ -50,9 +50,9 @@ static inline void main_periodic( void ) {
foo += 0.0025;
int32_t bar = 1500 + 500. * sin(foo);
for (int i = 0; i < ACTUATORS_PWM_NB; i++) {
actuators_pwm_values[i] = bar;
ActuatorPwmSet(i, bar);
}
actuators_pwm_commit();
ActuatorsPwmCommit();
LED_PERIODIC();
}
@@ -1,29 +0,0 @@
/*
* Copyright (C) 2010-2012 The Paparazzi Team
*
* This file is part of Paparazzi.
*
* Paparazzi 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; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "subsystems/actuators/actuators_pwm.h"
void actuators_pwm_init(void)
{
// implemented in arch files
actuators_pwm_arch_init();
}
@@ -22,16 +22,13 @@
#ifndef ACTUATORS_PWM_H
#define ACTUATORS_PWM_H
#include "std.h"
#include "generated/airframe.h"
#include BOARD_CONFIG
#include "subsystems/actuators/actuators_pwm_arch.h"
extern void actuators_pwm_init(void);
#define ActuatorsPwmInit() actuators_pwm_init()
/* ActuatorSet and ActuatorsPwmCommit are implemented in arch files
/** Arch dependent init file.
* implemented in arch files
*/
extern void actuators_pwm_arch_init(void);
#define ActuatorsPwmInit() actuators_pwm_arch_init()
#endif /* ACTUATORS_PWM_H */
+1 -1
View File
@@ -101,7 +101,7 @@ void nps_autopilot_run_step(double time __attribute__ ((unused))) {
/* scale final motor commands to 0-1 for feeding the fdm */
/* FIXME: autopilot.commands is of length NB_COMMANDS instead of number of motors */
for (uint8_t i=0; i<MOTOR_MIXING_NB_MOTOR; i++)
autopilot.commands[i] = (double)(motor_mixing.commands[i]/MAX_PPRZ);
autopilot.commands[i] = (double)motor_mixing.commands[i]/MAX_PPRZ;
}