示例#1
0
文件: shapes.c 项目: 8a22a/Shapes
static void display_time(struct tm *tick_time) {

  // TODO: Use `units_changed` and more intelligence to reduce
  // redundant digit unload/load?

  display_value(get_display_hour(tick_time->tm_hour), 0, false);
  display_value(tick_time->tm_min, 1, true);
}
// display thread handler
void segment_display(void const * arg){
	uint16_t LED_pins[4] = { GPIO_Pin_12, GPIO_Pin_13, GPIO_Pin_14, GPIO_Pin_15 };
	int count = 0;
	char key = DUMMY_KEY, led = '1';
	int mode = TEMP_MODE;
	float temperature = 50.0;
	float pitch = 0.0;
		
	display_init();
	
	float data; 
	
	while(1){
		osSignalWait(DISPLAY_READY, osWaitForever);
				
		// try to get the keypad message		
		if (receive_message(&data, keypad_queue)){
			key = (char)(((int)data) + '0');
			
			// figure out which type of key was pressed (i.e. mode or led) and adjust variables accordingly. 
			if (key == TEMP_MODE_KEY || key == MEMS_MODE_KEY){
				mode = key == TEMP_MODE_KEY ? TEMP_MODE : MEMS_MODE;
			} else {
				led = key;
			}			
		}
		
		// try to get the pitch message
		if (receive_message(&data, pitch_queue)){
			pitch = data;
		}
		
		// try to get the temperature message
		if (receive_message(&data, temp_queue)){
			temperature = data;
		}
				
		GPIO_ResetBits(GPIOD, GPIO_SEGMENT_PINS);
		GPIO_ResetBits(GPIOE, GPIO_DIGIT_SELECT_PINS);
	
		// run the display effect depending on whether or not an alarm is triggerd and the type of mode.
		if (temperature < ALARM_THRESHOLD || (count % (2 * TIM3_DESIRED_RATE)) < TIM3_DESIRED_RATE) {		
			if (mode == TEMP_MODE){
				GPIO_ResetBits(GPIOD, ALL_LED_PINS);
				display_value(temperature, count, TEMP_MODE); 
			} else {
				display_value(pitch, count, MEMS_MODE);
			}
		}
		
		if (mode == MEMS_MODE){
			display_LED(pitch, count, LED_pins[(led - '1')]);
		}
		
		count++;
	}
}
示例#3
0
static void display_time(struct tm *tick_time) {

  // TODO: Use `units_changed` and more intelligence to reduce
  //       redundant digit unload/load?

  display_value(get_display_hour(tick_time->tm_hour), 0, false);
  display_value(tick_time->tm_min, 1, true); 
  snprintf(dayText, 3, "%2.2d", tick_time->tm_mday); 
  text_layer_set_text(dayLayer, showDay ? dayText : "  ");
}
示例#4
0
static void handle_second_tick(struct tm* tick_time, TimeUnits units_changed) {
  static int day_m = 40;
  static int hour_m = 33;
  static int min_m = 77;
  static bool clock24 = false;
  
  if (clock24 != clock_is_24h_style()) {
    clock24 = clock_is_24h_style();
    for (int slot_number = 4; slot_number < TOTAL_IMAGE_SLOTS; slot_number++) {
      GRect bounds = layer_get_frame(bitmap_layer_get_layer(digit_slot[slot_number]));
      if (clock24) {
        bounds.origin.y = 19;
      } else {
        bounds.origin.y = 35;
      }
      layer_set_frame(bitmap_layer_get_layer(digit_slot[slot_number]), bounds);
    }
    GRect bounds = layer_get_frame(text_layer_get_layer(date_layer));
    if (clock24) {
      bounds.origin.y = 52;
    } else {
      bounds.origin.y = 62;
    }
    layer_set_frame(text_layer_get_layer(date_layer), bounds);
    layer_set_hidden((Layer *)ampm_layer, clock24);
  }
  
  if (day_m != tick_time->tm_mday) {
    day_m = tick_time->tm_mday;
    update_date(tick_time);
    text_layer_set_text(date_layer, date_text);
  }
  if (hour_m != tick_time->tm_hour) {
    hour_m = tick_time->tm_hour;
    display_value(get_display_hour(tick_time->tm_hour), 0, true);
    if (!clock_is_24h_style()) {
      if (hour_m >=12) {
        text_layer_set_text(ampm_layer, "PM");
      } else {
        text_layer_set_text(ampm_layer, "AM");
      }
    }
  }
    
  if (min_m != tick_time->tm_min) {
    min_m = tick_time->tm_min;
    display_value(tick_time->tm_min, 1, true);  
  }
  display_value(tick_time->tm_sec, 2, true);
}
示例#5
0
void
ListView::display_list()
{
  // NOTE: What does it mean to display a NULL list? 6/22/92 djb 
  if (f_shell == NULL || f_the_list == NULL)
    return;

  int i;

  // NOTE: There should be a wwl object for string tables!! 6/19/92 djb
  XmStringTable st = (XmStringTable)
    malloc (sizeof (XmStringTable) * f_the_list->length());

  for (i = 0; i < f_the_list->length(); i++)
    st[i] = display_value((*f_the_list)[i]);

  // Basically bogus, but best fix for now.  18:32 10-May-94 DJB
  f_list->DeselectAllItems();
  WArgList args;
  f_list->Items (st, args);
  f_list->ItemCount (f_the_list->length(), args);
  f_list->Set (args);

  for (i = 0; i < f_the_list->length(); i++)
    XmStringFree(st[i]);

  free ((char *) st);
}
示例#6
0
static void display_time(struct tm *tick_time) {
    display_value(get_display_hour(tick_time->tm_hour), 0);
    display_value(tick_time->tm_min, 1);
    //Displays a subtle reminder on the hour
    if(tick_time->tm_min % 60 == 0) {
        gbitmap_destroy(block_o_bitmap);
        ichigan_bitmap = gbitmap_create_with_resource(RESOURCE_ID_Ichigan);
        bitmap_layer_set_bitmap(block_o_layer, ichigan_bitmap);
    }
    //Reset's the clock after the subtle reminder
    if(tick_time->tm_min % 60 == 1) {
        gbitmap_destroy(ichigan_bitmap);
        block_o_bitmap = gbitmap_create_with_resource(RESOURCE_ID_block_o_background);
        bitmap_layer_set_bitmap(block_o_layer, block_o_bitmap);
    }
}
示例#7
0
void update_display_hours(PblTm *tick_time) {
    static char am_pm_text[] = "PM";

    display_value(get_display_hour(tick_time->tm_hour), 0, false);
    // AM/PM
    string_format_time(am_pm_text, sizeof(am_pm_text), "%p", tick_time);

    if (!clock_is_24h_style()) {
      text_layer_set_text(&ampm, am_pm_text);
    }
}
示例#8
0
void bluetooth_handler(bool connected) {
	//	This handler is called when BT connection state changes

	// Destroy inverter layer if BT changed from disconnected to connected
	if ((connected) && (!(was_BTconnected_last_time)))  {
		inverter_layer_destroy(inv_layer);
	}
	time_t now = time(NULL);
    struct tm *tick_time = localtime(&now);
	window_set_background_color(window, background_color);
	display_value(get_display_hour(tick_time->tm_hour), 0, false);
	display_value(tick_time->tm_min, 1, true);
	//Inverter layer in case of disconnect
	if (!(connected)) {
		inv_layer = inverter_layer_create(GRect(0, 0, 144, 168));
		layer_add_child(window_get_root_layer(window), (Layer*) inv_layer);	
		vibes_double_pulse();
	}
	was_BTconnected_last_time = connected;
}
示例#9
0
static void display_seq(short int value)
{
    display_value(value);
    dimm_digit(0xFF);
    _delay_ms(1000);
    dimm_digit(0xa0);
    _delay_ms(200);
    dimm_digit(0x10);
    _delay_ms(200);
    dimm_digit(0x00);
}
示例#10
0
文件: LCD.c 项目: jpgarretson/LCD
void update_display(PblTm *tick_time) {

  static char month_text[] = "AAA";
  static char date_text[] = "00"; 
  static char am_pm_text[] = "P";
  
  string_format_time(month_text, sizeof(month_text), "%b", tick_time);
  string_format_time(date_text, sizeof(date_text), "%e", tick_time);
  string_format_time(am_pm_text, sizeof(am_pm_text), "%p", tick_time);
  
  text_layer_set_text(&text_layer_4, month_text);
  text_layer_set_text(&text_layer_5, date_text);  
  
  if (!clock_is_24h_style()) {
	text_layer_set_text(&text_layer_6, am_pm_text);  
  }
  
  display_value(get_display_hour(tick_time->tm_hour), 0, false);
  display_value(tick_time->tm_min, 1, true);
}
示例#11
0
void update_display_minutes(PblTm *tick_time) {
    display_value(tick_time->tm_min, 1, true);
}
示例#12
0
int main(void)
{
	board_init();
	timer(TimerReadSensors);
    timer_interval(&TimerReadSensors, 1000);
	timer(TimerBlinkLed);
    timer_interval(&TimerBlinkLed, 1000);
	/*ms5611_prom_data ms5611_prom_data;
	ms5611_init(&ms5611_prom_data, TWI[0]);
	mpu60x0_init(TWI[0], 0);
	mhc5883_init(TWI[0]);*/
    bool Led1Status = false;
	while(1)
	{
		if(timer_tick(&TimerBlinkLed)) {
			if(Led1Status) {
				gpio_out(LED1, 0);
				timer_interval(&TimerBlinkLed, 100);
				timer_enable(&TimerBlinkLed);
				Led1Status = false;
			} else {
				gpio_out(LED1, 1);
				timer_interval(&TimerBlinkLed, 900);
				timer_enable(&TimerBlinkLed);
				Led1Status = true;
			}
		}
		if(timer_tick(&TimerReadSensors)) {
			DXL_DATA_t buffer[18];
			memset(&buffer, 0, sizeof(buffer));
			unsigned char dxl_err[18];
			memset(&dxl_err, 0, sizeof(dxl_err));
			DXL_COMM_ERR err_ret[18];
			memset(&err_ret, 0, sizeof(err_ret));
			unsigned char dxl_cnt;
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				err_ret[dxl_cnt]  = dxl_read(DXL, (unsigned char *)&buffer[dxl_cnt] , dxl_cnt  + 1 , 0, sizeof(buffer[0]), &dxl_err[dxl_cnt]);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL data:                   ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(dxl_cnt + 1);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL com status            = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(err_ret[dxl_cnt]);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL err                   = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(dxl_err[dxl_cnt]);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL model nr              = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].model_number);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL version               = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].version);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL ID                    = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].id);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL baud rate             = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].baud_rate);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL return delay time     = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].return_delay_time);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL cw angle limit        = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].cw_angle_limit);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL ccw angle limit       = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].ccw_angle_limit);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL limit temperature     = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].limit_temperature);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL down limit voltage    = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].down_limit_voltage);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL up limit voltage      = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].up_limit_voltage);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL mdxl torque limit     = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].mdxl_torque);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL status return level   = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].status_return_level);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL alarm led             = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].alarm_led);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL alarm shutdown        = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].alarm_shutdown);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL down calibration      = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].down_calibration);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL up calibration        = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].up_calibration);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL torque enable         = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].torque_enable);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL led                   = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].led);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL cw compliance margin  = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].cw_compliance_margin);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL ccw compliance margin = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].ccw_compliance_margin);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL cw compliance slope   = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].cw_compliance_slope);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL ccw compliance slope  = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].ccw_compliance_slope);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL goal position         = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].goal_position);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL moving speed          = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].moving_speed);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL torque limit          = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].torque_limit);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL present position      = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].present_position);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL present speed         = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].present_speed);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL present load          = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].present_load);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL present voltage       = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].present_voltage);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL present temperature   = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].present_temperature);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL registered instruction= ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].registered_instruction);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL moving                = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].moving);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL lock                  = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].lock);
			UARTPuts(DebugCom,   "\n\r", -1);

			UARTPuts(DebugCom, "DXL punch                 = ", -1);
			for(dxl_cnt = 0; dxl_cnt < sizeof(dxl_id_table); dxl_cnt++)
				display_value(buffer[dxl_cnt].punch);
			UARTPuts(DebugCom,   "\n\r\n\r", -1);
/*
 * Send to each DXL the position and speed.
 */
			DXL_SYNK_IND_PACKET_t DXL_PACK[18];
#define MOT1		270
			DXL_PACK[0].id = 1;
			DXL_PACK[0].data[0] = (unsigned char)((unsigned short)MOT1);// Goal position
			DXL_PACK[0].data[1] = (unsigned char)((unsigned short)MOT1 >> 8);
			DXL_PACK[0].data[2] = 0;// Speed
			DXL_PACK[0].data[3] = 2;
#define MOT2		736
			DXL_PACK[1].id = 2;
			DXL_PACK[1].data[0] = (unsigned char)((unsigned short)MOT2);// Goal position
			DXL_PACK[1].data[1] = (unsigned char)((unsigned short)MOT2 >> 8);
			DXL_PACK[1].data[2] = 0;// Speed
			DXL_PACK[1].data[3] = 2;
#define MOT3		376
			DXL_PACK[2].id = 3;
			DXL_PACK[2].data[0] = (unsigned char)((unsigned short)MOT3);// Goal position
			DXL_PACK[2].data[1] = (unsigned char)((unsigned short)MOT3 >> 8);
			DXL_PACK[2].data[2] = 0;// Speed
			DXL_PACK[2].data[3] = 2;
#define MOT4		662
			DXL_PACK[3].id = 4;
			DXL_PACK[3].data[0] = (unsigned char)((unsigned short)MOT4);// Goal position
			DXL_PACK[3].data[1] = (unsigned char)((unsigned short)MOT4 >> 8);
			DXL_PACK[3].data[2] = 0;// Speed
			DXL_PACK[3].data[3] = 2;
#define MOT5		300
			DXL_PACK[4].id = 5;
			DXL_PACK[4].data[0] = (unsigned char)((unsigned short)MOT5);// Goal position
			DXL_PACK[4].data[1] = (unsigned char)((unsigned short)MOT5 >> 8);
			DXL_PACK[4].data[2] = 0;// Speed
			DXL_PACK[4].data[3] = 2;
#define MOT6		726
			DXL_PACK[5].id = 6;
			DXL_PACK[5].data[0] = (unsigned char)((unsigned short)MOT6);// Goal position
			DXL_PACK[5].data[1] = (unsigned char)((unsigned short)MOT6 >> 8);
			DXL_PACK[5].data[2] = 0;// Speed
			DXL_PACK[5].data[3] = 2;
#define MOT7		376
			DXL_PACK[6].id = 7;
			DXL_PACK[6].data[0] = (unsigned char)((unsigned short)MOT7);// Goal position
			DXL_PACK[6].data[1] = (unsigned char)((unsigned short)MOT7 >> 8);
			DXL_PACK[6].data[2] = 0;// Speed
			DXL_PACK[6].data[3] = 2;
#define MOT8		660
			DXL_PACK[7].id = 8;
			DXL_PACK[7].data[0] = (unsigned char)((unsigned short)MOT8);// Goal position
			DXL_PACK[7].data[1] = (unsigned char)((unsigned short)MOT8 >> 8);
			DXL_PACK[7].data[2] = 0;// Speed
			DXL_PACK[7].data[3] = 2;
#define MOT9		512
			DXL_PACK[8].id = 9;
			DXL_PACK[8].data[0] = (unsigned char)((unsigned short)MOT9);// Goal position
			DXL_PACK[8].data[1] = (unsigned char)((unsigned short)MOT9 >> 8);
			DXL_PACK[8].data[2] = 0;// Speed
			DXL_PACK[8].data[3] = 2;
#define MOT10		512
			DXL_PACK[9].id = 10;
			DXL_PACK[9].data[0] = (unsigned char)((unsigned short)MOT10);// Goal position
			DXL_PACK[9].data[1] = (unsigned char)((unsigned short)MOT10 >> 8);
			DXL_PACK[9].data[2] = 0;// Speed
			DXL_PACK[9].data[3] = 2;
#define MOT11		512
			DXL_PACK[10].id = 11;
			DXL_PACK[10].data[0] = (unsigned char)((unsigned short)MOT11);// Goal position
			DXL_PACK[10].data[1] = (unsigned char)((unsigned short)MOT11 >> 8);
			DXL_PACK[10].data[2] = 0;// Speed
			DXL_PACK[10].data[3] = 2;
#define MOT12		512
			DXL_PACK[11].id = 12;
			DXL_PACK[11].data[0] = (unsigned char)((unsigned short)MOT12);// Goal position
			DXL_PACK[11].data[1] = (unsigned char)((unsigned short)MOT12 >> 8);
			DXL_PACK[11].data[2] = 0;// Speed
			DXL_PACK[11].data[3] = 2;
#define MOT13		512
			DXL_PACK[12].id = 13;
			DXL_PACK[12].data[0] = (unsigned char)((unsigned short)MOT13);// Goal position
			DXL_PACK[12].data[1] = (unsigned char)((unsigned short)MOT13 >> 8);
			DXL_PACK[12].data[2] = 0;// Speed
			DXL_PACK[12].data[3] = 2;
#define MOT14		512
			DXL_PACK[13].id = 14;
			DXL_PACK[13].data[0] = (unsigned char)((unsigned short)MOT13);// Goal position
			DXL_PACK[13].data[1] = (unsigned char)((unsigned short)MOT14 >> 8);
			DXL_PACK[13].data[2] = 0;// Speed
			DXL_PACK[13].data[3] = 2;
#define MOT15		512
			DXL_PACK[14].id = 15;
			DXL_PACK[14].data[0] = (unsigned char)((unsigned short)MOT15);// Goal position
			DXL_PACK[14].data[1] = (unsigned char)((unsigned short)MOT15 >> 8);
			DXL_PACK[14].data[2] = 0;// Speed
			DXL_PACK[14].data[3] = 2;
#define MOT16		512
			DXL_PACK[15].id = 16;
			DXL_PACK[15].data[0] = (unsigned char)((unsigned short)MOT16);// Goal position
			DXL_PACK[15].data[1] = (unsigned char)((unsigned short)MOT16 >> 8);
			DXL_PACK[15].data[2] = 0;// Speed
			DXL_PACK[15].data[3] = 2;
#define MOT17		512
			DXL_PACK[16].id = 17;
			DXL_PACK[16].data[0] = (unsigned char)((unsigned short)MOT17);// Goal position
			DXL_PACK[16].data[1] = (unsigned char)((unsigned short)MOT17 >> 8);
			DXL_PACK[16].data[2] = 0;// Speed
			DXL_PACK[16].data[3] = 2;
#define MOT18		512
			DXL_PACK[17].id = 18;
			DXL_PACK[17].data[0] = (unsigned char)((unsigned short)MOT18);// Goal position
			DXL_PACK[17].data[1] = (unsigned char)((unsigned short)MOT18 >> 8);
			DXL_PACK[17].data[2] = 0;// Speed
			DXL_PACK[17].data[3] = 2;
			/*
			 *  Send synk write to all 18 DXL's position and speed.
			 */
			dxl_synk_write(DXL, DXL_GOAL_POSITION_L, DXL_PACK, 4, 18);
			/*
			 *  Send position and speed for each DXL without synk.
			 */
			/*unsigned char aditional_info[48];
			unsigned char aditional_info_len;
			dxl_write_data(DXL, 1, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[0].data, 4, aditional_info, &aditional_info_len, &dxl_err[0]);
			dxl_write_data(DXL, 2, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[1].data, 4, aditional_info, &aditional_info_len, &dxl_err[1]);
			dxl_write_data(DXL, 3, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[2].data, 4, aditional_info, &aditional_info_len, &dxl_err[2]);
			dxl_write_data(DXL, 4, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[3].data, 4, aditional_info, &aditional_info_len, &dxl_err[3]);
			dxl_write_data(DXL, 5, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[4].data, 4, aditional_info, &aditional_info_len, &dxl_err[4]);
			dxl_write_data(DXL, 6, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[5].data, 4, aditional_info, &aditional_info_len, &dxl_err[5]);
			dxl_write_data(DXL, 7, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[6].data, 4, aditional_info, &aditional_info_len, &dxl_err[6]);
			dxl_write_data(DXL, 8, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[7].data, 4, aditional_info, &aditional_info_len, &dxl_err[7]);
			dxl_write_data(DXL, 9, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[8].data, 4, aditional_info, &aditional_info_len, &dxl_err[8]);
			dxl_write_data(DXL, 10, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[9].data, 4, aditional_info, &aditional_info_len, &dxl_err[9]);
			dxl_write_data(DXL, 11, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[10].data, 4, aditional_info, &aditional_info_len, &dxl_err[10]);
			dxl_write_data(DXL, 12, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[11].data, 4, aditional_info, &aditional_info_len, &dxl_err[11]);
			dxl_write_data(DXL, 13, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[12].data, 4, aditional_info, &aditional_info_len, &dxl_err[12]);
			dxl_write_data(DXL, 14, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[13].data, 4, aditional_info, &aditional_info_len, &dxl_err[13]);
			dxl_write_data(DXL, 15, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[14].data, 4, aditional_info, &aditional_info_len, &dxl_err[14]);
			dxl_write_data(DXL, 16, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[15].data, 4, aditional_info, &aditional_info_len, &dxl_err[15]);
			dxl_write_data(DXL, 17, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[16].data, 4, aditional_info, &aditional_info_len, &dxl_err[16]);
			dxl_write_data(DXL, 18, DXL_GOAL_POSITION_L, (unsigned char *)&DXL_PACK[17].data, 4, aditional_info, &aditional_info_len, &dxl_err[17]);*/
		}
	}
示例#13
0
void ProgressNode::set_determinate_mode() {
    determinate = indeterminate->get_value().get_value_or("false") == "false";
    display_value();
}
示例#14
0
static void display_time(struct tm *tick_time) {
  display_value(get_display_hour(tick_time->tm_hour), 0, false);
  display_value(tick_time->tm_min, 1, true);
}