@@ -83,8 +83,8 @@ fet outputs[] = {
83
83
static void
84
84
ao_fet_control (uint32_t output , uint8_t value )
85
85
{
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 );
88
88
}
89
89
90
90
static void
@@ -107,8 +107,8 @@ ao_fet_on(void)
107
107
output = ao_cmd_decimal ();
108
108
if (ao_cmd_status != ao_cmd_success )
109
109
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 );
112
112
else {
113
113
ao_fet_control (output , 1 );
114
114
ao_led_on (AO_LED_RED );
@@ -123,8 +123,8 @@ ao_fet_off(void)
123
123
output = ao_cmd_decimal ();
124
124
if (ao_cmd_status != ao_cmd_success )
125
125
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 );
128
128
else {
129
129
ao_fet_control (output , 0 );
130
130
ao_led_off (AO_LED_RED );
0 commit comments