Browse Source

Add debug msg prefix

And found DEBUG_MSG could not be used in the sensors header file.
rfm69
Yonsm 6 years ago
parent
commit
4947c259c4
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      code/espurna/sensors/PMSX003Sensor.h

+ 7
- 7
code/espurna/sensors/PMSX003Sensor.h View File

@ -106,7 +106,7 @@ public:
{ {
int avail = _serial->available(); int avail = _serial->available();
#if SENSOR_DEBUG #if SENSOR_DEBUG
//debugSend("%s: Packet available = %d\n", PMS_TYPE_NAME, avail);
//debugSend("[SENSOR] %s: Packet available = %d\n", PMS_TYPE_NAME, avail);
#endif #endif
if (avail < PMS_PACKET_SIZE) if (avail < PMS_PACKET_SIZE)
break; break;
@ -116,12 +116,12 @@ public:
uint16_t sum = 0x42 + 0x4D; uint16_t sum = 0x42 + 0x4D;
uint16_t size = read16(sum); uint16_t size = read16(sum);
#if SENSOR_DEBUG #if SENSOR_DEBUG
debugSend("%s: Payload size = %d\n", PMS_TYPE_NAME, size);
debugSend("[SENSOR] %s: Payload size = %d\n", PMS_TYPE_NAME, size);
#endif #endif
if (size != PMS_PAYLOAD_SIZE) if (size != PMS_PAYLOAD_SIZE)
{ {
#if SENSOR_DEBUG #if SENSOR_DEBUG
debugSend(("%s: Payload size != %d \n"), PMS_TYPE_NAME, PMS_PAYLOAD_SIZE);
debugSend(("[SENSOR] %s: Payload size != %d \n"), PMS_TYPE_NAME, PMS_PAYLOAD_SIZE);
#endif #endif
break; break;
} }
@ -130,13 +130,13 @@ public:
{ {
data[i] = read16(sum); data[i] = read16(sum);
#if SENSOR_DEBUG #if SENSOR_DEBUG
//debugSend(("%s: data[%d] = %d\n"), PMS_TYPE_NAME, i, data[i]);
//debugSend(("[SENSOR] %s: data[%d] = %d\n"), PMS_TYPE_NAME, i, data[i]);
#endif #endif
} }
uint16_t checksum = read16(); uint16_t checksum = read16();
#if SENSOR_DEBUG #if SENSOR_DEBUG
debugSend(("%s: Sum=%04X, Checksum=%04X\n"), PMS_TYPE_NAME, sum, checksum);
debugSend(("[SENSOR] %s: Sum=%04X, Checksum=%04X\n"), PMS_TYPE_NAME, sum, checksum);
#endif #endif
if (sum == checksum) if (sum == checksum)
{ {
@ -270,7 +270,7 @@ class PMSX003Sensor : public BaseSensor, PMSX003 {
readCycle = _readCount % 30; readCycle = _readCount % 30;
if (readCycle == 0) { if (readCycle == 0) {
#if SENSOR_DEBUG #if SENSOR_DEBUG
debugSend("%s: Wake up: %d\n", PMS_TYPE_NAME, _readCount);
debugSend("[SENSOR] %s: Wake up: %d\n", PMS_TYPE_NAME, _readCount);
#endif #endif
wakeUp(); wakeUp();
return; return;
@ -306,7 +306,7 @@ class PMSX003Sensor : public BaseSensor, PMSX003 {
if (readCycle == 6) { if (readCycle == 6) {
sleep(); sleep();
#if SENSOR_DEBUG #if SENSOR_DEBUG
debugSend("%s: Enter sleep mode: %d\n", PMS_TYPE_NAME, _readCount);
debugSend("[SENSOR] %s: Enter sleep mode: %d\n", PMS_TYPE_NAME, _readCount);
#endif #endif
return; return;
} }


Loading…
Cancel
Save