Ejemplo n.º 1
0
void calibrateI(bool charging, uint8_t point, AnalogInputs::ValueType current)
{
    AnalogInputs::ValueType maxValue;
    AnalogInputs::Name name1;
    AnalogInputs::Name name2;
    AnalogInputs::CalibrationPoint pName1;
    AnalogInputs::CalibrationPoint pName2;

    Program::dischargeOutputCapacitor();
    AnalogInputs::powerOn();
    if(testVout(false)) {

        if(charging) {
            maxValue = SMPS_UPPERBOUND_VALUE;
            name1 = AnalogInputs::IsmpsSet;
            name2 = AnalogInputs::Ismps;
            SMPS::powerOn();
            hardware::setVoutCutoff(MAX_CHARGE_V);

        } else {
            name1 = AnalogInputs::IdischargeSet;
            name2 = AnalogInputs::Idischarge;
            maxValue = DISCHARGER_UPPERBOUND_VALUE;
            Discharger::powerOn();
        }

        getCalibrationPoint(pName1, name1, point);
        getCalibrationPoint(pName2, name2, point);

        CurrentMenu menu(name1, name2, point, maxValue);
        int8_t index;
        do {
            menu.refreshValue(pName1);
            index = menu.runSimple(true);
            if(index < 0) break;
            if(index == 0) {
                setCurrentValue(name1, menu.value_);
                if(menu.runEdit()) {
                    AnalogInputs::doFullMeasurement();
                    pName1.y = current;
                    pName1.x = menu.value_;
                    pName2.y = current;
                    pName2.x = AnalogInputs::getAvrADCValue(name2);
                }
                setCurrentValue(name1, 0);
            }
        } while(true);

        if(charging)   SMPS::powerOff();
        else           Discharger::powerOff();

        //Info: we save eeprom data only when no current is flowing
        AnalogInputs::setCalibrationPoint(name1, point, pName1);
        AnalogInputs::setCalibrationPoint(name2, point, pName2);
        eeprom::restoreCalibrationCRC();
    }
    AnalogInputs::powerOff();
}
Ejemplo n.º 2
0
void CGridDlg::calculate() {
  if (!validate()) return;

  setNotifyEnabled(false);
  windowToValue();
  const GridParameters v = getCurrentValue();
  GridParameters v1 = v;
  v1.m_colorCount++;
  setCurrentValue(v1);
  setNotifyEnabled(true);
  setCurrentValue(v);
}
Ejemplo n.º 3
0
void AutomationUI::newMessage(const ContainerAsyncEvent & e)
{
	if (e.type == ContainerAsyncEvent::EventType::ControllableFeedbackUpdate)
	{
		if (e.targetControllable == manager->position)
		{
			setCurrentPosition(manager->position->floatValue());
			repaint();
		} else if (e.targetControllable == manager->value)
		{
			setCurrentValue(manager->value->floatValue());
			repaint();
		}else if (e.targetControllable != nullptr)
		{
			AutomationKey * k = dynamic_cast<AutomationKey *>(e.targetControllable->parentContainer);
			if (k != nullptr)
			{
				if (e.targetControllable == k->easingType)
				{
					//repaint();
				}
				else if (e.targetControllable == k->position || e.targetControllable == k->value)
				{
					placeKeyUI(getUIForItem(k));
					//repaint();
				}
			}
		}
		
	}
	
}
Ejemplo n.º 4
0
    void Spinner::initialise(void)
    {
        Window::initialise();

        // create all the component widgets
        d_increaseButton = createIncreaseButton(getName() + "__auto_incbtn__");
        addChildWindow(d_increaseButton);
        d_decreaseButton = createDecreaseButton(getName() + "__auto_decbtn__");
        addChildWindow(d_decreaseButton);
        d_editbox = createEditbox(getName() + "__auto_editbox__");
        addChildWindow(d_editbox);

        // setup component controls
        d_increaseButton->setWantsMultiClickEvents(false);
        d_increaseButton->setMouseAutoRepeatEnabled(true);
        d_decreaseButton->setWantsMultiClickEvents(false);
        d_decreaseButton->setMouseAutoRepeatEnabled(true);

        // perform event subscriptions.
        d_increaseButton->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(&Spinner::handleIncreaseButton, this));
        d_decreaseButton->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(&Spinner::handleDecreaseButton, this));
        d_editbox->subscribeEvent(Window::EventTextChanged, Event::Subscriber(&Spinner::handleEditTextChange, this));

        // final initialisation
        setTextInputMode(Integer);
        setCurrentValue(0.0f);
        performChildWindowLayout();
    }
Ejemplo n.º 5
0
    virtual void editItem(uint8_t index, uint8_t key) {
        int dir = -1;
        if(key == BUTTON_INC) dir = 1;
//        dir *= Keyboard::getSpeedFactor();
        change0ToMaxSmart(value_, dir, maxValue_, 1);
        setCurrentValue(cName_, value_);
    }
static void currentCalibration(uint8_t point)
{
    AnalogInputs::CalibrationPoint pSet;
    AnalogInputs::CalibrationPoint p;
    bool save = false;

    Program::dischargeOutputCapacitor();
    AnalogInputs::powerOn();
    if(testVout(false)) {

        getCalibrationPoint(pSet, gNameSet_, point);
        getCalibrationPoint(p, gName_, point);

        EditMenu::initialize(currentData, editCallback);
        gIexpected_ = pSet.y;
        int8_t index;
        do {
            gValue_ = pSet.x;
            index = EditMenu::run(true);
            if(index < 0) break;
            else if(index == 0) {
                powerOnCurrent();
                setCurrentValue(gValue_);
                if(EditMenu::runEdit()) {
                    AnalogInputs::doFullMeasurement();
                    pSet.y = gIexpected_;
                    pSet.x = gValue_;
                    p.y = gIexpected_;
                    p.x = AnalogInputs::getAvrADCValue(gName_);
                    save = true;
                }
                setCurrentValue(0);
                powerOffCurrent();
            } else if(index == 2 && !EditMenu::runEdit()) {
                gIexpected_ = pSet.y;
            }
        } while(true);

        //Info: we save eeprom data only when no current is flowing
        if(save) {
            AnalogInputs::setCalibrationPoint(gNameSet_, point, pSet);
            AnalogInputs::setCalibrationPoint(gName_, point, p);
            eeprom::restoreCalibrationCRC();
        }
    }
    AnalogInputs::powerOff();
}
Ejemplo n.º 7
0
void CGridDlg::resetControls() {
  setNotifyEnabled(false);
  const GridParameters &v = getStartValue();
  setCurrentValue(v);
  valueToWindow(v);

  setNotifyEnabled(true);
}
Ejemplo n.º 8
0
 bool Spinner::handleEditTextChange(const EventArgs& e)
 {
     // set this windows text to match
     setText(d_editbox->getText());
     // update value
     setCurrentValue(getValueFromText());
     return true;
 }
Ejemplo n.º 9
0
void calibrateI(bool charging, uint8_t point, AnalogInputs::ValueType current)
{
    AnalogInputs::ValueType maxValue;
    AnalogInputs::Name name1;
    AnalogInputs::Name name2;

    if(testVout()) {

        if(charging) {
            maxValue = SMPS_UPPERBOUND_VALUE;
            name1 = AnalogInputs::IsmpsValue;
            name2 = AnalogInputs::Ismps;
            SMPS::powerOn();
        } else {
            name1 = AnalogInputs::IdischargeValue;
            name2 = AnalogInputs::Idischarge;
            maxValue = DISCHARGER_UPPERBOUND_VALUE;
            Discharger::powerOn();
        }

        CurrentMenu menu(name1, point, maxValue);
        int8_t index;
        do {
            menu.refreshValue();
            index = menu.runSimple(true);
            if(index < 0) break;
            if(index == 0) {
                setCurrentValue(name1, menu.value_);
                if(menu.runEdit(index)) {
                    AnalogInputs::doFullMeasurement();
                    AnalogInputs::CalibrationPoint p;
                    p.y = current;
                    p.x = menu.value_;
                    AnalogInputs::setCalibrationPoint(name1, point, p);
                    p.x = AnalogInputs::getAvrADCValue(name2);
                    AnalogInputs::setCalibrationPoint(name2, point, p);
                }
                setCurrentValue(name1, 0);
            }
        } while(true);

        if(charging)   SMPS::powerOff();
        else           Discharger::powerOff();
    }
}
Ejemplo n.º 10
0
int resetPositionMine(int group, int current){
    println_I("Resetting PID Local ");p_int_I(group);print_I(" to ");p_int_I(current);print_I(" from ");p_fl_I(getPositionMine(group));
    if(group<numPidMotors){
        setCurrentValue(group, current);
    }else{
        resetHeater(group, current);
    }
    return getPositionMine(group);
}
Ejemplo n.º 11
0
    void Spinner::onMinimumValueChanged(WindowEventArgs& e)
    {
        fireEvent(EventMinimumValueChanged, e, EventNamespace);

        if (d_currentValue < d_minValue)
        {
            setCurrentValue(d_minValue);
        }
    }
Ejemplo n.º 12
0
    bool Spinner::handleDecreaseButton(const EventArgs& e)
    {
        if (((const MouseEventArgs&)e).button == LeftButton)
        {
            setCurrentValue(d_currentValue - d_stepSize);
            return true;
        }

        return false;
    }
Ejemplo n.º 13
0
/*************************************************************************
	Handler for scroll wheel changes
*************************************************************************/
void Slider::onMouseWheel(MouseEventArgs& e)
{
	// base class processing
	Window::onMouseWheel(e);

	// scroll by e.wheelChange * stepSize
	setCurrentValue(d_value + d_step * -e.wheelChange);

	// ensure the message does not go to our parent.
	e.handled = true;
}
Ejemplo n.º 14
0
void CGridDlg::windowToValue() {
  GridParameters param;
  param.m_cellSize      = m_cellSize;
  param.m_cellCount.cx  = m_horizontalCount;
  param.m_cellCount.cy  = m_verticalCount;
  param.m_colorCount    = m_colorCount;
  param.m_cellSizeMM    = m_cellSizeMM;
  const bool wasEnabled = isNotifyEnabled();
  if(!IsDlgButtonChecked(IDC_CHECKAUTOCALCULATE)) {
    setNotifyEnabled(false);
  }
  setCurrentValue(param);
  setNotifyEnabled(wasEnabled);
}
Ejemplo n.º 15
0
AlkQuoteItem::AlkQuoteItem(const AlkQuoteItem& item, QObject* parent):
    QObject(parent),
    d(new Private)
{
  setSymbol(item.symbol());
  setDateTime(item.dateTime());
  setCurrentValue(item.currentValue());
  setOpeningValue(item.openingValue());
  setHighValue(item.highValue());
  setLowValue(item.lowValue());
  setClosingValue(item.closingValue());
  setVolume(item.volume());
  setMarketCap(item.marketCap());
  setEarningsPerShare(item.earningsPerShare());
  setChangeToday(item.changeToday());
  setEbitda(item.ebitda());
  setRecordId(item.recordId());
}
Ejemplo n.º 16
0
/*************************************************************************
	Handler for when a mouse button is pressed
*************************************************************************/
void Slider::onMouseButtonDown(MouseEventArgs& e)
{
	// base class processing
	Window::onMouseButtonDown(e);

	if (e.button == LeftButton)
	{
		float adj = getAdjustDirectionFromPoint(e.position);

		// adjust slider position in whichever direction as required.
		if (adj != 0)
		{
			setCurrentValue(d_value + (adj * d_step));
		}

		e.handled = true;
	}

}
static void editCallback(uint16_t * value) {
    //make sure we don't go too high
    if(gName_ == AnalogInputs::Ismps) {
        if(gValue_ > SMPS_UPPERBOUND_VALUE)         gValue_ = SMPS_UPPERBOUND_VALUE;
        if(gIexpected_ > MAX_CHARGE_I)              gIexpected_ = MAX_CHARGE_I;
    } else {
        if(gValue_ > DISCHARGER_UPPERBOUND_VALUE)   gValue_ = DISCHARGER_UPPERBOUND_VALUE;
        if(gIexpected_ > MAX_DISCHARGE_I)           gIexpected_ = MAX_DISCHARGE_I;
    }
    //set current
    if(value == &gValue_) {
        setCurrentValue(gValue_);
    }
    //TODO: hack, should be improved ... Gyuri: R138 burned.
    if(!AnalogInputs::isConnected(AnalogInputs::Vout)) {
        Screen::displayStrings(string_connect, string_battery);
        if(gName_ == AnalogInputs::Idischarge) {
            Discharger::powerOff();
        }
    }
}
Ejemplo n.º 18
0
    void Spinner::initialiseComponents(void)
    {
        // get all the component widgets
        PushButton* increaseButton = getIncreaseButton();
        PushButton* decreaseButton = getDecreaseButton();
        Editbox* editbox = getEditbox();

        // setup component controls
        increaseButton->setWantsMultiClickEvents(false);
        increaseButton->setMouseAutoRepeatEnabled(true);
        decreaseButton->setWantsMultiClickEvents(false);
        decreaseButton->setMouseAutoRepeatEnabled(true);

        // perform event subscriptions.
        increaseButton->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(&Spinner::handleIncreaseButton, this));
        decreaseButton->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(&Spinner::handleDecreaseButton, this));
        editbox->subscribeEvent(Window::EventTextChanged, Event::Subscriber(&Spinner::handleEditTextChange, this));

        // final initialisation
        setTextInputMode(Integer);
        setCurrentValue(0.0f);
        performChildWindowLayout();
    }
Ejemplo n.º 19
0
void SelectBuddyComboBox::setCurrentBuddy(Buddy buddy)
{
	setCurrentValue(buddy);
}
Ejemplo n.º 20
0
void AccountsComboBox::setCurrentAccount(Account account)
{
	setCurrentValue(account);
}
Ejemplo n.º 21
0
/*************************************************************************
	handler function for when thumb moves.	
*************************************************************************/
bool Slider::handleThumbMoved(const EventArgs& e)
{
	setCurrentValue(getValueFromThumb());

	return true;
}
Ejemplo n.º 22
0
void ProxyComboBox::setCurrentProxy(const NetworkProxy &networkProxy)
{
    setCurrentValue(networkProxy);
}
Ejemplo n.º 23
0
void CGridDlg::OnCancel() {
  const GridParameters &v = getStartValue();
  valueToWindow(v);
  setCurrentValue(v);
  OnHideWindow();
}
Ejemplo n.º 24
0
 virtual void editItem(uint8_t index, uint8_t key) {
     int dir = -1;
     if(key == BUTTON_INC) dir = 1;
     changeMinToMaxStep(&value_, dir, 1, maxValue_, 1);
     setCurrentValue(cName1_, value_);
 }