void MainApplication::loadSettings(const BoostPath& SettingsFile)
{

    ApplicationSettings LoadedSettings;
    if(!boost::filesystem::exists(SettingsFile))
    {
        SWARNING << "Could not load Settings from: \""
                 << SettingsFile.string() << "\" because that file does not exist." << std::endl;
    }
    else
    {
        BoostPath SettingsFullPath(SettingsFile);
        if(!SettingsFile.is_complete() && !SettingsFile.has_root_directory())
        {
            SettingsFullPath = boost::filesystem::complete(SettingsFile);
        }
        SettingsFullPath.normalize();

        SLOG << "Loading Settings from: " << SettingsFullPath.string() << std::endl;

        LoadedSettings.readXML(SettingsFile);
    }
    //Apply default settings to any settings that are not defined in loaded settings files
    applyDefaultSettings(LoadedSettings, false);
    setSettings(LoadedSettings);
}
ApplicationSettings MainApplication::createDefaultSettings(void)
{
    SLOG << "Creating default settings." << std::endl;
    ApplicationSettings DefaultSettings;
    applyDefaultSettings(DefaultSettings, true);

    return DefaultSettings;
}
Beispiel #3
0
QgsComposerScaleBar::QgsComposerScaleBar( QgsComposition* composition )
    : QgsComposerItem( composition )
    , mComposerMap( 0 )
    , mNumUnitsPerSegment( 0 )
    , mStyle( 0 )
    , mSegmentMillimeters( 0.0 )
    , mAlignment( Left )
{
    applyDefaultSettings();
    applyDefaultSize();
}
Beispiel #4
0
	void PowerMonitor::begin(int voltage,int f)								// initialisation of powermionitor, **** include the option to have this initialise for 110V systems or 220/230 etc 
	{
	Serial.begin(38400); // 78M6613 only speaks at 38400 baud, this will hopefully change in later revisions
	//set the defualt values for the shield, Vmax + alarms, frequency + alarms, IAmax, IBmax, IAcreep, IBcreep,
	// VMAX = 356,892 according to the Vdivider on the board
	// f = 50.00 Hz +- 1 Hz)
	// Imax A = 65.4, IAcreep =default, IAmax
	// Imax B = 0  IBcreep =default, IBmax	
	// note that all the factory defaults are for 120 Vrms, 60 Hz power systems, we will change these to correspond to 230V 50 Hz systems now
				delay(2000);	
				Serial.println("I");
				delay(100); // wait 1.5 second for pMon to send its welcome string
				Serial.flush();
				delay(20);
				vMaxSet(374.80);	// set the external RMS voltage corresponding to 250 mVpk input of the ADC (A0) // 332.222 on V0.2, 356.892 on V 1, V0.2 477.8021536

				iMaxSet(1,65.470);	// set the external RMS current corresponding to 250 mVpk input of the ADC (A2)(A4)
				alarmCurrentMaxThreshold( 65.000); // threshold for max current alarm, factory  default = 15.000(D9) // channel A only
				
				if(voltage >=100 && voltage <=120)
		{
				alarmVoltageSAGthreshold(80.0); // threshold for voltage SAG detection  factory defualt = 80.0( D4)
				alarmVoltageMinThreshold(100.000); // threshold for min voltage alarm, factory  default = 100.000 (D5)
				alarmVoltageMaxThreshold(140.000); // threshold for max voltage alarm, factory  default = 140.000 (D6)		
		}
				if(voltage >=200 && voltage <=240)
		{
				alarmVoltageSAGthreshold(160.0); // threshold for voltage SAG detection  factory defualt = 80.0( D4)
				alarmVoltageMinThreshold(200.000); // threshold for min voltage alarm, factory  default = 100.000 (D5)
				alarmVoltageMaxThreshold(260.000); // threshold for max voltage alarm, factory  default = 140.000 (D6)
				alarmCurrentMaxThreshold( 65.000); // threshold for max current alarm, factory  default = 15.000(D9) // channel A only
		}
				
				if(f >=49 &&f <=51)
		{
				alarmFreqMinThreshold(49.00); // minimum threshold for frequency alarm factory  defualt = 59.00 Hz ( D2)
				alarmFreqMaxThreshold(51.00); // maximum threshold for frequency alarm factory defualt = 61.00 Hz ( D3)
		}
				if(f >=59 &&f <=61)
		{
				alarmFreqMinThreshold(59.00); // minimum threshold for frequency alarm factory  defualt = 59.00 Hz ( D2)
				alarmFreqMaxThreshold(61.00); // maximum threshold for frequency alarm factory defualt = 61.00 Hz ( D3)
		}
		
				applyDefaultSettings(); // U, note, CE must be disabled before sending U, and reenabsed afterwards			
				softReset();			// reset device
				delay(1000);
				Serial.flush();
	}
QgsComposerScaleBar::QgsComposerScaleBar( QgsComposition* composition )
    : QgsComposerItem( composition )
    , mComposerMap( 0 )
    , mNumUnitsPerSegment( 0 )
    , mFontColor( QColor( 0, 0, 0 ) )
    , mStyle( 0 )
    , mSegmentMillimeters( 0.0 )
    , mAlignment( Left )
    , mUnits( MapUnits )
    , mLineJoinStyle( Qt::MiterJoin )
    , mLineCapStyle( Qt::SquareCap )
{
  applyDefaultSettings();
  applyDefaultSize();
}
Beispiel #6
0
void SabreController::begin(uint8_t mode, uint8_t f_clock)
{	
	sabreDAC.begin(mode, f_clock, 0, true);	// (mono/stereo, clock frequency, default attenuation, keep muted)
		
	if (firstRun())
	{
		resetInputNames();
		applyDefaultSettings();
		for (uint8_t i = 0; i < NUMBER_OF_INPUTS; i++)
		{
			writeInputConfiguration(i);
		}
		writeMainMenuSettings();
		EEPROM.write(EEPROM_GUI_FIRST_RUN, FIRST_RUN); // write flag to EEPROM
	}
	else
	{
		readInputConfiguration();		//  read the input config from the EEPROM
		readMainMenuSettings();			// read the main menu settings from the EEPROM
	}
	
	// dac stuff
	this->SelectedInput = EEPROM.read(EEPROM_SELECTED_INPUT);
	applyInputConfiguration(this->SelectedInput);
	sabreDAC.setAttenuation(this->MainMenuSettings.defaultAttenuation);
		
	// gui stuff
	this->GUI_State = HomeScreen;
	this->SelectedInputSetting = InputName;
	this->SelectedMenuSetting = DisplayAutoOff;
	this->CursorPosition = 0;
	this->TimerEnabled = false;
	
	OLED.begin(20, 4);	// initialize the 20x4 OLED
	
	rtc.begin();		// initialize the rtc	
	if (!rtc.isrunning())
	{
		rtc.adjust(DateTime(2014, 1, 1, 0, 0)); // set the date to 1 January 2014 and time to 12:00 hrs
	}
	
	// finally unmute the dacs
	sabreDAC.unMuteDACS();
}
Beispiel #7
0
QgsComposerScaleBar::QgsComposerScaleBar( QgsComposition* composition ): QgsComposerItem( composition ), mComposerMap( 0 ), mStyle( 0 ), mSegmentMillimeters( 0.0 )
{
    applyDefaultSettings();
}
QgsLayoutItemScaleBar::QgsLayoutItemScaleBar( QgsLayout *layout )
  : QgsLayoutItem( layout )
{
  applyDefaultSettings();
  applyDefaultSize();
}