#ifndef EINK_H
#define EINK_H
#include <Arduino.h>
#include <GxEPD2_BW.h>
#include "epd/GxEPD2_213.h"
#include <U8g2_for_Adafruit_GFX.h>
#include "pins.hpp"

class Eink {
public:
    Eink(int csPin = EPD_CS, int dcPin = EPD_DC, int rstPin = EPD_RSET, int busyPin = EPD_BUSY);
    void setup_eink();
    void show_temp(float temperature);
    void show_internal_temp(int x, int y, float temperature);
    void show_count(int x, int y, float cnt, String unit);
    void show_display(String header, int wait=100);
    void drawBattery(int x, int y, int percentage=100);
    void drawSignalBars(int x, int y, int numBars);
    void display(bool partialupgrade = false);

private:
    U8G2_FOR_ADAFRUIT_GFX u8g2Fonts; 
    enum alignmentType {LEFT, RIGHT, CENTER};
    void drawMercury(float temperature);
    void drawString(int x, int y, String text, alignmentType alignment);
    void drawCircleSegment(int x0, int y0, int radius, int startAngle, int endAngle);
    GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> eink;
};


#endif /* EINK_H */