Skip to content

Commit

Permalink
Disabled eeprom stuff on beagle for now, fixed private constructors.
Browse files Browse the repository at this point in the history
  • Loading branch information
l4m4re committed May 9, 2018
1 parent a95e421 commit f259481
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
19 changes: 12 additions & 7 deletions src/ExtendedSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ class ExtendedSerial : public Stream
ExtendedSerial(HardwareSerial& s) : _s(s) {}

// Methods delegated to existing Serial instance
#ifdef AVR
void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
void begin(unsigned long b, uint8_t m) { _s.begin(b,m); }
#else
void begin(unsigned long baud) { _s.begin(baud); }
#endif
void end() { _s.end(); }
virtual int available(void) { return _s.available(); }
virtual int peek(void) { return _s.peek(); }
Expand All @@ -95,7 +99,9 @@ class ExtendedSerial : public Stream
inline size_t write(long n) { return write((uint8_t)n); }
inline size_t write(unsigned int n) { return write((uint8_t)n); }
inline size_t write(int n) { return write((uint8_t)n); }
#ifdef AVR
virtual int availableForWrite(void) { return _s.availableForWrite(); }
#endif
operator bool() { return true; }

// Extra methods
Expand Down Expand Up @@ -142,16 +148,15 @@ class ExtendedSerial : public Stream
using Print::print; // pull in existing print methods from Print.
using Print::println; // pull in existing println methods from Print.

protected:
// Must be instantiated with a HardwareSerial&.
ExtendedSerial() {}
ExtendedSerial(ExtendedSerial&) {}
ExtendedSerial(int) {}
ExtendedSerial(const char*) {}

private:

HardwareSerial& _s;

// Must be instantiated with a HardwareSerial&.
ExtendedSerial();
ExtendedSerial(ExtendedSerial&);
ExtendedSerial(int);
ExtendedSerial(const char*);
};


Expand Down
8 changes: 6 additions & 2 deletions src/Map2D3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@

#ifdef AVR
#include <avr/eeprom.h>
#else
#include <EEPROM.h>
#endif


Expand Down Expand Up @@ -107,8 +109,10 @@ class Map
public:
virtual int memSize() const =0;

#ifdef AVR
virtual bool updateEeprom(uint8_t* dest) const =0;
virtual bool readEeprom( const uint8_t* src) =0;
#endif

virtual void printTo( Print& p, const uint8_t tabsize = 4,
const char delim = ' ' )=0;
Expand Down Expand Up @@ -173,7 +177,6 @@ class Map2D : public Map
float getYFloat( int i ) { return 0<=i<S ? static_cast<float>(ys[i]) : 0; }

#ifdef AVR

virtual bool updateEeprom(uint8_t* dest) const
{
if( !eeprom_is_ready() ) return false;
Expand Down Expand Up @@ -360,6 +363,7 @@ class Map3D : public Map
float getYFloat( int i, int j )
{ return 0<=i<R && 0<=j<C ? static_cast<float>(ys[i][j]) : 0; }

#ifdef AVR
virtual bool updateEeprom(uint8_t* dest) const
{
if( !eeprom_is_ready() ) return false;
Expand All @@ -381,7 +385,7 @@ class Map3D : public Map

return true;
}

#endif
#ifdef ARDUINO // Initialize from array in PROGMEM

void setX1s_P( const X* x1ss ) { memcpy_P( x1s, x1ss, R*sizeof(X) ); }
Expand Down

0 comments on commit f259481

Please sign in to comment.