Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Undesired prints (ServerDrv::availData: SpiDrv not available) appear in console when using the library #10

Closed
grisharav opened this issue Jul 1, 2021 · 1 comment
Labels
invalid This doesn't seem right wontfix This will not be worked on

Comments

@grisharav
Copy link

Describe the bug

server_drv.cpp contains debug macros which cause undesired serial prints

#define _DEBUG_

#define KH_WIFININA_SERVER_DRV_DEBUG   1

And usage:

uint16_t ServerDrv::availData(uint8_t sock)
{
  if  (!SpiDrv::available()) 
  {
    // KH
#if (KH_WIFININA_SERVER_DRV_DEBUG > 0)
    Serial.println("ServerDrv::availData: SpiDrv not available");
#endif    
    return 0;
  }
 
  // KH
#if (KH_WIFININA_SERVER_DRV_DEBUG > 2)    
  Serial.println("ServerDrv::availData: SpiDrv OK");
#endif  

  WAIT_FOR_SLAVE_SELECT();
  // Send Command
  SpiDrv::sendCmd(AVAIL_DATA_TCP_CMD, PARAM_NUMS_1);
  SpiDrv::sendParam(&sock, sizeof(sock), LAST_PARAM);

  // pad to multiple of 4
  SpiDrv::readChar();
  SpiDrv::readChar();

  SpiDrv::spiSlaveDeselect();
  //Wait the reply elaboration
  SpiDrv::waitForSlaveReady();
  SpiDrv::spiSlaveSelect();

  // Wait for reply
  uint8_t _dataLen = 0;
  uint16_t len = 0;

  SpiDrv::waitResponseCmd(AVAIL_DATA_TCP_CMD, PARAM_NUMS_1, (uint8_t*)&len,  &_dataLen);

  SpiDrv::spiSlaveDeselect();
  
  // KH
#if (KH_WIFININA_SERVER_DRV_DEBUG > 2)
  Serial.print("ServerDrv::availData: len =");
  Serial.println(len);
#endif

  return len;
}
@khoih-prog
Copy link
Owner

Thanks for your interest in the library.

That's for the debugging purpose when there is some kind of error. It's so simple to remove, if you don't want, by

#define KH_WIFININA_SERVER_DRV_DEBUG   0

@khoih-prog khoih-prog added invalid This doesn't seem right wontfix This will not be worked on labels Jul 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants