Skip to content

Commit

Permalink
Reduce logging of Fujinet-PC in apple2
Browse files Browse the repository at this point in the history
  • Loading branch information
markjfisher committed Jan 26, 2024
1 parent 7bd67b1 commit 17c05fe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/bus/iwm/iwm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ void IRAM_ATTR iwmBus::service()
{
for (auto devicep : _daisyChain)
{
// This could be a map of _devnum to devicep, then wouldn't have to loop.
if (command_packet.dest == devicep->_devnum)
{
// wait for REQ to go low
Expand Down
28 changes: 19 additions & 9 deletions lib/bus/iwm/iwm_slip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,6 @@ int iwm_slip::iwm_send_packet_spi()
{
auto data = current_response->serialize();

// Some debug to remove
char *msg = util_hexdump(data.data(), data.size());
printf("iwm_slip::iwm_send_packet_spi\nresponse data (not including SLIP):\n%s\n", msg);
free(msg);

// send the data
try {
connection_->send_data(data);
Expand All @@ -167,9 +162,14 @@ void iwm_slip::encode_packet(uint8_t source, iwm_packet_type_t packet_type, uint
{
std::cout << "\niwm_slip::encode_packet\nsource: " << static_cast<unsigned int>(source) << ", packet type: " << ipt2str(packet_type) << ", status: " << static_cast<unsigned int>(status) << ", num: " << static_cast<unsigned int>(num) << std::endl;
if (num > 0) {
char *msg = util_hexdump(data, num);
printf("%s\n", msg);
int chars_to_print = num;
if (chars_to_print > 32) chars_to_print = 32;
char *msg = util_hexdump(data, chars_to_print);
printf("%s", msg);
free(msg);
if (chars_to_print < num) {
printf("... truncated\n");
}
}

// Create response object from data being given
Expand All @@ -185,9 +185,14 @@ size_t iwm_slip::decode_data_packet(uint8_t* output_data)
auto payload_size = current_request->payload_size();
std::cout << "\niwm_slip::decode_data_packet\nrequest payload size: " << payload_size << ", data:" << std::endl;
if (payload_size > 0) {
char *msg = util_hexdump(output_data, payload_size);
int chars_to_print = payload_size;
if (chars_to_print > 32) chars_to_print = 32;
char *msg = util_hexdump(output_data, chars_to_print);
printf("%s\n", msg);
free(msg);
if (chars_to_print < payload_size) {
printf("... truncated\n");
}
}

return current_request->payload_size();
Expand Down Expand Up @@ -262,9 +267,14 @@ void iwm_slip::wait_for_requests() {
while (is_responding_) {
auto request_data = connection_->wait_for_request();
if (!request_data.empty()) {
char *msg = util_hexdump(request_data.data(), request_data.size());
int chars_to_print = request_data.size();
if (chars_to_print > 32) chars_to_print = 32;
char *msg = util_hexdump(request_data.data(), chars_to_print);
printf("\nNEW Request data:\n%s\n", msg);
free(msg);
if (chars_to_print != request_data.size()) {
printf("... truncated\n");
}

std::lock_guard<std::mutex> lock(queue_mutex_);
request_queue_.push(request_data);
Expand Down

0 comments on commit 17c05fe

Please sign in to comment.