コード例 #1
0
ファイル: Menu_00_2_CarType.c プロジェクト: mildrock/705_1
static void display( void )
{
	invert++;
	invert %= 2;

	lcd_fill( 0 );

	if( row > 1 ) /*设置完成*/
	{
		strcpy( jt808_param.id_0xF00A, car_type1[row0_selected] );
		strcat( jt808_param.id_0xF00A, car_type2[col] );
		param_save( 1 );
		lcd_text12( 13, 16, "车辆类型设置完成", 16, LCD_MODE_SET );
	}else
	{
		lcd_text12( 20, 4, car_type1[0], 4, LCD_MODE_SET );
		lcd_text12( 44, 4, car_type1[1], 4, LCD_MODE_SET );
		lcd_text12( 68, 4, car_type1[2], 4, LCD_MODE_SET );
		lcd_text12( 92, 4, car_type1[3], 4, LCD_MODE_SET );
		lcd_text12( 20, 18, car_type2[0], 4, LCD_MODE_SET );
		lcd_text12( 44, 18, car_type2[1], 4, LCD_MODE_SET );
		lcd_text12( 68, 18, car_type2[2], 4, LCD_MODE_SET );
		lcd_text12( 92, 18, car_type2[3], 4, LCD_MODE_SET );

		if( row == 0 )                                                          /*操作第一行*/
		{
			lcd_text12( 20 + col * 24, 4, car_type1[col], 4, invert * 2 + 1 );  /*闪烁 1 set 3 invert*/
		}else if( row == 1 )
		{
			lcd_text12( 20 + row0_selected * 24, 4, car_type1[row0_selected], 4, LCD_MODE_INVERT );
			lcd_text12( 20 + col * 24, 18, car_type2[col], 4, invert * 2 + 1 ); /*闪烁 1 set 3 invert*/
		}
	}
	lcd_update_all( );
}
コード例 #2
0
ファイル: Menu_00_2_CarType.c プロジェクト: mildrock/705_1
/***********************************************************
* Function:
* Description:
* Input:
* Input:
* Output:
* Return:
* Others:
***********************************************************/
static void keypress( unsigned int key )
{
	switch( key )
	{
		case KEY_MENU:
			pMenuItem = &Menu_1_Idle;
			pMenuItem->show( );
			return;
			break;
		case KEY_OK:
			if( row > 2 )
			{
				pMenuItem = &Menu_1_Idle;
				pMenuItem->show( );
				return;
			}
			else if( row == 0 )
			{
				row0_selected = col;
			}
			else if( row == 1 )
			{
				row1_selected = col;
			}
			else if(row==2)
			{
				strcpy( car_info.car_type, car_type1[row0_selected] );
				strcat( car_info.car_type, car_type2[row1_selected] );
				memset(jt808_param.id_0x0083,0,sizeof(jt808_param.id_0x0083));
				memset(jt808_param.id_0xF00A,0,sizeof(jt808_param.id_0xF00A));
				strcpy( jt808_param.id_0xF00A, car_info.car_type);
				strcpy( jt808_param.id_0x0083, car_info.chepai);
				param_save( 1 );
			}
			row++;
			col		= 0;
			invert	= 1;
			display( );
			break;
		case KEY_UP:
			if( col == 0 )
			{
				col = 4;
			}
			col--;
			display( );
			break;
		case KEY_DOWN:
			col++;
			col %= 0x04;
			display( );
			break;
	}
}
コード例 #3
0
ファイル: app.c プロジェクト: icamgo/noduino-sdk
irom void toggle_status()
{
	ctrl_st.relay_status.r1 = (~ctrl_st.relay_status.r1) & 0x1;
	ctrl_st.relay_status.r2 = (~ctrl_st.relay_status.r2) & 0x1;
	ctrl_st.relay_status.r3 = (~ctrl_st.relay_status.r3) & 0x1;
	ctrl_st.relay_status.r4 = (~ctrl_st.relay_status.r4) & 0x1;

	relay_set_status(NULL);
	app_push_status(NULL);
	param_save();
}
コード例 #4
0
ファイル: xkey.c プロジェクト: since2014/noduino-sdk
void xkey_short_press(void)
{
	// reverse the status of relay
	uint8_t st = (~relay_get_status()) & 0x1;
#ifdef DEBUG
	os_printf("key short pressed\r\n");
#endif

	param_set_status(st);
	param_save();

	relay_set_status_and_publish(st);
}
コード例 #5
0
ファイル: main.c プロジェクト: icamgo/noduino-sdk
void mjyun_receive(const char *event_name, const char *event_data)
{
	INFO("RECEIVED: key:value [%s]:[%s]", event_name, event_data);

	if(os_strncmp(event_data, "on", 2) == 0)
	{
		INFO("set switch on\r\n");
		param_set_status(1);
		param_save();
		relay_set_status_and_publish(1);
	}
	if(os_strncmp(event_data, "off", 3) == 0)
	{
		INFO("set switch off\r\n");
		param_set_status(0);
		param_save();
		relay_set_status_and_publish(0);
	}
	if(os_strncmp(event_data, "ota", 3) == 0)
	{
		INFO("OTA: upgrade the firmware!\r\n");
		mjyun_mini_ota_start("ota/dev/minik/files");
	}
}
コード例 #6
0
ファイル: at.c プロジェクト: EATtomatoes/SiK
static void
at_ampersand(void)
{
	switch (at_cmd[3]) {
	case 'F':
		param_default();
		at_ok();
		break;
	case 'W':
		param_save();
		at_ok();
		break;

	case 'U':
		if (!strcmp(at_cmd + 4, "PDATE")) {
			// force a flash error
			volatile char x = *(__code volatile char *)0xfc00;
			for (;;)
				;
		}
		at_error();
		break;

	case 'P':
		tdm_change_phase();
		break;

	case 'T':
		// enable test modes
		if (!strcmp(at_cmd + 4, "")) {
			// disable all tests
			at_testmode = 0;
		} else if (!strcmp(at_cmd + 4, "=RSSI")) {
			// display RSSI stats
			at_testmode ^= AT_TEST_RSSI;
		} else if (!strcmp(at_cmd + 4, "=TDM")) {
			// display TDM debug
			at_testmode ^= AT_TEST_TDM;
		} else {
			at_error();
		}
		break;
		
	default:
		at_error();
		break;
	}
}
コード例 #7
0
ファイル: app.c プロジェクト: icamgo/noduino-sdk
irom void param_load()
{
	spi_flash_read((PARAM_START_SEC + 0) * SPI_FLASH_SEC_SIZE,
		       (uint32 *) & ctrl_st,
		       sizeof(ctrl_status_t));

	// init data of spi flash
	if (ctrl_st.init_flag == 0xff) {
		INFO("Invalid parameters, reset to default!\n");
		os_memset(&ctrl_st, 0, sizeof(ctrl_status_t));

		ctrl_st.init_flag = 1; 
		ctrl_st.start_count++;
		param_save();
	}
}
コード例 #8
0
ファイル: bridge.c プロジェクト: Cjsnet/plipbox
static void magic_online(const u08 *buf)
{
  uart_send_time_stamp_spc();
  uart_send_pstring(PSTR("[MAGIC] online\r\n"));
  flags |= FLAG_ONLINE | FLAG_FIRST_TRANSFER;

  // validate mac address and if it does not match then reconfigure PIO
  const u08 *src_mac = eth_get_src_mac(buf);
  if(!net_compare_mac(param.mac_addr, src_mac)) {
    // update mac param and save
    net_copy_mac(src_mac, param.mac_addr);
    param_save();

    // re-configure PIO
    pio_exit();
    pio_init(param.mac_addr, PIO_INIT_BROAD_CAST);
  }
}
コード例 #9
0
ファイル: app.c プロジェクト: icamgo/noduino-sdk
irom void app_check_set_push_save(relay_status_t *st)
{
	if(st == NULL)
		return;

	if(ctrl_st.relay_status.r1 != st->r1 ||
		ctrl_st.relay_status.r2 != st->r2 ||
		ctrl_st.relay_status.r3 != st->r3 ||
		ctrl_st.relay_status.r4 != st->r4) {

		INFO("saved the new status into flash when relay_status changed\r\n");
		ctrl_st.relay_status.r1 = st->r1;
		ctrl_st.relay_status.r2 = st->r2;
		ctrl_st.relay_status.r3 = st->r3;
		ctrl_st.relay_status.r4 = st->r4;

		relay_set_status(NULL);
		app_push_status(NULL);
		param_save();
	}
}
コード例 #10
0
ファイル: Menu_0_1_License.c プロジェクト: mildrock/705_1
static void keypress(unsigned int key)
{
	switch(key)
		{
		case KEY_MENU:
			//��ѡ��" �˵�" ѡ����Ҫ�޸ĵ��ַ�
			if((License_Type_flag==1)&&(License_Modify_Flag==0))//����ѡ�����һ��
				{
				if(License_SetFlag>1)//δ�����˳�
					{
					License_Modify_Flag=1;//???
	                //ѡ�н�Ҫ�޸ĵ��ַ�
					License_SetFlag_temp=License_SetFlag;
					if(License_SetFlag==3)
						License_Type_Sel(0,License_Type_Counter,1);
					else
						License_Type_Sel(1,License_Type_Counter,1);
					}
				else
					{					
					License_SetFlag=1;

					License_Type_flag=0;//�������ѡ�������ѡ��
					License_Type_Counter=0;//  0: ����    1:A-M         2:N-Z

					License_set_noeffect=0;
					memset(Menu_Car_license,0,sizeof(Menu_Car_license));
					pMenuItem=&Menu_0_loggingin;
					pMenuItem->show();
					}
				}
			//ѡ��Ҫ�޸��ٴΰ�" �˵� "�˳�������ѡ��
			else if(License_Modify_Flag==1)
				{
				License_Modify_Flag=0;

				License_SetFlag=1;

				License_Type_flag=0;//�������ѡ�������ѡ��
				License_Type_Counter=0;//  0: ����    1:A-M         2:N-Z

				License_set_noeffect=0;
				memset(Menu_Car_license,0,sizeof(Menu_Car_license));
				pMenuItem=&Menu_0_loggingin;
				pMenuItem->show();
				}
			break;
		case KEY_OK:
			//ѡ���Ƿ����ó��ƺ�
			if(License_Type_flag==0)
				{
				if(License_set_noeffect==2)
					{
					License_SetFlag=1;

					License_Type_flag=0;//�������ѡ�������ѡ��
	                License_Type_Counter=0;//  0: ����    1:A-M         2:N-Z
	                License_set_noeffect=0;

                    //==================================================== 
                    //û���ó��ƺ�ʱΪ   1
                    jt808_param.id_0xF00E=1;
					//д�복�ƺ��Ƿ����ñ�־
		            param_save(1);     
					//===================================================

				    //������һ��
					CarSet_0_counter=2;//���õ�2��
					//rt_kprintf("\r\n������һ��");
					pMenuItem=&Menu_0_loggingin;
					pMenuItem->show();
					}
				else if(License_set_noeffect==1)//��ʼ���ó��ƺ�
					{
					License_set_noeffect=0;//�˳�������ѡ��ѡ��
					
					jt808_param.id_0xF00E=0;
					//д�복�ƺ��Ƿ����ñ�־
		            param_save(1); 
					
					CounterBack=0;
					License_Type_Counter=0;
					License_Type_Sel(0,License_Type_Counter,0);

					License_Type_flag=1;

					//rt_kprintf("\r\n��ʼ���ó��ƺ�");
				
					}	
				}
			//���ó��ƺſ�ʼ
			else if(License_Modify_Flag==1)
				{
				License_Modify_Flag=2;
				if(License_SetFlag_temp>3)
					License_Type_Sel(1,License_Type_Counter,2);
				else
					License_Type_Sel(0,License_Type_Counter,2);
				}
			else if(License_Modify_Flag==2)
				{
				License_Modify_Flag=1;
				if(License_SetFlag_temp==3)
					{
					memcpy(&Menu_Car_license[License_SetFlag_temp-3],Car_HZ_code[License_Type_Counter],2);
					License_Modify_Flag=0;
					License_Type_Counter=0;
					License_Type_Sel(1,License_Type_Counter,0);//�޸��꺺����ʾ�ַ�
					//License_SetFlag_temp=License_SetFlag;//=====
					//rt_kprintf("\r\n �޸�  ����");
					}
				else
					{
					Menu_Car_license[License_SetFlag_temp-2]=ABC_License_0_Z[License_Type_Counter][0];
					License_Modify_Flag=0;
					License_Type_Counter=0;
					License_Type_Sel(1,License_Type_Counter,0);
					//rt_kprintf("\r\n �޸�  �ַ�");
					}
				}
			else if(License_Type_flag==1)
				{
				if(License_SetFlag==1)
					{
					memcpy(Menu_Car_license,Car_HZ_code[License_Type_Counter],2);
					License_SetFlag++;	
					License_SetFlag++;
					//rt_kprintf("\r\n���  ����");
					License_Type_Counter=0;
					License_Type_Sel(1,License_Type_Counter,0);
					}
				else if((License_SetFlag>=3)&&(License_SetFlag<=8))
					{
					Menu_Car_license[License_SetFlag-1]=ABC_License_0_Z[License_Type_Counter][0];
					License_SetFlag++;	
					//rt_kprintf("\r\n���  �ַ�");
					
					License_Type_Counter=0;
					License_Type_Sel(1,License_Type_Counter,0);
					}		
				else if(License_SetFlag==9)
					{
					//License_Type_flag=10;//======
					if(MENU_set_carinfor_flag==1)
						{
						//rt_kprintf("\r\n���ƺ�������ɣ����˵������أ�%s",Menu_Car_license);
						//���ƺ�
						memset(jt808_param.id_0x0083,0,sizeof(jt808_param.id_0x0083));
						memcpy(jt808_param.id_0x0083,Menu_Car_license,strlen((const char*)Menu_Car_license));
						param_save(1);
					    }
					
				    License_Type_flag=2;
					License_SetFlag=10;
					lcd_fill(0);
					lcd_text12(18,3,"���ƺ��������",14,LCD_MODE_SET);
					lcd_text12(6,18,"��ȷ�ϼ�������һ��",18,LCD_MODE_SET);
					lcd_update_all();
					}
				}
			else if(License_SetFlag==10)
				{
				//rt_kprintf("\r\n������һ��");
				License_SetFlag=1;

				License_Type_flag=0;//�������ѡ�������ѡ��
                License_Type_Counter=0;//  0: ����    1:A-M         2:N-Z
                License_set_noeffect=0;

				CarSet_0_counter=2;//���õ�2��
				//rt_kprintf("\r\n������һ��");
				pMenuItem=&Menu_0_loggingin;
				pMenuItem->show();
				}

			break;
		case KEY_UP:
			if(License_Type_flag==0)
				{
				License_set_noeffect=1;
				lcd_fill(0);
				lcd_text12(0,3,"���ó��ƺ�",10,LCD_MODE_INVERT);
				lcd_text12(0,18,"�����ճ���",10,LCD_MODE_SET);
				lcd_update_all();
				}
			else if(License_Modify_Flag==1)
        		{
                if(License_SetFlag_temp>3)
                    License_SetFlag_temp--;
                License_Type_Sel(1,0,1);
                rt_kprintf("\r\nLicense_SetFlag_temp=%d",License_SetFlag_temp);
        		}
            else if(License_Modify_Flag==2)
        		{
                if(License_SetFlag>=3)
					{
					if(License_Type_Counter==0)
						License_Type_Counter=35;
					else if(License_Type_Counter>=1)
						License_Type_Counter--;
					if(License_SetFlag_temp>3)
						License_Type_Sel(1,License_Type_Counter,2);
					else
						License_Type_Sel(0,License_Type_Counter,2);
					}
				else
					{
					if(License_Type_Counter==0)
						License_Type_Counter=30;
					else if(License_Type_Counter>=1)
						License_Type_Counter--;
					
					License_Type_Sel(0,License_Type_Counter,2);
					}
        		}
			else
				{
				if(License_SetFlag>=3)
					{
					if(License_Type_Counter==0)
						License_Type_Counter=35;
					else if(License_Type_Counter>=1)
						License_Type_Counter--;
					
					License_Type_Sel(1,License_Type_Counter,0);
					}
				else
					{
					if(License_Type_Counter==0)
						License_Type_Counter=30;
					else if(License_Type_Counter>=1)
						License_Type_Counter--;
					
					License_Type_Sel(0,License_Type_Counter,0);
					}
				}
				
			break;
		case KEY_DOWN:
			if(License_Type_flag==0)
				{
				License_set_noeffect=2;
				lcd_fill(0);
				lcd_text12(0,3,"���ó��ƺ�",10,LCD_MODE_SET);
				lcd_text12(0,18,"�����ճ���",10,LCD_MODE_INVERT);
				lcd_update_all();
				}
		    else if(License_Modify_Flag==1)
        		{
                if(License_SetFlag_temp<License_SetFlag)
                    License_SetFlag_temp++;
                License_Type_Sel(1,0,1);
    			
                rt_kprintf("\r\nLicense_SetFlag_temp=%d",License_SetFlag_temp);
        		}
            else if(License_Modify_Flag==2)
        		{
                if(License_SetFlag>=3)
					{
					License_Type_Counter++;
					if(License_Type_Counter>35)
						License_Type_Counter=0;

					if(License_SetFlag_temp>3)
						License_Type_Sel(1,License_Type_Counter,2);
					else
						License_Type_Sel(0,License_Type_Counter,2);
					}
				else
					{
					License_Type_Counter++;
					if(License_Type_Counter>30)
						License_Type_Counter=0;
					
					License_Type_Sel(0,License_Type_Counter,2);
					}
        		}
			else 
				{
				if(License_Type_flag==1)//ѡ����0-9  A-M  N-Z
					{
					if(License_SetFlag>=3)
						{
						License_Type_Counter++;
						if(License_Type_Counter>35)
							License_Type_Counter=0;
						
						License_Type_Sel(1,License_Type_Counter,0);
						}
					else
						{
						License_Type_Counter++;
						if(License_Type_Counter>30)
							License_Type_Counter=0;
						
						License_Type_Sel(0,License_Type_Counter,0);
						}
					//rt_kprintf("\r\n(down)License_Type_Counter=%d",License_Type_Counter);
					}
				}
				
			break;
		}
	KeyValue=0;
}
コード例 #11
0
ファイル: Menu_5_6_Concuss.c プロジェクト: mildrock/705_1
static void keypress(unsigned int key)
{

	switch(key)
		{
		case KEY_MENU:
			pMenuItem=&Menu_5_other;
			pMenuItem->show();

			concuss_screen=0;
			break;
			
		case KEY_OK:
			if(concuss_screen==0)
				{
				concuss_screen=1;
				
				if( jt808_param.id_0x005D != concuss_step )
					{
					jt808_param.id_0x005D = concuss_step;
					param_save(1);
					rt_device_init( &dev_mma8451 );
					}
					#if NEED_TODO
				JT808Conf_struct.concuss_step=concuss_step;
				Api_Config_Recwrite_Large(jt808,0,(u8*)&JT808Conf_struct,sizeof(JT808Conf_struct));
			#endif

                concuss_dis[9]=concuss_step/10+'0';
				concuss_dis[10]=concuss_step%10+'0';
				lcd_fill(0);
				lcd_text12(20,3,"震动级别设置成功",16,LCD_MODE_SET);
				lcd_text12(30,19,(char *)concuss_dis,sizeof(concuss_dis),LCD_MODE_SET);
				lcd_update_all();
				}
			break;
			
		case KEY_UP:
			if(concuss_screen==0)
			{
				 if(concuss_step==0)
					concuss_step=79;
				else if(concuss_step>=1)
					concuss_step--;
				
				concuss_dis[9]=concuss_step/10+'0';
				concuss_dis[10]=concuss_step%10+'0';
				lcd_fill(0);
				lcd_text12(30,10,(char *)concuss_dis,sizeof(concuss_dis),LCD_MODE_SET);
				lcd_update_all();
			}
						
			break;
			
		case KEY_DOWN:
			if(concuss_screen==0)
			{
				concuss_step++;
				if(concuss_step>79)
					concuss_step=0;
				
				concuss_dis[9]=concuss_step/10+'0';
				concuss_dis[10]=concuss_step%10+'0';
				lcd_fill(0);
				lcd_text12(30,10,(char *)concuss_dis,sizeof(concuss_dis),LCD_MODE_SET);
				lcd_update_all();
			}
			break;	
		}
}
コード例 #12
0
ファイル: cmd.c プロジェクト: cnvogelg/plip2slip
u08 cmd_parse(u08 len, const char *cmd)
{
  u08 status;
  
  switch(cmd[0]) {
    // ----- v) version -----
    case 'v':
      uart_send_string("plip2slip " VERSION);
      uart_send_crlf();
      return SER_PARSE_CMD_OK;
    
    // ----- x) exit -----
    case 'x':
      return SER_PARSE_CMD_EXIT;
    
    // ----- s) stats -----
    case 's':
      if(len==1) {
        // show stats
        stats_dump();
        return SER_PARSE_CMD_OK;
      } else {
        switch(cmd[1]) {
          case 'r': // stats reset
            stats_reset();
            return SER_PARSE_CMD_OK;        
          default:
            return SER_PARSE_CMD_UNKNOWN;
        }
      }
    
    // ----- b) bench -----
    case 'b':
      bench_dump();
      return SER_PARSE_CMD_OK;
    
    // ----- p) param -----
    case 'p':
      if(len==1) {
        // show params
        param_dump();
        return SER_PARSE_CMD_OK;
      } else {
        switch(cmd[1]) {
          case 's': // param save
            status = param_save();
            return (status == PARAM_OK) ? SER_PARSE_CMD_OK : SER_PARSE_CMD_FAIL;
          case 'l': // param load
            status = param_load();
            return (status == PARAM_OK) ? SER_PARSE_CMD_OK : SER_PARSE_CMD_FAIL;
          case 'r': // param reset
            param_reset();
            return SER_PARSE_CMD_OK;
          default:
            return SER_PARSE_CMD_UNKNOWN;
        }
      }
      return SER_PARSE_CMD_UNKNOWN;
    
    // ----- m) mode -----
    case 'm':
      if(len==2) {
        u08 value;
        status = parse_nybble(cmd[1],&value);
        if(!status || (value >= PARAM_MODE_TOTAL_NUMBER)) {
          return SER_PARSE_CMD_FAIL;
        }
        param.mode = value;
        return SER_PARSE_CMD_OK;
      }
      return SER_PARSE_CMD_UNKNOWN;
    
    // ----- f) fake_tx -----
    case 'f':
      if(len==2) {
        u08 value;
        status = parse_nybble(cmd[1],&value);
        if(!status) {
          return SER_PARSE_CMD_FAIL;
        }
        param.fake_tx = value ? 1 : 0;
        return SER_PARSE_CMD_OK;
      }
      return SER_PARSE_CMD_UNKNOWN;
    
    // ----- l) log -----
    case 'l':
      if(len==1) {
        // show log
        log_dump();
        return SER_PARSE_CMD_OK;
      } else {
        switch(cmd[1]) {
          case 'r': // reset log
            log_init();
            return SER_PARSE_CMD_OK;
          default:
            return SER_PARSE_CMD_UNKNOWN;
        }
      }
      return SER_PARSE_CMD_UNKNOWN;
    
    // ----- e) error sim -----
    case 'e':
      if(len==2) {
        u08 value;
        status = parse_nybble(cmd[1],&value);
        if(!status) {
          return SER_PARSE_CMD_FAIL;
        }
        for(u08 i=0;i<value;i++) {
          error_add();
        }
        return SER_PARSE_CMD_OK;
      } else {
        error_add();
      }
      return SER_PARSE_CMD_OK;
    
    // unknown command
    default:
      return SER_PARSE_CMD_UNKNOWN;
  }
}
コード例 #13
0
ファイル: Menu_0_3_Sim.c プロジェクト: mildrock/705_1
static void keypress(unsigned int key)
{
	switch(key)
		{
		case KEY_MENU:
            if(Sim_Modify_Flag==1)//有字符需要修改
            	{
            	if(Sim_SetFlag==14)
            		{
					memset(Menu_sim_Code,0,sizeof(Menu_sim_Code));
					
					Sim_SetFlag=1;
					Sim_SetFlag_temp=1;
					Sim_SetCounter=0;
	                Sim_Modify_Flag=0;//有修改项

                    pMenuItem=&Menu_0_loggingin;
					pMenuItem->show();
            		}
				else
					{
	            	Sim_Modify_Flag=2;//选择需要修改的字符
					Sim_SetFlag_temp=Sim_SetFlag;

	            	Sim_Set(Sim_SetCounter,1);
					}
				//rt_kprintf("\r\n按  菜单键  修改");
            	}
			else
				{
				pMenuItem=&Menu_0_loggingin;
				pMenuItem->show();
				memset(Menu_sim_Code,0,sizeof(Menu_sim_Code));
				
				Sim_SetFlag=1;
				Sim_SetFlag_temp=1;
				Sim_SetCounter=0;
                Sim_Modify_Flag=0;//有修改项
				}
			break;
			
		case KEY_OK:
			if(Sim_Modify_Flag==2)
				{
				Sim_Modify_Flag=3;
				Sim_Set(0,2);///////
				//rt_kprintf("\r\n 确定修改位 Sim_SetFlag_temp = %d ",Sim_SetFlag_temp);
				}
			else if(Sim_Modify_Flag==3)
				{
				if(Sim_SetCounter<=9)
					Menu_sim_Code[Sim_SetFlag_temp-2]=Sim_SetCounter+'0';
				Sim_Set(0,0);
				//rt_kprintf("\r\n 单字符修改完成 Sim_SetFlag_temp = %d ");
				Sim_Modify_Flag=1;
				Sim_SetCounter=0;
				}
			else
				{
				if((Sim_SetFlag>=1)&&(Sim_SetFlag<=12))
					{
					Sim_Modify_Flag=1;
					//rt_kprintf("\r\n有修改项,Sim_SetFlag=%d",Sim_SetFlag);
					
					if(Sim_SetCounter<=9)
						Menu_sim_Code[Sim_SetFlag-1]=Sim_SetCounter+'0';
					
					Sim_SetFlag++;
					//rt_kprintf("\r\n  Sim_SetFlag = %d ,已设置字符串=%s",Sim_SetFlag,Menu_sim_Code);
				
					Sim_SetCounter=0;
					Sim_Set(0,0);
					}
				if(Sim_SetFlag==13)
					{
					Sim_SetFlag=14;
					if(MENU_set_carinfor_flag==1)
						{
						//rt_kprintf("\r\nSIM 卡号码设置完成,按菜单键返回,%s",Menu_sim_Code);
						
						memset(jt808_param.id_0xF006,0,sizeof(jt808_param.id_0xF006));
						memcpy(jt808_param.id_0xF006,Menu_sim_Code,12);								 
						param_save(1);

						rt_kprintf("\r\n 存储:%s",jt808_param.id_0xF006);
						}
					lcd_fill(0);
					lcd_text12(0,5,(char *)Menu_sim_Code,12,LCD_MODE_SET);
					lcd_text12(13,19,"SIM卡号设置完成",15,LCD_MODE_SET);
					lcd_update_all();		
					}
				else if(Sim_SetFlag==14)
					{
					CarSet_0_counter=4;
					Sim_SetFlag=1;

					Sim_SetFlag=1,
					Sim_SetFlag_temp=1,
					Sim_SetCounter=0;
					Sim_Modify_Flag=0;//有修改项
					
					pMenuItem=&Menu_0_loggingin;
					pMenuItem->show();
					}
				}
	
			break;
			
		case KEY_UP:
			//选择需要修改的字符
			if(Sim_Modify_Flag==2)
				{
                if(Sim_SetFlag_temp>2)
					Sim_SetFlag_temp--;
				//rt_kprintf("\r\n Sim_SetFlag_temp=%d",Sim_SetFlag_temp);
				
				Sim_Set(Sim_SetCounter,1);
				}
			else
				{
				if((Sim_SetFlag>=1)&&(Sim_SetFlag<=12))
					{
					if(Sim_SetCounter==0)
						Sim_SetCounter=9;
					else if(Sim_SetCounter>=1)
						Sim_SetCounter--;
					if(Sim_Modify_Flag==3)
						Sim_Set(Sim_SetCounter,2);
					else
						Sim_Set(Sim_SetCounter,0);
					}
				}
			break;
			
		case KEY_DOWN:
			//选择需要修改的字符
			if(Sim_Modify_Flag==2)
				{
                if(Sim_SetFlag_temp<Sim_SetFlag)
					Sim_SetFlag_temp++;
				//rt_kprintf("\r\n Sim_SetFlag_temp=%d",Sim_SetFlag_temp);
				
				Sim_Set(Sim_SetCounter,1);
				}
			else
				{
				if((Sim_SetFlag>=1)&&(Sim_SetFlag<=12)) 
					{
					Sim_SetCounter++;
					if(Sim_SetCounter>9)
						Sim_SetCounter=0;
						
					if(Sim_Modify_Flag==3)
						Sim_Set(Sim_SetCounter,2);
					else
						Sim_Set(Sim_SetCounter,0);
					}
				}
			break;
			
		}
	KeyValue=0;
}
コード例 #14
0
CSTUB_FN(td_t, tsplit)(struct usr_inv_cap *uc,
                       spdid_t spdid, td_t parent_tid, char * param,
                       int len, tor_flags_t tflags, long evtid)
{
    long fault = 0;
    td_t ret;

    struct __sg_tsplit_data *d = NULL;
    cbuf_t cb = 0;

    struct rec_data_tor *rd = NULL;
    int sz  = len + sizeof(struct __sg_tsplit_data);
    td_t		curr_ptid  = 0;
    td_t		cli_tid	   = 0;
    td_t		ser_tid	   = 0;

    /* printc("cli: tsplit passed in param %s\n", param); */
    assert(parent_tid >= 1);
    assert(param && len >= 0);
    assert(param[len] == '\0');

    if (first == 0) {
        cos_map_init_static(&uniq_tids);
        first = 1;
    }

redo:
    /* printc("<<< cli rtorrent: call tsplit  (thread %d, spd %ld and parent tid %d) >>>\n", */
    /*        cos_get_thd_id(), cos_spd_id(), parent_tid); */

    rd = rd_update(parent_tid, STATE_TSPLIT_PARENT);
    if (rd) {
        curr_ptid  = rd->s_tid;
    } else {
        curr_ptid  = parent_tid;
    }
    /* printc("<<< In: call tsplit (thread %d, , spd %ld and curr_parent tid %d) >>>\n",  */
    /*        cos_get_thd_id(), cos_spd_id(), curr_ptid); */

    d = cbuf_alloc(sz, &cb);
    assert(d);
    if (!d) return -1;
    d->parent_tid  = curr_ptid;
    d->tflags      = tflags;
    d->evtid       = evtid;
    d->len[0]      = 0;
    d->len[1]      = len;
    memcpy(&d->data[0], param, len + 1);

    CSTUB_INVOKE(ret, fault, uc, 3, spdid, cb, sz);

    if (unlikely(fault)) {
        CSTUB_FAULT_UPDATE();
        memset(&d->data[0], 0, len);
        cbuf_free(cb);
        printc("tsplit found a fault and ready to go to redo\n");
        goto redo;
    }
    cbuf_free(cb);

    ser_tid = ret;
    /* printc("passed in param %s (ser_tid %d)\n", param, ser_tid); */
    assert(ser_tid >= 1);

    char *l_param = "";
    if (len > 0) {
        l_param = param_save(param, len);
        assert(l_param);
    }

    cli_tid = map_rd_create();
    assert(cli_tid >= 2);

    rd = map_rd_lookup(cli_tid);
    assert(rd);

    rd_cons(rd, curr_ptid, cli_tid, ser_tid, l_param, len, tflags, evtid);

    /* printc("tsplit done!!! return new client tid %d\n\n", cli_tid); */
    return cli_tid;
}
コード例 #15
0
ファイル: mmi.c プロジェクト: westlicht/camcontrol
static QState execute_cmd(struct mmi_ao *me, int cmd)
{
    vec2f_t v;

    switch (cmd) {
    case CMD_SINGLE_SHOT:
        QActive_post((QActive *) &shutter_ao, SIG_SHUTTER_START, 0);
        break;
    case CMD_SPHERICAL_PAN:
        return Q_TRAN(mmi_spherical_pan);
    case CMD_GIGA_PAN:
        return Q_TRAN(mmi_giga_pan);
    case CMD_TIMELAPSE:
        QActive_post((QActive *) &prog_ao, SIG_PROG_START, PROG_TIMELAPSE);
        QActive_post((QActive *) &mmi_ao, SIG_PROG_START, PROG_TIMELAPSE);
        break;
    case CMD_SAVE:
        show_msg("Saving...", 1);
        param_save();
        break;
    case CMD_SERVO_MIN:
        vec2(&v, deg2rad(0.0), deg2rad(0.0));
        servo_move(&v);
        break;
    case CMD_SERVO_CENTER:
        vec2(&v, deg2rad(180.0), deg2rad(90.0));
        servo_move(&v);
        break;
    case CMD_SERVO_MAX:
        vec2(&v, deg2rad(360.0), deg2rad(180.0));
        servo_move(&v);
        break;
    case CMD_UPDATE_SERVO_MIN_X:
        servo_get_goal(&v);
        v.x = deg2rad(0);;
        servo_move(&v);
        break;
    case CMD_UPDATE_SERVO_MAX_X:
        servo_get_goal(&v);
        v.x = deg2rad(360);
        servo_move(&v);
        break;
    case CMD_UPDATE_SERVO_MIN_Y:
        servo_get_goal(&v);
        v.y = deg2rad(0);
        servo_move(&v);
        break;
    case CMD_UPDATE_SERVO_MAX_Y:
        servo_get_goal(&v);
        v.y = deg2rad(180);
        servo_move(&v);
        break;
    case CMD_UPDATE_CENTER:
        vec2(&v, deg2rad(pd.single.center_x), deg2rad(pd.single.center_y));
        servo_move(&v);
        break;
    case CMD_UPDATE_GIGA_START:
        vec2(&v, deg2rad(pd.giga.start_x), deg2rad(pd.giga.start_y));
        servo_move(&v);
        break;
    case CMD_UPDATE_GIGA_END:
        vec2(&v, deg2rad(pd.giga.end_x), deg2rad(pd.giga.end_y));
        servo_move(&v);
        break;
    case CMD_SHUTDOWN:
        vec2(&v, deg2rad(180.0), deg2rad(180.0));
        servo_move(&v);
        break;
    }

    return Q_HANDLED();
}
コード例 #16
0
ファイル: Menu_0_4_VIN.c プロジェクト: mildrock/705_1
static void keypress(unsigned int key)
{
	switch(key)
		{
		case KEY_MENU:
			 if(VIN_Modify_Flag==1)//有字符需要修改
            	{
            	if(VIN_SetFlag==18)
            		{
            		pMenuItem=&Menu_0_loggingin;
					pMenuItem->show();
					memset(Menu_Vin_Code,0,sizeof(Menu_Vin_Code));
	                
					VIN_SetFlag=1;
					VIN_SetCounter=0;
					VIN_Modify_Flag=0;
					VIN_SetFlag_Temp=1;
            		}
				else
					{
	            	VIN_Modify_Flag=2;//选择需要修改的字符
					VIN_SetFlag_Temp=VIN_SetFlag;

	            	Vin_Set(VIN_SetCounter,1,1);
					}
				//rt_kprintf("\r\n按  菜单键  修改");
            	}
			 else
			 	{
				pMenuItem=&Menu_0_loggingin;
				pMenuItem->show();
				memset(Menu_Vin_Code,0,sizeof(Menu_Vin_Code));
				VIN_SetFlag=1;
				VIN_SetCounter=0;
			 	}

			break;
		case KEY_OK:
			if(VIN_Modify_Flag==2)
				{
				VIN_Modify_Flag=3;
				Vin_Set(VIN_SetCounter,1,2);
				}
			else if(VIN_Modify_Flag==3)
				{
				//if(VIN_SetCounter<=9)
				Menu_Vin_Code[VIN_SetFlag_Temp-2]=ABC[VIN_SetCounter][0];//VIN_SetCounter+'0';
				Vin_Set(0,1,0);
				//rt_kprintf("\r\n 单字符修改完成 Sim_SetFlag_temp = %d ");
				VIN_Modify_Flag=1;
				VIN_SetCounter=0;
				}
			else
				{
				if((VIN_SetFlag>=1)&&(VIN_SetFlag<=17))
					{
					Menu_Vin_Code[VIN_SetFlag-1]=ABC[VIN_SetCounter][0];
					//rt_kprintf("\r\n VIN_set=%d,%s",VIN_SetFlag,Menu_Vin_Code);
					VIN_SetFlag++;	
					VIN_SetCounter=0;
					Vin_Set(0,1,0);
					VIN_Modify_Flag=1;
					}		
			    if(VIN_SetFlag==18)
					{
					//rt_kprintf("\r\n VIN_set=%d,%s(ok)",VIN_SetFlag,Menu_Vin_Code);
					VIN_SetFlag=19;
					if(MENU_set_carinfor_flag==1)
						{
						 //车辆VIN
						memset(jt808_param.id_0xF005,0,sizeof(jt808_param.id_0xF005));
						memcpy(jt808_param.id_0xF005,Menu_Vin_Code,17);								 
						param_save(1);

					    //rt_kprintf("\r\nVIN 设置完成,按菜单键返回,%s",Menu_Vin_Code);
					    }
					lcd_fill(0);
					lcd_text12(0,5,(char *)Menu_Vin_Code,17,LCD_MODE_SET);
					lcd_text12(25,19,"VIN设置完成",11,LCD_MODE_SET);
					lcd_update_all();	
					//rt_kprintf("\r\n VIN_set=%d,%s(ok--)",VIN_SetFlag,Menu_Vin_Code);
					
					}
				else if(VIN_SetFlag==19)
					{
					VIN_SetFlag=1;
					CarSet_0_counter=5;

					pMenuItem=&Menu_0_loggingin;
					pMenuItem->show();
					}
				}
			
			break;
		case KEY_UP:
			if(VIN_Modify_Flag==2)
				{
                if(VIN_SetFlag_Temp>2)
					VIN_SetFlag_Temp--;
				//rt_kprintf("\r\n Sim_SetFlag_temp=%d",Sim_SetFlag_temp);
				
				Vin_Set(VIN_SetCounter,1,1);
				}
			else
				{
				if((VIN_SetFlag>=1)&&(VIN_SetFlag<=17))
					{
					if(VIN_SetCounter==0)
						VIN_SetCounter=35;
					else if(VIN_SetCounter>=1)
						VIN_SetCounter--;
					
					if(VIN_Modify_Flag==3)
						{
						if(VIN_SetCounter<20)
							Vin_Set(VIN_SetCounter,1,2);
						else
							Vin_Set(VIN_SetCounter,2,2);
						}
					else
						{
						if(VIN_SetCounter<20)
							Vin_Set(VIN_SetCounter,1,0);
						else
							Vin_Set(VIN_SetCounter,2,0);
						}
					}
				}
			break;
		case KEY_DOWN:
			//选择需要修改的字符
			if(VIN_Modify_Flag==2)
				{
                if(VIN_SetFlag_Temp<VIN_SetFlag)
					VIN_SetFlag_Temp++;
				//rt_kprintf("\r\n Sim_SetFlag_temp=%d",Sim_SetFlag_temp);
				
				Vin_Set(VIN_SetCounter,1,1);
				}
			else
				{
				if((VIN_SetFlag>=1)&&(VIN_SetFlag<=17))
					{
					VIN_SetCounter++;
					if(VIN_SetCounter>35)
						VIN_SetCounter=0;
					
					if(VIN_Modify_Flag==3)
						{
						if(VIN_SetCounter<20)
							Vin_Set(VIN_SetCounter,1,2);
						else
							Vin_Set(VIN_SetCounter,2,2);
						}
					else
						{
						if(VIN_SetCounter<20)
							Vin_Set(VIN_SetCounter,1,0);
						else
							Vin_Set(VIN_SetCounter,2,0);
						}
					}
				}
			break;
		}
	KeyValue=0;
}