1 /* ============================================================================
2 Copyright (C) 2010 nomrasco
3 Nom Rasco <nomrasco@gmail.com>
5 This file is part of libnomaccel.
7 libnomaccel is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 libnomaccel is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public License
18 along with libnomaccel. If not, see <http://www.gnu.org/licenses/>.
19 ============================================================================ */
20 #include "../accel-neutral-settings.h"
23 NomAccelNeutralSetting nom_accel_nsettings_get_current ()
25 return _accel_settings_current;
28 void nom_accel_nsettings_set_current (NomAccelNeutralSetting settings)
30 if (settings >= NOM_ACCEL_SETTINGS_NUMBER) return;
31 _accel_settings_current = settings;
34 void nom_accel_nsettings_set_neutral_pitch ( NomAccelNeutralSetting settings,
37 if (settings >= NOM_ACCEL_SETTINGS_NUMBER) return;
38 if (settings <= NOM_ACCEL_ZERO_NEUTRAL) return;
39 _accel_settings[settings].pitch_neutral = new_pitch;
41 if (settings == NOM_ACCEL_SYSTEM_NEUTRAL) _accel_nsettings_save_system ();
44 void nom_accel_nsettings_set_neutral_roll ( NomAccelNeutralSetting settings,
47 if (settings >= NOM_ACCEL_SETTINGS_NUMBER) return;
48 if (settings <= NOM_ACCEL_ZERO_NEUTRAL) return;
49 _accel_settings[settings].roll_neutral = new_roll;
51 if (settings == NOM_ACCEL_SYSTEM_NEUTRAL) _accel_nsettings_save_system ();
54 angle nom_accel_nsettings_get_neutral_pitch (NomAccelNeutralSetting settings)
56 if (settings >= NOM_ACCEL_SETTINGS_NUMBER) return;
57 return _accel_settings[settings].pitch_neutral;
60 angle nom_accel_nsettings_get_neutral_roll (NomAccelNeutralSetting settings)
62 if (settings >= NOM_ACCEL_SETTINGS_NUMBER) return;
63 return _accel_settings[settings].roll_neutral;
67 _accel_nsettings_read_system ()
69 // load system settings from conf file (if not exists, set to zero settings)
70 // TODO: pseudo-implement this
72 // set system settings as a current local settings
73 _accel_settings[NOM_ACCEL_LOCAL_NEUTRAL] = _accel_settings[NOM_ACCEL_SYSTEM_NEUTRAL];
76 _accel_settings[NOM_ACCEL_ZERO_NEUTRAL].pitch_offset = 0.0;
77 _accel_settings[NOM_ACCEL_ZERO_NEUTRAL].roll_offset = 0.0;
81 _accel_nsettings_save_system ()
83 // set system settings as a current local settings
84 // TODO: pseudo-implement this