sersendf.c: explicitely cast to the requested size.
This adds 48 bytes binary size but should help to avoid confusion when using sersendf_P() for debugging.
This commit is contained in:
parent
43b2ac6e0b
commit
485427017d
26
sersendf.c
26
sersendf.c
|
|
@ -121,17 +121,21 @@ void sersendf_P(PGM_P format_P, ...) {
|
||||||
j = 4;
|
j = 4;
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
if (j == 4)
|
if (j == 1)
|
||||||
serwrite_uint32(GET_ARG(uint32_t));
|
serwrite_uint8((uint8_t)GET_ARG(uint16_t));
|
||||||
|
else if (j == 2)
|
||||||
|
serwrite_uint16((uint16_t)GET_ARG(uint16_t));
|
||||||
else
|
else
|
||||||
serwrite_uint16(GET_ARG(uint16_t));
|
serwrite_uint32(GET_ARG(uint32_t));
|
||||||
j = 0;
|
j = 0;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
if (j == 4)
|
if (j == 1)
|
||||||
serwrite_int32(GET_ARG(int32_t));
|
serwrite_int8((int8_t)GET_ARG(int16_t));
|
||||||
|
else if (j == 2)
|
||||||
|
serwrite_int16((uint16_t)GET_ARG(int16_t));
|
||||||
else
|
else
|
||||||
serwrite_int16(GET_ARG(int16_t));
|
serwrite_int32(GET_ARG(int32_t));
|
||||||
j = 0;
|
j = 0;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
|
|
@ -140,12 +144,12 @@ void sersendf_P(PGM_P format_P, ...) {
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
serial_writestr_P(PSTR("0x"));
|
serial_writestr_P(PSTR("0x"));
|
||||||
if (j == 4)
|
if (j == 1)
|
||||||
serwrite_hex32(GET_ARG(uint32_t));
|
serwrite_hex8((uint8_t)GET_ARG(uint16_t));
|
||||||
else if (j == 1)
|
else if (j == 2)
|
||||||
serwrite_hex8(GET_ARG(uint16_t));
|
serwrite_hex16((uint16_t)GET_ARG(uint16_t));
|
||||||
else
|
else
|
||||||
serwrite_hex16(GET_ARG(uint16_t));
|
serwrite_hex32(GET_ARG(uint32_t));
|
||||||
j = 0;
|
j = 0;
|
||||||
break;
|
break;
|
||||||
/* case 'p':
|
/* case 'p':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue