void TemperatureWriter::redraw(FlashGraphics& flash,const Point& p,const DefaultTemperatureReader::Result& result) {

    uint16_t width;

    if(result.Status==DefaultTemperatureReader::Result::NO_ERROR) {
      
      // clear broken symbol
      
      Panel::LcdPanel& gl(flash.getGraphicsLibrary());

      gl.setBackground(_backgroundColour);
      gl.clearRectangle(Rectangle(p.X+_brokenIconOffset.Width,p.Y+_height-BROKEN_HEIGHT+_brokenIconOffset.Height,_digits[BROKEN].Width,BROKEN_HEIGHT));

      // write the number

      width=IntegerNumberWriter::write(flash,p,result.Temperature);

      // write the degrees C symbol

      flash.drawBitmap(
          Rectangle(p.X+width,p.Y,_digits[DEGREES_C].Width,_height),
          _digits[DEGREES_C].FlashAddress,
          _digits[DEGREES_C].Length);

      width+=_digits[DEGREES_C].Width;

      // erase any background overhang from last time

      if(width<_lastWidth) {

        Panel::LcdPanel& gl(flash.getGraphicsLibrary());

        gl.setBackground(_backgroundColour);
        gl.clearRectangle(Rectangle(p.X+width,p.Y,_lastWidth-width,_height));
      }

      _lastWidth=width;
    }
    else {
      
      // erase any background overhang from last time it shows a temperature value
      
      Panel::LcdPanel& gl(flash.getGraphicsLibrary());

      gl.setBackground(_backgroundColour);
      gl.clearRectangle(Rectangle(p.X,p.Y,_brokenIconOffset.Width,_height));

      // there's something wrong with the comms, show a "broken" icon

      flash.drawBitmap(
          Rectangle(p.X+_brokenIconOffset.Width,p.Y+_height-BROKEN_HEIGHT+_brokenIconOffset.Height,_digits[BROKEN].Width,BROKEN_HEIGHT),
          _digits[BROKEN].FlashAddress,
          _digits[BROKEN].Length);
    }
  }
  void ControlPage::drawCheck(
      FlashGraphics& flash,
      uint8_t selbtn,
      uint32_t offset,
      uint32_t length,
      Panel::tCOLOUR colour,
      uint8_t deselbtn) const {

    // draw the checkbox

    flash.drawBitmap(
        Rectangle(GuiButtons[selbtn].X+GuiButtons[selbtn].Width-26-7,
                  GuiButtons[selbtn].Y+7,
                  26,
                  26),
                  offset,
                  length);

    // erase other checkbox space

    _gl.setForeground(colour);
    _gl.fillRectangle(
        Rectangle(GuiButtons[deselbtn].X+GuiButtons[deselbtn].Width-26-7,
                  GuiButtons[deselbtn].Y+7,
                  26,
                  26));
  }
Exemple #3
0
void ReflowPage::drawTemperatureIcon(FlashGraphics& flash) {

    // this is the thermometer at the top of the purple box

    flash.drawBitmap(
        Rectangle(586,18,FlashInfo::THERMOMETER::WIDTH,FlashInfo::THERMOMETER::HEIGHT),
        FlashInfo::THERMOMETER::OFFSET,
        FlashInfo::THERMOMETER::LENGTH
    );
}
Exemple #4
0
void ReflowPage::drawAxes(FlashGraphics& flash) const {

    Panel::LcdPanel& gl(_panel.getGraphicsLibrary());

    // draw the Y label

    flash.drawBitmap(
        Rectangle(LEFT_MARGIN+6,
                  TOP_MARGIN,
                  FlashInfo::DEGREESC_BLACK::WIDTH,
                  FlashInfo::DEGREESC_BLACK::WIDTH
                 ),
        FlashInfo::DEGREESC_BLACK::OFFSET,
        FlashInfo::DEGREESC_BLACK::LENGTH);

    // the most efficient way to draw these 2px wide axes is to use the
    // rectangle function

    gl.setForeground(ColourNames::GREY70);

    // X-axis

    gl.fillRectangle(
        Rectangle(
            LEFT_MARGIN,
            Panel::HEIGHT-BOTTOM_MARGIN-1,
            X_AXIS_WIDTH,
            2
        )
    );

    // Y-axis

    gl.fillRectangle(
        Rectangle(
            LEFT_MARGIN,
            TOP_MARGIN,
            2,
            Y_AXIS_HEIGHT
        )
    );

}