2022-09-26 20:23:48 -03:00
/*
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 , either version 3 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
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 this program . If not , see < http : //www.gnu.org/licenses/>.
*/
2022-09-12 16:48:05 -03:00
# include "AP_TemperatureSensor_Params.h"
# include "AP_TemperatureSensor.h"
# if AP_TEMPERATURE_SENSOR_ENABLED
2022-09-26 20:23:48 -03:00
# ifndef AP_TEMPERATURE_SENSOR_I2C_ADDR_DEFAULT
# define AP_TEMPERATURE_SENSOR_I2C_ADDR_DEFAULT 0
# endif
# ifndef AP_TEMPERATURE_SENSOR_I2C_BUS_DEFAULT
# define AP_TEMPERATURE_SENSOR_I2C_BUS_DEFAULT 0
2022-09-12 16:48:05 -03:00
# endif
2022-09-26 20:23:48 -03:00
# ifndef AP_TEMPERATURE_SENSOR_SOURCE_ID_DEFAULT
# define AP_TEMPERATURE_SENSOR_SOURCE_ID_DEFAULT -1
2022-09-12 16:48:05 -03:00
# endif
const AP_Param : : GroupInfo AP_TemperatureSensor_Params : : var_info [ ] = {
// @Param: TYPE
// @DisplayName: Temperature Sensor Type
// @Description: Enables temperature sensors
2022-09-26 23:29:13 -03:00
// @Values: 0:Disabled, 1:TSYS01, 2:MCP9600
2022-09-12 16:48:05 -03:00
// @User: Standard
// @RebootRequired: True
2022-10-11 15:59:59 -03:00
AP_GROUPINFO_FLAGS ( " TYPE " , 1 , AP_TemperatureSensor_Params , type , ( float ) Type : : NONE , AP_PARAM_FLAG_ENABLE ) ,
2022-09-12 16:48:05 -03:00
// @Param: BUS
2022-09-26 20:23:48 -03:00
// @DisplayName: Temperature sensor bus
// @Description: Temperature sensor bus number, typically used to select from multiple I2C buses
2022-09-12 16:48:05 -03:00
// @Range: 0 3
// @User: Advanced
// @RebootRequired: True
2022-09-26 20:23:48 -03:00
AP_GROUPINFO ( " BUS " , 2 , AP_TemperatureSensor_Params , bus , AP_TEMPERATURE_SENSOR_I2C_BUS_DEFAULT ) ,
2022-09-12 16:48:05 -03:00
// @Param: ADDR
2022-09-26 20:23:48 -03:00
// @DisplayName: Temperature sensor address
// @Description: Temperature sensor address, typically used for I2C address
2022-09-12 16:48:05 -03:00
// @Range: 0 127
// @User: Advanced
// @RebootRequired: True
2022-09-26 20:23:48 -03:00
AP_GROUPINFO ( " ADDR " , 3 , AP_TemperatureSensor_Params , bus_address , AP_TEMPERATURE_SENSOR_I2C_ADDR_DEFAULT ) ,
2022-09-12 16:48:05 -03:00
2022-09-02 18:26:15 -03:00
// @Param: SRC
// @DisplayName: Sensor Source
// @Description: Sensor Source is used to match up the source of the temperature data and populate the appropriate system-component. If 0 (None) then the data is only available via log.
// @Values: 0: None, 1:ESC, 2:Motor, 3:Battery Index, 4:Battery ID/SerialNumber
// @User: Standard
2022-10-11 15:59:59 -03:00
AP_GROUPINFO ( " SRC " , 4 , AP_TemperatureSensor_Params , source , ( float ) Source : : None ) ,
2022-09-02 18:26:15 -03:00
// @Param: SRC_ID
// @DisplayName: Sensor Source Identification
// @Description: Sensor Source Identification is used to populate a specific instance of a system component. Examples: TEMP_SRC = 1 (ESC), TEMP_SRC_INDEX = 1 will set the temp of ESC1. TEMP_SRC = 3 (BatteryIndex),TEMP_SRC_INDEX=2 will set the temp of BATT2. TEMP_SRC = 4 (BatteryId?SerialNum),TEMP_SRC_INDEX=42 will set the temp of all batteries that have param BATTn_SERIAL = 42.
AP_GROUPINFO ( " SRC_ID " , 5 , AP_TemperatureSensor_Params , source_id , AP_TEMPERATURE_SENSOR_SOURCE_ID_DEFAULT ) ,
2022-09-12 16:48:05 -03:00
AP_GROUPEND
} ;
AP_TemperatureSensor_Params : : AP_TemperatureSensor_Params ( void ) {
AP_Param : : setup_object_defaults ( this , var_info ) ;
}
# endif // AP_TEMPERATURE_SENSOR_ENABLED