[Nut-upsdev] Small fixes needed for Riello driver
Charles Lepple
clepple at gmail.com
Thu Jul 4 19:50:19 UTC 2013
On Apr 10, 2013, at 11:41 AM, Tim Rice wrote:
> On Wed, 10 Apr 2013, Elio Parisi wrote:
>
>> Sorry... now it should be ok.
>>
>
> drivers/riello_ser.c
> ......
> -extern BYTE commbyte;
> -extern int wait_packet;
> -extern int foundnak;
> -extern int foundbadcrc;
> -extern int buf_ptr_length;
> -extern BYTE requestSENTR;
> +extern uint8_t commbyte;
> +extern uint8_t wait_packet;
> +extern uint8_t foundnak;
> +extern uint8_t foundbadcrc;
> +extern uint8_t buf_ptr_length;
> +extern uint8_t requestSENTR;
> ......
>
> You did intend to change the int's to uint8_t, right?
Elio,
I agree with Tim - it seems like the found* variables and possibly wait_packet should be ints or booleans (but we don't have a standard boolean type).
> .....
> - BYTE commb = 0;
> + uint8_t commb = 0;
>
> realt = time(NULL);
> while (wait_packet) {
> serial_read(1000, &commb);
> nowt = time(NULL);
> - commbyte = (BYTE) commb;
> + commbyte = (uint8_t) commb;
> ^^^^^^^^^
> riello_parse_serialport(typedev, bufIn, gpser_error_control);
> .....
>
> If commbyte and comb are both uint8_t, there is no need for the cast.
Also worth checking.
How much has the code been tested after these changes? It doesn't look like anything should have changed, but it's always good to check.
After we clear up these two points, we can merge this into the master branch.
--
Charles Lepple
clepple at gmail
More information about the Nut-upsdev
mailing list