45 #include <px4_platform_common/getopt.h> 46 #include <px4_platform_common/log.h> 49 #ifndef GPIO_HEATER_OUTPUT 50 #error "To use the heater driver, the board_config.h must define and initialize GPIO_HEATER_OUTPUT" 54 ModuleParams(nullptr),
55 ScheduledWorkItem(MODULE_NAME,
px4::wq_configurations::lp_default)
58 px4_arch_configgpio(GPIO_HEATER_OUTPUT);
64 px4_arch_configgpio(GPIO_HEATER_OUTPUT);
71 PX4_INFO(
"not running");
87 px4_arch_gpiowrite(GPIO_HEATER_OUTPUT, 0);
118 px4_arch_gpiowrite(GPIO_HEATER_OUTPUT, 1);
136 for (uint8_t x = 0; x < number_of_imus; x++) {
154 PX4_ERR(
"Could not identify IMU sensor.");
160 PX4_INFO(
"Sensor ID: %d - Temperature: %3.3fC, Setpoint: %3.2fC, Heater State: %s",
163 (
double)_param_sens_imu_temp.get(),
184 PX4_ERR(
"driver allocation failed");
188 _object.store(heater);
189 _task_id = task_id_is_work_queue;
205 ModuleParams::updateParams();
212 printf(
"%s\n\n", reason);
215 PRINT_MODULE_DESCRIPTION(
218 Background process running periodically on the LP work queue to regulate IMU temperature at a setpoint. 220 This task can be started at boot from the startup scripts by setting SENS_EN_THERMAL or via CLI. 223 PRINT_MODULE_USAGE_NAME("heater",
"system");
224 PRINT_MODULE_USAGE_COMMAND(
"start");
225 PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
constexpr _Tp constrain(_Tp val, _Tp min_val, _Tp max_val)
static int custom_command(int argc, char *argv[])
main Main entry point to the module that should be called directly from the module's main method...
int main(int argc, char **argv)
uORB::Subscription _sensor_accel_sub
uORB::Subscription _parameter_update_sub
High-resolution timer with callouts and timekeeping.
int _controller_time_on_usec
void initialize_topics()
Called once to initialize uORB topics.
int _controller_period_usec
void Run() override
Calculates the heater element on/off time, carries out closed loop feedback and feedforward temperatu...
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
bool updated()
Check if there is a new update.
static int print_usage(const char *reason=nullptr)
Prints the module usage to the nuttshell console.
int orb_group_count(const struct orb_metadata *meta)
Get the number of published instances of a topic group.
int start()
Initiates the heater driver work queue, starts a new background task, and fails if it is already runn...
float _proportional_value
bool update(void *dst)
Update the struct.
float _sensor_temperature
static int task_spawn(int argc, char *argv[])
Initializes the class in the same context as the work queue and starts the background listener...
int print_status()
Reports curent status and diagnostic information about the heater driver.
sensor_accel_s _sensor_accel
bool copy(void *dst)
Copy the struct.
void update_params(const bool force=false)
Updates and checks for updated uORB parameters.
int heater_main(int argc, char *argv[])
Main entry point for the heater driver module.