
///
/// Dial drawing library : used to display anything from compass display to arcs of "meter" displays
///
#pragma once
#include <cstdint>

class displayDial_t
{
public:
  /// \param display the parent display
  /// \param x x pos
  /// \param y y pos
  /// \param siz = size
  /// \param angle Angle from straight up for lowest (-angle) and highest (angle) reading
  displayDial_t(display_t &display,
                uint8_t x,
                uint8_t y,
                uint8_t siz,
                uint16_t angle = 90);

  /// @brief Construct a display with angle from Angle high to angle low
  /// @param display
  /// @param x
  /// @param y
  /// @param siz
  /// @param angle_high Angle relative to straight up for highest reading
  /// @param angle_low Angle relative to straight up for lowest reading
  displayDial_t(display_t &display,
                uint8_t x,
                uint8_t y,
                uint8_t siz,
                int16_t angle_low,
                int16_t angle_high);

  /// @brief  Put the dial needle on the display 
  /// @param position values are from  0 .. math.SINE_STEPS 
  void draw_needle(int16_t position);


  // draw the scale
  /// \param low low end of range
  /// \param high high end of range
  /// \param width length of long marker
  /// \param num_step number of ticks
  /// \param scale
  void draw_scale(int16_t low, int16_t high, uint8_t width, uint8_t num_step, int16_t scale);

  /// print min/max limits
  void draw_limits();

private:
  display_t &m_display;
  uint8_t const m_xo;    ///< Position of origin
  uint8_t const m_yo;    ///< Position of origin
  uint8_t const m_siz;   ///< Display size
  int16_t const m_angleLow;  ///< Angle for lowest value
  int16_t const m_angleRange; ///< Angle range from lowest to highest  value
  int16_t m_low;         ///< lower scale limit
  int16_t m_high;        ///< upper scale limit
};
