class MockAcm

  def initialize(config, portname = '/dev/acm')
    syslog("_ initializer called with portname = #{portname}")
    @heading = 0
    @index = 0
    @indexDir = :forward
    @avgCurrentHeadings = [230, 231, 230, 232, 233, 234, 234, 234, 233, 234, 235,
                         235, 236, 236, 237, 237, 238, 237, 238, 239, 240, 240,
                         241, 242, 242, 243, 242, 244, 245, 246, 246, 247, 248,
                         249, 249, 250, 251, 252, 252, 253, 254, 254, 255, 256,
                         257, 258, 257, 258, 259, 260, 261, 262, 263, 264, 265,
                         266, 267, 267, 266, 268, 269, 270, 271, 271, 273, 274]  
  end

  #returns a range of values going starting at 230, going up to 274, then going
  #back down to 230.
  def avg_current_heading()
    val = @avgCurrentHeadings[@index]
    if(@indexDir == :forward)
      @index += 1
    else
      @index -= 1
    end
    if(@index >= @avgCurrentHeadings.length)
      @indexDir = :backward
      @index -= 1
    elsif(@index <= 0)
      @indexDir = :forward
    end
    val
  end

  #spins around the compass, gives values incrementing from 0 to 359 than goes back to 0
  def average_heading()
    val = @heading
    @heading += 1
    @heading = @heading % 360
    return val
  end

  def run()
    #do nothing.
  end

end