included ssd1322 display + GUI
This commit is contained in:
@@ -1,32 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <SPI.h>
|
||||
#include "board.h"
|
||||
|
||||
#ifdef HAS_SSD1306
|
||||
#include "SSD1306Wire.h"
|
||||
#include "OLEDDisplayUi.h"
|
||||
#endif
|
||||
#ifdef HAS_SSD1322
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <ESP8266_SSD1322.h>
|
||||
#endif
|
||||
#include <U8g2lib.h>
|
||||
#include <U8x8lib.h>
|
||||
|
||||
#include "measure.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#include "connect.h"
|
||||
|
||||
#include "image.h"
|
||||
|
||||
#define CONTROLSTRIP_YPOS 63 - 10 - 4
|
||||
#define CONTROLSLINE_YPOS 60
|
||||
#define CONTROLSLINE_H 4
|
||||
#define CONTROLSLINE_W 30
|
||||
#define DAILRADIUS 45
|
||||
#define DAILCENTERX 128/2
|
||||
#define DAILCENTERY DAILRADIUS+1
|
||||
#define CONTROLSTRIP_YPOS 40
|
||||
#define CONTROLSLINE_H 14
|
||||
#define CONTROLSLINE_W 64
|
||||
#define SCREENWIDTH 256
|
||||
#define CONTROLLOFFSET 0
|
||||
#define CONTROLRADIUS 6
|
||||
#define INDICATORWIDTH 29
|
||||
#define INDICATORHEIGHT 13
|
||||
#define INDICATORRADIUS 3
|
||||
|
||||
#define SCREENREFRESH 20
|
||||
|
||||
enum displayState
|
||||
{
|
||||
@@ -34,18 +28,76 @@ enum displayState
|
||||
setupscreen
|
||||
};
|
||||
|
||||
#ifdef HAS_SSD1306
|
||||
class c_displayMeasureMode
|
||||
typedef enum
|
||||
{
|
||||
public:
|
||||
const measureMode _mode;
|
||||
const uint16_t _xpos;
|
||||
const uint16_t _width;
|
||||
LocTop,
|
||||
LocRight,
|
||||
LocBottom,
|
||||
LocLeft,
|
||||
locNone
|
||||
}e_buttonLoc;
|
||||
|
||||
class c_onScreenButton
|
||||
{
|
||||
uint16_t _xpos;
|
||||
uint16_t _ypos;
|
||||
uint16_t _xTpos;
|
||||
uint16_t _yTpos;
|
||||
uint16_t _radius;
|
||||
uint16_t _width;
|
||||
uint16_t _height;
|
||||
|
||||
const String _name;
|
||||
c_displayMeasureMode(measureMode mode, uint16_t xpos, uint16_t width, String name) : _mode(mode), _xpos(xpos), _width(width), _name(name) {}
|
||||
void drawMeasureMode(OLEDDisplay *display, measureMode mode, int16_t x, int16_t y);
|
||||
const uint8_t _index;
|
||||
e_buttonLoc _location;
|
||||
|
||||
bool _state;
|
||||
bool _visible;
|
||||
|
||||
bool (*const _stateFn)() = NULL;
|
||||
|
||||
public:
|
||||
c_onScreenButton(String name, uint8_t index, e_buttonLoc location) :
|
||||
_xpos(1),
|
||||
_width(1),
|
||||
_name(name),
|
||||
_index(index),
|
||||
_location(location),
|
||||
_stateFn(NULL)
|
||||
{
|
||||
_visible = false;
|
||||
|
||||
}
|
||||
c_onScreenButton(String name, uint8_t index, e_buttonLoc location, bool (*stateFn)()) :
|
||||
_xpos(1),
|
||||
_width(1),
|
||||
_name(name),
|
||||
_index(index),
|
||||
_location(location),
|
||||
_stateFn(stateFn)
|
||||
{
|
||||
_visible = false;
|
||||
}
|
||||
|
||||
void drawButton();
|
||||
void begin(uint16_t xpos, uint16_t ypos, uint16_t width, uint16_t height, uint16_t radius);
|
||||
void setState(bool state) { _state = state; }
|
||||
bool getState(void)
|
||||
{
|
||||
if (_stateFn != NULL)
|
||||
{
|
||||
//Serial.printf("%s: call stateFn\n",_name.c_str());
|
||||
return _stateFn();
|
||||
}
|
||||
return _state;
|
||||
}
|
||||
|
||||
void setVisible(bool state) { _visible = state; }
|
||||
bool getVisible(void) { return _visible; }
|
||||
uint8_t getIndex(void) { return _index; }
|
||||
e_buttonLoc getLocation( void ) {return _location; }
|
||||
};
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
void initDisplay(void);
|
||||
void handleDisplay(void);
|
||||
Reference in New Issue
Block a user