Skip to content

Commit 898b0c9

Browse files
authored
Use sendReplyPacket in rs232_complete(), decoded bytes are unsigned (FujiNetWIFI#1063)
1 parent e17a8ae commit 898b0c9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/bus/rs232/FujiBusPacket.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,16 @@ bool FujiBusPacket::parse(const std::string &input)
108108
unsigned int idx, jdx;
109109
uint32_t val, bt;
110110

111+
Debug_printv("Incoming:\n%s\n", util_hexdump(input.data(), input.size()).c_str());
112+
111113
if (input.size() < sizeof(fujibus_header) + 2)
112114
return false;
113115
if (((uint8_t) input[0]) != SLIP_END || ((uint8_t) input.back()) != SLIP_END)
114116
return false;
115117

116118
decoded = decodeSLIP(input);
119+
Debug_printv("Decoded:\n%s\n", util_hexdump(decoded.data(), decoded.size()).c_str());
120+
117121
if (decoded.size() < sizeof(fujibus_header))
118122
return false;
119123
hdr = (fujibus_header *) &decoded[0];
@@ -139,7 +143,7 @@ bool FujiBusPacket::parse(const std::string &input)
139143
{
140144
for (val = jdx = 0; jdx < _fieldSize; jdx++)
141145
{
142-
bt = decoded[offset + idx * _fieldSize + jdx];
146+
bt = (uint8_t) decoded[offset + idx * _fieldSize + jdx];
143147
val |= bt << (8 * jdx);
144148
}
145149
_params.push_back(val);

lib/bus/rs232/rs232.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,13 @@ void virtualDevice::rs232_ack()
153153
// RS232 COMPLETE
154154
void virtualDevice::rs232_complete()
155155
{
156+
#ifdef OBSOLETE
156157
fnSystem.delay_microseconds(DELAY_T5);
157158
SYSTEM_BUS.write('C');
158159
Debug_println("COMPLETE!");
160+
#else
161+
SYSTEM_BUS.sendReplyPacket(_devnum, true, nullptr, 0);
162+
#endif /* OBSOLETE */
159163
}
160164

161165
// RS232 ERROR

0 commit comments

Comments
 (0)