Skip to content

Commit 04f1275

Browse files
authored
Enforce limit at runtime rather than static assertion
1 parent 53ffa5d commit 04f1275

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/AdvancedADC.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class AdvancedADC {
4848
SampleBuffer read();
4949
int begin(uint32_t resolution, uint32_t sample_rate, size_t n_samples, size_t n_buffers);
5050
int begin(uint32_t resolution, uint32_t sample_rate, size_t n_samples, size_t n_buffers, size_t n_pins, pin_size_t *pins) {
51-
static_assert(n_pins < AN_MAX_ADC_CHANNELS, "A maximum of 5 channels can be sampled successively.");
51+
if (n_pins > AN_MAX_ADC_CHANNELS) n_pins = AN_MAX_ADC_CHANNELS;
5252
for (size_t i = 0; i < n_pins; ++i) {
5353
adc_pins[i] = analogPinToPinName(pins[i]);
5454
}

0 commit comments

Comments
 (0)