Skip to content

Commit 94c7330

Browse files
committed
osd_printf_debug -> logmacro.h + LOG + logerrer
1 parent 41f1b04 commit 94c7330

File tree

3 files changed

+30
-21
lines changed

3 files changed

+30
-21
lines changed

src/mame/ensoniq/esqpanel.cpp

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414

1515
#include "main.h"
1616

17-
//**************************************************************************
18-
// External panel support
19-
//**************************************************************************
17+
#define VERBOSE 0
18+
#include "logmacro.h"
2019

2120
#include <list>
2221
#include <mutex>
@@ -123,16 +122,16 @@ void esqpanel_device::rcv_complete() // Rx completed receiving byte
123122
receive_register_extract();
124123
uint8_t data = get_received_char();
125124

126-
// if (data >= 0xe0) prinosd_printf_debugtf("Got %02x from motherboard (second %s)\n", data, m_expect_calibration_second_byte ? "yes" : "no");
125+
// if (data >= 0xe0) LOG("Got %02x from motherboard (second %s)\n", data, m_expect_calibration_second_byte ? "yes" : "no");
127126

128127
send_to_display(data);
129128

130129
if (m_expect_calibration_second_byte)
131130
{
132-
// osd_printf_debug("second byte is %02x\n", data);
131+
// LOG("second byte is %02x\n", data);
133132
if (data == 0xfd) // calibration request
134133
{
135-
// osd_printf_debug("let's send reply!\n");
134+
// LOG("let's send reply!\n");
136135
xmit_char(0xff); // this is the correct response for "calibration OK"
137136
}
138137
m_expect_calibration_second_byte = false;
@@ -198,7 +197,7 @@ void esqpanel_device::rcv_complete() // Rx completed receiving byte
198197

199198
void esqpanel_device::tra_complete() // Tx completed sending byte
200199
{
201-
// osd_printf_debug("panel Tx complete\n");
200+
// LOG("panel Tx complete\n");
202201
// is there more waiting to send?
203202
if (m_xmit_read != m_xmit_write)
204203
{
@@ -221,7 +220,7 @@ void esqpanel_device::tra_callback() // Tx send bit
221220

222221
void esqpanel_device::xmit_char(uint8_t data)
223222
{
224-
// osd_printf_debug("Panel: xmit %02x\n", data);
223+
// LOG("Panel: xmit %02x\n", data);
225224

226225
// if tx is busy it'll pick this up automatically when it completes
227226
if (!m_tx_busy)
@@ -252,16 +251,16 @@ uint16_t esqpanel_device::get_analog_value(offs_t offset)
252251

253252
void esqpanel_device::set_button(uint8_t button, bool pressed)
254253
{
255-
// osd_printf_debug("esqpanel.set_button(%d, %d)\r\n", button, pressed);
254+
LOG("set_button(%d, %d)\r\n", button, pressed);
256255
bool current = m_pressed_buttons.find(button) != m_pressed_buttons.end();
257256
if (pressed == current)
258257
{
259-
// osd_printf_debug("- button %d already %d, skipping\r\n", button, pressed);
258+
LOG("- button %d already %d, skipping\r\n", button, pressed);
260259
return;
261260
}
262261

263262
uint8_t sendme = (pressed ? 0x80 : 0) | (button & 0xff);
264-
// osd_printf_debug("button %d %s : sending char to mainboard: %02x\n", button, down ? "down" : "up", sendme);
263+
// LOG("button %d %s : sending char to mainboard: %02x\n", button, pressed ? "down" : "up", sendme);
265264
xmit_char(sendme);
266265
xmit_char(0x00);
267266
if (pressed)
@@ -280,7 +279,7 @@ TIMER_CALLBACK_MEMBER(esqpanel_device::check_external_panel_server) {
280279
{
281280
switch (c.kind) {
282281
case esq_external_panel_device::Command::ButtonKind:
283-
// osd_printf_debug("Panel Handling button event from external panel\r\n");
282+
LOG("Panel Handling button event from external panel\r\n");
284283
set_button(c.button, c.pressed);
285284
break;
286285

@@ -361,14 +360,14 @@ void esqpanel2x40_vfx_device::rcv_complete() // Rx completed receiving byte
361360
receive_register_extract();
362361
uint8_t data = get_received_char();
363362

364-
// if (data >= 0xe0) osd_printf_debug("Got %02x from motherboard (second %s)\n", data, m_expect_calibration_second_byte ? "yes" : "no");
363+
// if (data >= 0xe0) LOG("Got %02x from motherboard (second %s)\n", data, m_expect_calibration_second_byte ? "yes" : "no");
365364

366365
if (m_expect_calibration_second_byte)
367366
{
368-
// osd_printf_debug("second byte is %02x\n", data);
367+
// LOG("second byte is %02x\n", data);
369368
if (data == 0xfd) // calibration request
370369
{
371-
// osd_printf_debug("let's send reply!\n");
370+
// LOG("let's send reply!\n");
372371
xmit_char(0xff); // this is the correct response for "calibration OK"
373372
}
374373
m_expect_calibration_second_byte = false;
@@ -471,7 +470,7 @@ void esqpanel2x40_vfx_device::rcv_complete() // Rx completed receiving byte
471470
break;
472471

473472
default:
474-
// osd_printf_debug("Unknown control code %02x\n", data);
473+
// LOG("Unknown control code %02x\n", data);
475474
break;
476475
}
477476
}
@@ -668,15 +667,15 @@ INPUT_CHANGED_MEMBER(esqpanel2x40_vfx_device::analog_value_change)
668667
if (oldval == 255)
669668
{
670669
// This is the initial write from the layout. Skip this.
671-
osd_printf_debug("skipping initial write from internal panel to channnel %d\r\n", param);
670+
LOG("skipping initial write from internal panel to channnel %d\r\n", param);
672671
return;
673672
}
674673

675674
int channel = param;
676675
int clamped = std::max(0, std::min(100, (int)newval));
677676
int value = (1023 << 6) * clamped / 100;
678677
esqpanel_device::set_analog_value(channel, value);
679-
osd_printf_debug("sending analog channel %d value %d to external panel\r\n", channel, value);
678+
LOG("sending analog channel %d value %d to external panel\r\n", channel, value);
680679
m_external_panel->set_analog_value(channel, value);
681680
}
682681

@@ -692,12 +691,12 @@ void esqpanel2x40_vfx_device::set_analog_value(offs_t offset, uint16_t value)
692691
if (offset == 3)
693692
{
694693
set_adjuster_value(m_analog_data_entry, intvalue);
695-
osd_printf_debug("Setting data entry io port to %d\r\n", intvalue);
694+
LOG("Setting data entry io port to %d\r\n", intvalue);
696695
}
697696
else if (offset == 5)
698697
{
699698
set_adjuster_value(m_analog_volume, intvalue);
700-
osd_printf_debug("Setting volume io port to %d\r\n", intvalue);
699+
LOG("Setting volume io port to %d\r\n", intvalue);
701700
}
702701
}
703702

src/mame/ensoniq/esqpanel.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ class esqpanel_device : public device_t, public device_serial_interface
6868
bool m_expect_calibration_second_byte = false;
6969
bool m_expect_light_second_byte = false;
7070

71+
template <typename Format, typename... Params>
72+
void logerror(Format &&fmt, Params &&... args) const
73+
{
74+
util::stream_format(
75+
std::cerr,
76+
"[%s] %s",
77+
tag(),
78+
util::string_format(std::forward<Format>(fmt), std::forward<Params>(args)...));
79+
}
80+
7181
private:
7282
static const int XMIT_RING_SIZE = 16;
7383

src/mame/ensoniq/extpanel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <memory>
1515
#include <iostream>
1616

17-
#define VERBOSE 1
17+
#define VERBOSE 0
1818
#include "logmacro.h"
1919

2020
class esq_external_panel_device::context {

0 commit comments

Comments
 (0)