From 4bbfea3cf2fa99f6a499d6f90a81f04017d17fc2 Mon Sep 17 00:00:00 2001 From: Scott Allen Date: Sun, 10 Aug 2014 15:37:48 -0400 Subject: [PATCH] Simplify slider widget drawFace() function. Use just one loop to draw all minor ticks. Use a second loop to extend lines for major ticks. Use totalTicks variable to determine number of ticks to draw. --- MicroView.cpp | 69 +++++++++++---------------------------------------- 1 file changed, 15 insertions(+), 54 deletions(-) diff --git a/MicroView.cpp b/MicroView.cpp index 82938a2..4cf7372 100644 --- a/MicroView.cpp +++ b/MicroView.cpp @@ -1460,71 +1460,32 @@ MicroViewSlider::MicroViewSlider(uint8_t newx, uint8_t newy, int16_t min, int16_ Draw image/diagram representing the widget's face. */ void MicroViewSlider::drawFace() { - uint8_t offsetX, offsetY, majorLine; + uint8_t offsetX, offsetY, endOffset; offsetX=getX(); offsetY=getY(); - - if (style==0) - majorLine=4; - else if (style==1) - majorLine=7; - else if (style==2) - majorLine=3; - else - majorLine=5; //Horizontal styles, style 0 or 1 - if (style==0 || style==1) { - // Draw major tickers - for (uint8_t i=0; i