当前位置: 首页>>代码示例>>C++>>正文


C++ timer::every_sec方法代码示例

本文整理汇总了C++中timer::every_sec方法的典型用法代码示例。如果您正苦于以下问题:C++ timer::every_sec方法的具体用法?C++ timer::every_sec怎么用?C++ timer::every_sec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在timer的用法示例。


在下文中一共展示了timer::every_sec方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(void) {
	SystemInit(); // Quarz Einstellungen aktivieren
	init_speedo();

	//	SD.prefetched_animation(37); // 37
	//	Speedo.initial_draw_screen(); // draw symbols
	/******************** setup procedure ********************************************
	 * all initialisations must been made before the main loop, before THIS
	 ******************** setup procedure ********************************************/
	unsigned long previousMillis = 0;
#ifdef LOAD_CALC
	unsigned long load_calc=0;
	unsigned long lasttime_calc=0;
#endif

	for (;;) {
		Sensors.mCAN.check_message();
		//////////////////////////////////////////////////
		//		Sensors.m_reset->set_deactive(false,false);
		//		Serial3.end();
		//		Serial3.begin(115200);
		//		while(true){
		//			while(Serial3.available()>0){
		//				Serial.print(Serial3.read(),BYTE);
		//			}
		//			while(Serial.available()>0){
		//				Serial3.print(Serial.read(),BYTE);
		//			}
		//		}
		//////////////////////////////////////////////////
		Sensors.mReset.toggle(); // toggle pin, if we don't toggle it, the ATmega8 will reset us, kind of watchdog<
		Debug.speedo_loop(21, 1, 0, " "); // intensive debug= EVERY loop access reports the Menustate
		Sensors.mGPS.check_flag();    	// check if a GPS sentence is ready
		//		pAktors.check_flag(); 				// updated expander
		Sensors.pull_values();	// very important, updates all the sensor values

		/************************* timer *********************/
		Timer.every_sec();		// 1000 ms
		Timer.every_qsec();			// 250  ms
		Timer.every_custom(); // one custom timer, redrawing the speedo, time is defined by "refresh_cycle" in the base.txt
		/************************* push buttons *********************
		 * using true as argument, this will activate bluetooth input as well
		 ************************* push buttons*********************/
		//Menu.button_test(true,false);     // important!! if we have a pushed button we will draw something, depending on the menustate
		if (Menu.button_test(true, false)) { // important!! if we have a pushed button we will draw something, depending on the menustate
			Serial.puts(USART1, "Menustate:");
			Serial.puts_ln(USART1, Menu.state);
		}
		/************************ every deamon activity is clear, now draw speedo ********************
		 * we are round about 0000[1]1 - 0000[1]9
		 ************************ every deamon activity is clear, now draw speedo ********************/
		Sensors.mCAN.check_message();

		if ((Menu.state / 10) == 1 || Menu.state == 7311111) {
			Speedo.loop(previousMillis);
		}
		//////////////////// Sprint Speedo ///////////////////
		else if (Menu.state == MENU_SPRINT * 10 + 1) {
			Sprint.loop();
		}
		////////////////// Clock Mode ////////////////////////
		else if (Menu.state == 291) {
			Sensors.mClock.loop();
		}
		////////////////// Speed Cam Check - Mode ////////////////////////
		else if (Menu.state
				== BMP(0, 0, 0, 0, M_TOUR_ASSISTS,
						SM_TOUR_ASSISTS_SPEEDCAM_STATUS, 1)) {
			//			SpeedCams.calc();
			//			SpeedCams.interface();
		}
		////////////////// race mode ////////////////////
		else if (Menu.state == M_LAP_T * 100 + 11) {
			LapTimer.waiting_on_speed_up();
		} else if (Menu.state == M_LAP_T * 1000 + 111) {
			LapTimer.race_loop();
		}
		////////////////// set gps point ////////////////////
		else if (Menu.state == M_LAP_T * 10000L + 3111) {
			LapTimer.gps_capture_loop();
		}
		//////////////////// voltage mode ///////////////////
		else if (Menu.state == 531) {
			Sensors.addinfo_show_loop();
		}
		//////////////////// stepper mode ///////////////////
		else if (Menu.state == 541) {
			//			Aktors.mStepper.loop();
		}
		//////////////////// gps scan ///////////////////
		else if (Menu.state == 511) {
			Sensors.mGPS.loop();
		}
		//////////////////// outline scan ///////////////////
		else if (Menu.state == 721) {
			Sensors.mSpeed.check_umfang();
		}
		////////////////// gear scan ///////////////
		else if (floor(Menu.state / 100) == 71) {
			Sensors.mGear.calibrate();
//.........这里部分代码省略.........
开发者ID:KoljaWindeler,项目名称:speedoino,代码行数:101,代码来源:main.cpp


注:本文中的timer::every_sec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。