Skip to content

Commit 4591878

Browse files
committed
altos: re-number csm85clio outputs 0..49 to match schematic and silkscreen
1 parent 7b24be2 commit 4591878

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/csm84clio-v0.1/ao_csm84clio.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ fet outputs[] = {
8383
static void
8484
ao_fet_control(uint32_t output, uint8_t value)
8585
{
86-
/* map output 1-50 to corresponding GPIO port and pin, set to value */
87-
ao_gpio_set(outputs[output - 1].port, outputs[output - 1].pin, value);
86+
/* map output 0-49 to corresponding GPIO port and pin, set to value */
87+
ao_gpio_set(outputs[output].port, outputs[output].pin, value);
8888
}
8989

9090
static void
@@ -107,8 +107,8 @@ ao_fet_on(void)
107107
output = ao_cmd_decimal();
108108
if (ao_cmd_status != ao_cmd_success)
109109
return;
110-
if ((output < 1) || (output > 50))
111-
printf ("Invalid FET selection %lu, must be 1..50\n", output);
110+
if (output > 49) /* can't be less than 0 since unsigned! */
111+
printf ("Invalid FET selection %lu, must be 0..49\n", output);
112112
else {
113113
ao_fet_control(output, 1);
114114
ao_led_on(AO_LED_RED);
@@ -123,8 +123,8 @@ ao_fet_off(void)
123123
output = ao_cmd_decimal();
124124
if (ao_cmd_status != ao_cmd_success)
125125
return;
126-
if ((output < 1) || (output > 50))
127-
printf ("Invalid FET selection %lu, must be 1..50\n", output);
126+
if (output > 49) /* can't be less than 0 since unsigned! */
127+
printf ("Invalid FET selection %lu, must be 0..49\n", output);
128128
else {
129129
ao_fet_control(output, 0);
130130
ao_led_off(AO_LED_RED);

0 commit comments

Comments
 (0)