Skip to content

Removing SPARK_CORE macro definition. Adding check against PLATFORM_I… #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions firmware/WebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@
#ifndef WEBDUINO_H_
#define WEBDUINO_H_

#define SPARK_CORE

#include <string.h>
#include <stdlib.h>
#include <stdarg.h>

#ifndef SPARK_CORE
#ifndef PLATFORM_ID
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
Expand All @@ -44,7 +42,11 @@

// TODO - this is necessary to avoid sockets being unexpectedly closed.
// https://community.spark.io/t/unwanted-but-reproducable-disconnect-in-tcpclient/5265
#if defined(PLATFORM_ID) && PLATFORM_ID < 3
#define fixmedelay() delay(20)
#else
#define fixmedelay()
#endif

/********************************************************************
* CONFIGURATION
Expand Down Expand Up @@ -142,7 +144,7 @@
#define SERIAL_DUMP(buf, len)
#endif

#if WEBDUINO_SERIAL_DEBUGGING && !defined(SPARK_CORE)
#if WEBDUINO_SERIAL_DEBUGGING && !defined(PLATFORM_ID)
#include <HardwareSerial.h>
#endif

Expand Down Expand Up @@ -339,8 +341,8 @@ class WebServer: public Print
// Close the current connection and flush ethernet buffers
void reset();
private:
#ifdef SPARK_CORE

#ifdef PLATFORM_ID
TCPServer m_server;
TCPClient m_client;
#else
Expand Down Expand Up @@ -472,8 +474,8 @@ void WebServer::flushBuf()
void WebServer::writeP(const unsigned char *data, size_t length)
{
// copy data out of program memory into local storage
#ifdef SPARK_CORE
fixmedelay();
#ifdef PLATFORM_ID
fixmedelay();
write(data, length);
#else
while (length--)
Expand All @@ -486,7 +488,7 @@ void WebServer::writeP(const unsigned char *data, size_t length)
void WebServer::printP(const unsigned char *str)
{
// copy data out of program memory into local storage
#ifdef SPARK_CORE
#ifdef PLATFORM_ID
fixmedelay();
write((const uint8_t*)str, strlen((const char*)str));
#else
Expand Down