diff --git a/drawing/Common.lua b/drawing/Common.lua index e99bab3..c64657c 100644 --- a/drawing/Common.lua +++ b/drawing/Common.lua @@ -2,8 +2,6 @@ local M = {} local Util = require 'Util' local Arc = require 'Arc' -local Dial = require 'Dial' -local CompoundDial = require 'CompoundDial' local Text = require 'Text' local CriticalText = require 'CriticalText' local TextColumn = require 'TextColumn' @@ -40,6 +38,9 @@ local PLOT_GRID_Y_N = 4 local ARC_WIDTH = 2 +local DIAL_THETA0 = 90 +local DIAL_THETA1 = 360 + -------------------------------------------------------------------------------- -- helper functions @@ -283,7 +284,7 @@ end M.dial = function(x, y, radius, thickness, threshold) return _G_Widget_.Dial( - _G_Widget_.make_semicircle(x, y, radius, 90, 360), + _G_Widget_.make_semicircle(x, y, radius, DIAL_THETA0, DIAL_THETA1), _G_Widget_.arc_style(thickness, _G_Patterns_.INDICATOR_BG), _G_Widget_.threshold_style( _G_Patterns_.INDICATOR_FG_PRIMARY, @@ -293,6 +294,24 @@ M.dial = function(x, y, radius, thickness, threshold) ) end +-------------------------------------------------------------------------------- +-- compound dial + +M.compound_dial = function(x, y, outer_radius, inner_radius, thickness, + threshold, num_dials) + return _G_Widget_.CompoundDial( + _G_Widget_.make_semicircle(x, y, outer_radius, DIAL_THETA0, DIAL_THETA1), + _G_Widget_.arc_style(thickness, _G_Patterns_.INDICATOR_BG), + _G_Widget_.threshold_style( + _G_Patterns_.INDICATOR_FG_PRIMARY, + _G_Patterns_.INDICATOR_FG_CRITICAL, + threshold + ), + inner_radius, + num_dials + ) +end + -------------------------------------------------------------------------------- -- separator (eg a horizontal line) diff --git a/drawing/Processor.lua b/drawing/Processor.lua index cd12737..f3a4e43 100644 --- a/drawing/Processor.lua +++ b/drawing/Processor.lua @@ -56,19 +56,14 @@ local _create_core_ = function(cores, id, x, y) end cores[id +1] = { - dials = _G_Widget_.CompoundDial( - _G_Widget_.make_semicircle(x, y, _DIAL_OUTER_RADIUS_, 90, 360), - _G_Widget_.arc_style( - _DIAL_THICKNESS_, - _G_Patterns_.INDICATOR_BG - ), - _G_Widget_.threshold_style( - _G_Patterns_.INDICATOR_FG_PRIMARY, - _G_Patterns_.INDICATOR_FG_CRITICAL, - 0.8 - ), - _DIAL_INNER_RADIUS_, - NUM_THREADS_PER_CORE + dials = Common.compound_dial( + x, + y, + _DIAL_OUTER_RADIUS_, + _DIAL_INNER_RADIUS_, + _DIAL_THICKNESS_, + 0.8, + NUM_THREADS_PER_CORE ), text_ring = Common.initTextRing( x,