Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CPS-VO
PX4-Firmware
Commits
9e8a02b9
Commit
9e8a02b9
authored
Oct 22, 2012
by
Lorenz Meier
Browse files
Switched to a more convenient audio tune
parent
3a267082
Changes
1
Hide whitespace changes
Inline
Side-by-side
apps/commander/commander.c
View file @
9e8a02b9
...
...
@@ -137,6 +137,7 @@ int commander_thread_main(int argc, char *argv[]);
static
int
buzzer_init
(
void
);
static
void
buzzer_deinit
(
void
);
static
void
tune_confirm
();
static
int
led_init
(
void
);
static
void
led_deinit
(
void
);
static
int
led_toggle
(
int
led
);
...
...
@@ -257,6 +258,10 @@ int trigger_audio_alarm(uint8_t old_mode, uint8_t old_state, uint8_t new_mode, u
return
0
;
}
void
tune_confirm
()
{
ioctl
(
buzzer
,
TONE_SET_ALARM
,
3
);
}
static
const
char
*
parameter_file
=
"/eeprom/parameters"
;
static
int
pm_save_eeprom
(
bool
only_unsaved
)
...
...
@@ -364,7 +369,7 @@ void do_mag_calibration(int status_pub, struct vehicle_status_s *status)
char
buf
[
50
];
sprintf
(
buf
,
"[commander] Please rotate around %c"
,
axislabels
[
axis_index
]);
mavlink_log_info
(
mavlink_fd
,
buf
);
ioctl
(
buzzer
,
TONE_SET_ALARM
,
2
);
tune_confirm
(
);
axis_deadline
+=
calibration_interval
/
3
;
}
...
...
@@ -838,10 +843,10 @@ void handle_command(int status_pub, struct vehicle_status_s *current_vehicle_sta
if
(
current_status
.
state_machine
==
SYSTEM_STATE_PREFLIGHT
)
{
mavlink_log_info
(
mavlink_fd
,
"[commander] CMD starting gyro calibration"
);
ioctl
(
buzzer
,
TONE_SET_ALARM
,
2
);
tune_confirm
(
);
do_gyro_calibration
(
status_pub
,
&
current_status
);
mavlink_log_info
(
mavlink_fd
,
"[commander] CMD finished gyro calibration"
);
ioctl
(
buzzer
,
TONE_SET_ALARM
,
2
);
tune_confirm
(
);
do_state_update
(
status_pub
,
&
current_status
,
mavlink_fd
,
SYSTEM_STATE_STANDBY
);
result
=
MAV_RESULT_ACCEPTED
;
}
else
{
...
...
@@ -858,10 +863,10 @@ void handle_command(int status_pub, struct vehicle_status_s *current_vehicle_sta
if
(
current_status
.
state_machine
==
SYSTEM_STATE_PREFLIGHT
)
{
mavlink_log_info
(
mavlink_fd
,
"[commander] CMD starting mag calibration"
);
ioctl
(
buzzer
,
TONE_SET_ALARM
,
2
);
tune_confirm
(
);
do_mag_calibration
(
status_pub
,
&
current_status
);
mavlink_log_info
(
mavlink_fd
,
"[commander] CMD finished mag calibration"
);
ioctl
(
buzzer
,
TONE_SET_ALARM
,
2
);
tune_confirm
(
);
do_state_update
(
status_pub
,
&
current_status
,
mavlink_fd
,
SYSTEM_STATE_STANDBY
);
result
=
MAV_RESULT_ACCEPTED
;
}
else
{
...
...
@@ -878,9 +883,9 @@ void handle_command(int status_pub, struct vehicle_status_s *current_vehicle_sta
if
(
current_status
.
state_machine
==
SYSTEM_STATE_PREFLIGHT
)
{
mavlink_log_info
(
mavlink_fd
,
"[commander] CMD starting accel calibration"
);
ioctl
(
buzzer
,
TONE_SET_ALARM
,
2
);
tune_confirm
(
);
do_accel_calibration
(
status_pub
,
&
current_status
);
ioctl
(
buzzer
,
TONE_SET_ALARM
,
2
);
tune_confirm
(
);
mavlink_log_info
(
mavlink_fd
,
"[commander] CMD finished accel calibration"
);
do_state_update
(
status_pub
,
&
current_status
,
mavlink_fd
,
SYSTEM_STATE_STANDBY
);
result
=
MAV_RESULT_ACCEPTED
;
...
...
@@ -1273,7 +1278,7 @@ int commander_thread_main(int argc, char *argv[])
}
else
if
(
bat_remain
<
0
.
2
f
&&
battery_voltage_valid
&&
(
counter
%
((
1000000
/
COMMANDER_MONITORING_INTERVAL
)
/
2
)
==
0
))
{
/* For less than 20%, start be slightly annoying at 1 Hz */
ioctl
(
buzzer
,
TONE_SET_ALARM
,
0
);
ioctl
(
buzzer
,
TONE_SET_ALARM
,
2
);
tune_confirm
(
);
}
else
if
(
bat_remain
<
0
.
2
f
&&
battery_voltage_valid
&&
(
counter
%
((
1000000
/
COMMANDER_MONITORING_INTERVAL
)
/
2
)
==
2
))
{
ioctl
(
buzzer
,
TONE_SET_ALARM
,
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment