Adding New Parameters to v1.15.4

Hi
I know I’ve seen posts about this before, and I feel like I’ve tried everything. I’m attempting to add a driver to v1.15.4 for a sensor I’m trying to use. I’ve been able to validate that it works by starting it via the nsh in QGC and am reading in data properly. The final step I have for integration is creating 3 parameters that I can set via QGC to enable, set the polling rate, and a mode. However, I can’t seem to get the parameters to show up. Below is the header that I created:

class MAX6675 :
	public device::SPI,  // ★ NEW: Integrates PX4 SPI device base class
	public I2CSPIDriver<MAX6675>,  // ★ NEW: Enables PX4 module autostart
	public ModuleParams
{
public:
	MAX6675(const I2CSPIDriverConfig &config); 
	~MAX6675() override;

	// Initialization (sets up SPI and schedules periodic Run())
	int init() override;

	// Main polling function (called on scheduled interval)
	void RunImpl();
	static int main(int argc, char *argv[]);
        static void print_usage();
protected:
	virtual int probe();

private:

	// Parameters
	DEFINE_PARAMETERS(
		(ParamInt<px4::params::MAX6675_POLL_MS>) _param_poll_ms,
		(ParamBool<px4::params::MAX6675_ENABLE>) _param_enable,
		(ParamBool<px4::params::MAX6675_FAHREN>) _param_fahren
	);

My module.yaml file:

module_name: MAX6675

parameters:
  - group: Sensors
    definitions:
      MAX6675_POLL_MS:
        description:
          short: Poll interval for MAX6675
          long: Sets how often the driver polls the MAX6675 SPI thermocouple sensor.

        type: int32
        unit: ms
        min: 10
        max: 1000
        default: 100
        reboot_required: false

      MAX6675_ENABLE:
        description:
          short: Enable MAX6675 thermocouple
          long: Enables Max6675 on external SPI bus

        type: boolean
        default: false
        reboot_required: true

      MAX6675_FAHREN:
        description:
          short: Fahrenheit output flag
          long: If true, the driver will convert temperature to Fahrenheit. Otherwise, output is in Celsius.

        type: boolean
        default: false
        reboot_required: false

And my CMakeLists.txt:

if(CONFIG_DRIVERS_THERMOCOUPLE_MAX6675)

px4_add_module(
	MODULE drivers__thermocouple__max6675
	MAIN max6675
	SRCS
		max6675.cpp
		max6675.hpp
	MODULE_CONFIG
		module.yaml
	DEPENDS
		px4_platform
)


endif()

I’ve seen this post: Custom parameters' description not showing in QGC - #4 by whiss
And have followed the steps in that. However, when I run that command I see the build directory populate for px4_sitl_default. I’ve still compiled for my board (cubepilot_cubeorange) and then flashed with QGC, and the parameters don’t appear.
I’ve tried reinstalling QGC to see if that would work and it didn’t.

I looked at this: Parameters & Configurations | PX4 Guide (v1.15)
And tried doing make parameters_metadata, but I still only see it generated for sitl. Tried flashing anyways and didn’t work.

I switched to getting the metadata to work for my target board. I did make cubepilot_cubeorange metadata_parameters (parameters_metadata yielded unknown target), and I was able to see the build directory had cubepilot_cubeorange_default. However, I didn’t see anything related to parameters. I then tried make cubepilot_cubeorange all_metadata and that build contained generated_params_metadata and had my parameters.
I then did a make on my board and uncompressed the parameters.json.xz in the etc/extras of the build directory and confirmed that I saw my parameters in there. I then flashed with QGC (Advanced settings with custom firmware file) and went into the .config/QGroundControl.org and checked the ParameterFactMetaData.xml and saw the parameters in there.

When I run param show -a in the nsh, I can see my parameters there, but I can’t see then in the Vehicle Setup->Parameters when I search for them.
Is there something that I’m missing?

I’m not sure what’s missing in terms of getting the param metadata to show up correctly in QGC. I’d have to dive deeper into it.

However, I assume you’re aware that you can just hardcode starting the sensor driver in the overall startup script rcS or in a board or airframe specific one.

And if you wrap it in a if, then, fi, it will continue the rest of the script if the sensor is not found and the start command fails.

Yeah I rolled that in already. I was mainly just hoping to be able to enable/disable it in the QGC params section instead of the nsh.

Ok.

@bkueng do you have any notes on how to make the params and param metadtaa available in QGC?

I think parameters should be ‘used’ by PX4 to be visible in QGC’s parameters tab.
Maybe there’s a better way to do that other than my “trick” described below:

I solve it by making the module run at least once in order for its parameters to show in QGC.
It doesn’t have to actively run. I’ve got a module that isn’t looped, it runs once and exits.
To have the parameters available, I added an extras.txt to the SD card to it runs once.