Ejemplo n.º 1
0
static void OnQnhData(DataField *Sender, DataField::DataAccessKind_t Mode){
  WndProperty* wp;

  switch(Mode){
	case DataField::daGet:
		if (PressureHg) {
			INHg=QNH/TOHPA;
			Sender->Set(INHg); 
		} else {
			Sender->Set(QNH); 
		}
		break;
	case DataField::daPut: 
	case DataField::daChange:
		if (PressureHg) {
			INHg = Sender->GetAsFloat();
			QNH=INHg*TOHPA;
		} else {
			QNH = Sender->GetAsFloat();
		}
		if (CALCULATED_INFO.Flying) QNH=fabs(QNH); 
		devPutQNH(devAll(), QNH);
		AirspaceQnhChangeNotify(QNH);

		// VarioWriteSettings();

		wp = (WndProperty*)wf->FindByName(TEXT("prpAltitude"));
		if (wp) {
			wp->GetDataField()->
			SetAsFloat(Units::ToUserAltitude(GPS_INFO.BaroAltitude));
			wp->RefreshDisplay();
		}
		break;
	default:
		break;
  }

}
Ejemplo n.º 2
0
static void OnQnhData(DataField *Sender, DataField::DataAccessKind_t Mode){
  WndProperty* wp;

  double newqnh=0;
  switch(Mode){
	case DataField::daGet:
		if (PressureHg) {
			INHg=QNH/TOHPA;
			Sender->Set(INHg);
		} else {
			Sender->Set(QNH);
		}
		break;
	case DataField::daPut:
	case DataField::daChange:


		if (PressureHg) {
			INHg = Sender->GetAsFloat();
			newqnh=INHg*TOHPA;
		} else {
			newqnh = Sender->GetAsFloat();
		}
	        if ( UpdateQNH(newqnh) ) devPutQNH(devAll(), newqnh);
		// VarioWriteSettings();

		wp = (WndProperty*)wf->FindByName(TEXT("prpAltitude"));
		if (wp) {
			wp->GetDataField()->
			SetAsFloat(Units::ToUserAltitude(GPS_INFO.BaroAltitude));
			wp->RefreshDisplay();
		}
		break;
	default:
		break;
  }

}