mirror of
https://github.com/Klipper3d/klipper.git
synced 2026-03-04 17:14:38 -07:00
trigger_analog: Support not compiling trigger_analog on small flash builds
Allow the user to deselect CONFIG_WANT_TRIGGER_ANALOG even if one of the sensors could utilize the support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
41bc240b16
commit
a44e905ffe
6 changed files with 28 additions and 0 deletions
|
|
@ -263,6 +263,11 @@ config WANT_LDC1612
|
|||
config WANT_SENSOR_ANGLE
|
||||
bool "Support angle sensors"
|
||||
depends on WANT_SPI
|
||||
comment "Other features"
|
||||
depends on WANT_HX71X || WANT_ADS1220 || WANT_LDC1612
|
||||
config WANT_TRIGGER_ANALOG
|
||||
bool "Support for homing/probing events using analog sensors"
|
||||
depends on WANT_HX71X || WANT_ADS1220 || WANT_LDC1612
|
||||
endmenu
|
||||
|
||||
# Generic configuration options for CANbus
|
||||
|
|
|
|||
|
|
@ -122,8 +122,10 @@ ads1220_attach_trigger_analog(uint32_t *args) {
|
|||
struct ads1220_adc *ads1220 = oid_lookup(oid, command_config_ads1220);
|
||||
ads1220->ta = trigger_analog_oid_lookup(args[1]);
|
||||
}
|
||||
#if CONFIG_WANT_TRIGGER_ANALOG
|
||||
DECL_COMMAND(ads1220_attach_trigger_analog,
|
||||
"ads1220_attach_trigger_analog oid=%c trigger_analog_oid=%c");
|
||||
#endif
|
||||
|
||||
// start/stop capturing ADC data
|
||||
void
|
||||
|
|
|
|||
|
|
@ -211,8 +211,10 @@ hx71x_attach_trigger_analog(uint32_t *args) {
|
|||
struct hx71x_adc *hx71x = oid_lookup(oid, command_config_hx71x);
|
||||
hx71x->ta = trigger_analog_oid_lookup(args[1]);
|
||||
}
|
||||
#if CONFIG_WANT_TRIGGER_ANALOG
|
||||
DECL_COMMAND(hx71x_attach_trigger_analog, "hx71x_attach_trigger_analog oid=%c"
|
||||
" trigger_analog_oid=%c");
|
||||
#endif
|
||||
|
||||
// start/stop capturing ADC data
|
||||
void
|
||||
|
|
|
|||
|
|
@ -89,8 +89,10 @@ ldc1612_attach_trigger_analog(uint32_t *args) {
|
|||
struct ldc1612 *ld = oid_lookup(args[0], command_config_ldc1612);
|
||||
ld->ta = trigger_analog_oid_lookup(args[1]);
|
||||
}
|
||||
#if CONFIG_WANT_TRIGGER_ANALOG
|
||||
DECL_COMMAND(ldc1612_attach_trigger_analog,
|
||||
"ldc1612_attach_trigger_analog oid=%c trigger_analog_oid=%c");
|
||||
#endif
|
||||
|
||||
#define DATA_ERROR_AMPLITUDE (1L << 28)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,25 @@
|
|||
#define __TRIGGER_ANALOG_H
|
||||
|
||||
#include <stdint.h> // uint8_t
|
||||
#include "autoconf.h" // CONFIG_WANT_TRIGGER_ANALOG
|
||||
|
||||
#if CONFIG_WANT_TRIGGER_ANALOG
|
||||
|
||||
struct trigger_analog *trigger_analog_oid_lookup(uint8_t oid);
|
||||
void trigger_analog_note_error(struct trigger_analog *ta, uint8_t sensor_code);
|
||||
void trigger_analog_update(struct trigger_analog *ta, int32_t sample);
|
||||
|
||||
#else
|
||||
// Dummy versions of code to avoid compile errors when not using trigger_analog
|
||||
|
||||
static inline struct trigger_analog *trigger_analog_oid_lookup(uint8_t oid) {
|
||||
return NULL;
|
||||
}
|
||||
static inline void
|
||||
trigger_analog_note_error(struct trigger_analog *ta, uint8_t sensor_code) { }
|
||||
static inline void
|
||||
trigger_analog_update(struct trigger_analog *ta, int32_t sample) { }
|
||||
|
||||
#endif
|
||||
|
||||
#endif // trigger_analog.h
|
||||
|
|
|
|||
|
|
@ -6,3 +6,4 @@ CONFIG_WANT_LIS2DW=n
|
|||
CONFIG_WANT_LDC1612=n
|
||||
CONFIG_WANT_HX71X=n
|
||||
CONFIG_WANT_ADS1220=n
|
||||
CONFIG_WANT_TRIGGER_ANALOG=n
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue