Ignore:
Timestamp:
Apr 8, 2016, 3:40:57 PM (5 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/BatteryMonitor.cpp

    r3 r15  
    1616/*********************************************************************/
    1717
    18 
    1918#include "BatteryMonitor.h"
    2019#include <Layout.h>
     
    2625using namespace flair::gui;
    2726
    28 namespace flair { namespace sensor {
     27namespace flair {
     28namespace sensor {
    2929
    30 BatteryMonitor::BatteryMonitor(const gui::LayoutPosition* position,string name) : GroupBox(position,name) {
    31     battery=new Label(this->NewRow(),"battery");
    32     battery_thresh=new DoubleSpinBox(this->LastRowLastCol(),"threshold"," V",0,24,.1,1);
     30BatteryMonitor::BatteryMonitor(const gui::LayoutPosition *position, string name)
     31    : GroupBox(position, name) {
     32  battery = new Label(this->NewRow(), "battery");
     33  battery_thresh = new DoubleSpinBox(this->LastRowLastCol(), "threshold", " V",
     34                                     0, 24, .1, 1);
    3335}
    3436
    35 BatteryMonitor::~BatteryMonitor() {
     37BatteryMonitor::~BatteryMonitor() {}
    3638
    37 }
    38 
    39 float BatteryMonitor::GetVoltage(void) const {
    40     return batteryvalue;
    41 }
     39float BatteryMonitor::GetVoltage(void) const { return batteryvalue; }
    4240
    4341bool BatteryMonitor::IsBatteryLow(void) const {
    44     if(batteryvalue<battery_thresh->Value())
    45         return true;
    46     else
    47         return false;
     42  if (batteryvalue < battery_thresh->Value())
     43    return true;
     44  else
     45    return false;
    4846}
    4947
    5048void BatteryMonitor::SetBatteryValue(float value) {
    51     batteryvalue=value;
    52     if(value>0) {
    53         battery->SetText("battery: %.1fV",value);
    54     } else {
    55         battery->SetText("battery: unreadable");
    56     }
     49  batteryvalue = value;
     50  if (value > 0) {
     51    battery->SetText("battery: %.1fV", value);
     52  } else {
     53    battery->SetText("battery: unreadable");
     54  }
    5755}
    5856
Note: See TracChangeset for help on using the changeset viewer.