CPHCallOnStepCondition::CPHCallOnStepCondition() { if(physics_world()) set_step(physics_world()->StepsNum()); else set_step(0); }
int flash_ext4_rootfs(char* filename, int quiet, int no_write) { int ret; char path[1000]; // instead of creating new filesystem just delete whole content set_step("Deleting ext4 rootfs"); strcpy(path, "/oldroot_remount/"); if (current_rootfs_sub_dir[0] != '\0') // box with rootSubDir feature { strcat(path, rootfs_sub_dir); strcat(path, "/"); } if (!no_write) { ret = rm_rootfs(path, quiet, no_write); // ignore return value as it always fails, because oldroot_remount cannot be removed } set_step("Writing ext4 rootfs"); set_step_progress(0); if (!no_write && current_rootfs_sub_dir[0] != '\0') // box with rootSubDir feature mkdir(path, 777); // directory is maybe not present if (!untar_rootfs(filename, path, quiet, no_write)) { my_printf("Error writing ext4 rootfs\n"); return 0; } sync(); ret = chdir("/"); // needed to be able to umount filesystem return 1; }
OUTLINE::OUTLINE(PointS startpt, const vector<DIR>& new_steps) :start(startpt), stepcount(static_cast<int16_t>(new_steps.size())), steps(elem_num(stepcount)){ PointS pos = start; box = RectS(pos, pos); auto lastdir = new_steps.back(); auto prevdir = lastdir; int stepindex = 0; for (int srcindex = 0; srcindex < new_steps.size(); ++srcindex, ++stepindex){ auto dir = new_steps[srcindex]; set_step(stepindex, dir); pos += dir; box += pos; if (dir.isReverse(prevdir) && stepindex > 0){ stepindex -= 2; prevdir = stepindex == -1 ? lastdir : step_dir(stepindex); } else{ prevdir = dir; } } assert(pos.x == start.x&&pos.y == start.y);//ÂÖÀª±ØÐë·â±Õ int begin = 0; while (stepindex - 1 > begin && step_dir(begin).isReverse(step_dir(stepindex - 1))){ start += step_dir(begin); //ÆðµãÏòÇ°ÒÆ ++begin; --stepindex; //cancel there-and-back } for (int i = begin; i < stepindex; ++i){ set_step(i - begin, step_dir(i)); } stepcount = stepindex - begin; assert(stepcount >= 4); }
int _tmain(int argc, _TCHAR* argv[]) { std::string s; std::ifstream input("input.txt"); while (getline(input, s)) defusal.push_back(s); for (int i=0; i<defusal.size()-1; ++i) { Color step, nextStep; step = set_step(defusal[i]); nextStep = set_step(defusal[i+1]); switch (step){ case white: if (nextStep == white || nextStep == black) { std::cout << "BOOM\n"; return 0; } break; case black: if (nextStep == white || nextStep == green || nextStep == orange) { std::cout << "BOOM\n"; return 0; } break; case purple: if (nextStep == purple || nextStep == green || nextStep == orange || nextStep == white) { std::cout << "BOOM\n"; return 0; } break; case red: if (nextStep != green) { std::cout << "BOOM\n"; return 0; } break; case green: if (nextStep != orange && nextStep != white) { std::cout << "BOOM\n"; return 0; } break; case orange: if (nextStep != red && nextStep != black) { std::cout << "BOOM\n"; return 0; } break; } } std::cout << "Succussfully defused!" << std::endl; return 0; }
/********************************************************************** * C_OUTLINE::C_OUTLINE * * Constructor to build a C_OUTLINE from a C_OUTLINE_FRAG. **********************************************************************/ C_OUTLINE::C_OUTLINE ( //constructor //steps to copy ICOORD startpt, DIR128 * new_steps, inT16 length //length of loop ):start (startpt), offsets(NULL) { inT8 dirdiff; //direction difference DIR128 prevdir; //previous direction DIR128 dir; //current direction DIR128 lastdir; //dir of last step TBOX new_box; //easy bounding inT16 stepindex; //index to step inT16 srcindex; //source steps ICOORD pos; //current position pos = startpt; stepcount = length; // No. of steps. ASSERT_HOST(length >= 0); steps = reinterpret_cast<uinT8*>(alloc_mem(step_mem())); // Get memory. memset(steps, 0, step_mem()); lastdir = new_steps[length - 1]; prevdir = lastdir; for (stepindex = 0, srcindex = 0; srcindex < length; stepindex++, srcindex++) { new_box = TBOX (pos, pos); box += new_box; //copy steps dir = new_steps[srcindex]; set_step(stepindex, dir); dirdiff = dir - prevdir; pos += step (stepindex); if ((dirdiff == 64 || dirdiff == -64) && stepindex > 0) { stepindex -= 2; //cancel there-and-back prevdir = stepindex >= 0 ? step_dir (stepindex) : lastdir; } else prevdir = dir; } ASSERT_HOST (pos.x () == startpt.x () && pos.y () == startpt.y ()); do { dirdiff = step_dir (stepindex - 1) - step_dir (0); if (dirdiff == 64 || dirdiff == -64) { start += step (0); stepindex -= 2; //cancel there-and-back for (int i = 0; i < stepindex; ++i) set_step(i, step_dir(i + 1)); } } while (stepindex > 1 && (dirdiff == 64 || dirdiff == -64)); stepcount = stepindex; ASSERT_HOST (stepcount >= 4); }
void C_OUTLINE::reverse() { //reverse drection DIR128 halfturn = MODULUS / 2; //amount to shift DIR128 stepdir; //direction of step inT16 stepindex; //index to cstep inT16 farindex; //index to other side inT16 halfsteps; //half of stepcount halfsteps = (stepcount + 1) / 2; for (stepindex = 0; stepindex < halfsteps; stepindex++) { farindex = stepcount - stepindex - 1; stepdir = step_dir (stepindex); set_step (stepindex, step_dir (farindex) + halfturn); set_step (farindex, stepdir + halfturn); } }
ProgressWindow::ProgressWindow(ContainerWindow &parent) { set(parent, InfoBoxLayout::landscape ? (LPCTSTR)IDD_PROGRESS_LANDSCAPE : (LPCTSTR)IDD_PROGRESS); TCHAR Temp[1024]; _stprintf(Temp, _T("%s %s"), gettext(_T("Version")), XCSoar_Version); set_item_text(IDC_VERSION, Temp); #ifdef WINDOWSPC RECT rc = parent.get_client_rect(); RECT rcp = get_client_rect(); move(rc.left, rc.top, rcp.right - rcp.left, rcp.bottom - rcp.top); #else #ifndef GNAV SHFullScreen(hWnd, SHFS_HIDETASKBAR|SHFS_HIDESIPBUTTON|SHFS_HIDESTARTICON); #endif #endif insert_after(HWND_TOP, true); set_range(0, 100); set_step(5); #ifndef ENABLE_SDL ::SetForegroundWindow(hWnd); #endif /* !ENABLE_SDL */ update(); }
/************************************************************************* * FUNCTION * SUNNY_S5S01D_S5K3E2FX_INTERNAL_lens_af_move_to * * DESCRIPTION * This function is to move lens to target pos * * PARAMETERS * set lens move to target pos * * RETURNS * NONE * * GLOBALS AFFECTED * *************************************************************************/ void SUNNY_S5S01D_S5K3E2FX_INTERNAL_lens_af_move_to( kal_int32 target_pos ) { g_curr_pos = target_pos; if( target_pos > g_macro_pos ) g_curr_pos = g_macro_pos; set_step(g_curr_pos); }
void move_backward(unsigned long ms, int steps) { struct timespec wait = {0}; wait.tv_nsec = ms * 1000000L; int i; for (i = 0; i < steps; i++) { set_step(1, 0, 0, 1); nanosleep(&wait, NULL); set_step(0, 1, 0, 1); nanosleep(&wait, NULL); set_step(0, 1, 1, 0); nanosleep(&wait, NULL); set_step(1, 0, 1, 0); nanosleep(&wait, NULL); } }
C_OUTLINE::C_OUTLINE ( //constructor CRACKEDGE * startpt, //outline to convert ICOORD bot_left, //bounding box ICOORD top_right, inT16 length //length of loop ):box (bot_left, top_right), start (startpt->pos), offsets(NULL) { inT16 stepindex; //index to step CRACKEDGE *edgept; //current point stepcount = length; //no of steps if (length == 0) { steps = NULL; return; } //get memory steps = (uinT8 *) alloc_mem (step_mem()); memset(steps, 0, step_mem()); edgept = startpt; for (stepindex = 0; stepindex < length; stepindex++) { //set compact step set_step (stepindex, edgept->stepdir); edgept = edgept->next; } }
void main() { unsigned int8 d; // delay value unsigned int8 i; unsigned int8 obyte=0; int16 spin; // pwm 0->1023 char c; // port D (7:0) SW,DW SZ,DZ SY,DY SX,DX init(); usb_cdc_init(); usb_init(); usb_wait_for_enumeration(); while (TRUE) { // get chars from usb housekeep(); // now process the input and feed output queue if (nqueue(&rxque0) > 0) { c = dequeue(&rxque0); if ((c&0xf0) == 0x90) { // step code obyte &= 0x55; // zero step bits if (c&XMASK) { obyte|= 0x02; } if (c&YMASK) { obyte|= 0x08; } if (c&ZMASK) { obyte|= 0x20; } if (c&WMASK) { obyte|= 0x80; } feed(obyte); } else if ((c&0x80)==0) { // delay code d = ((unsigned int8)c)&0x7f; for (i=1; i<=d; i++) { feed(0x00); // stall } } else if ((c&0xf0) == 0x80) { // dir code obyte &= 0xaa; // zero dir bits if (c&XMASK) { obyte|= 0x01; } if (c&YMASK) { obyte|= 0x04; } if (c&ZMASK) { obyte|= 0x10; } if (c&WMASK) { obyte|= 0x40; } } else if ((c&0xf0) == 0xa0) { if ((c&0x08)) { d = ((unsigned int8)c)&0x07; enable(d); // state } else { d = ((unsigned int8)c)&0x07; set_step(d); // mode } } else if ((c&0xc0) == 0xc0) { // spindle PWM speed spin=c&0x3f; // get the bits spin = spin<<4; set_pwm1_duty(spin); // duty cycle is val/(4*(255+1)) } else { ; // unknown code, silently ignore } } } }
scpi_result_t scpi_source_VoltageStep(scpi_t * context) { Channel *channel = set_channel_from_command_number(context); if (!channel) { return SCPI_RES_ERR; } return set_step(context, &channel->u, channel->U_MIN_STEP, channel->U_MAX_STEP, channel->U_DEF_STEP, SCPI_UNIT_VOLT); }
scpi_result_t scpi_source_CurrentStep(scpi_t * context) { Channel *channel = set_channel_from_command_number(context); if (!channel) { return SCPI_RES_ERR; } return set_step(context, &channel->i, channel->I_MIN_STEP, channel->I_MAX_STEP, channel->I_DEF_STEP, SCPI_UNIT_AMPER); }
/************************************************************************* * FUNCTION * SUNNY_S5S01D_S5K3E2FX_INTERNAL_lens_af_step_ccw * * DESCRIPTION * This function is to move lens ccw number steps, go macro * * PARAMETERS * set lens ccw move steps * * RETURNS * NONE * * GLOBALS AFFECTED * *************************************************************************/ void SUNNY_S5S01D_S5K3E2FX_INTERNAL_lens_af_step_ccw(kal_uint32 number) { if(g_curr_pos>=number) g_curr_pos-=number; else g_curr_pos = g_home_pos; set_step(g_curr_pos); } /* lens_step_motor_step_ccw() */
/************************************************************************* * FUNCTION * SUNNY_S5S01D_S5K3E2FX_INTERNAL_lens_af_step_cw * * DESCRIPTION * This function is to move lens cw number steps, go infinite * * PARAMETERS * set lens cw move steps * * RETURNS * NONE * * GLOBALS AFFECTED * *************************************************************************/ void SUNNY_S5S01D_S5K3E2FX_INTERNAL_lens_af_step_cw(kal_uint32 number) { if((g_curr_pos+number)<g_macro_pos) g_curr_pos+=number; else g_curr_pos = g_macro_pos; set_step(g_curr_pos); } /* lens_step_motor_step_cw() */
/************************************************************************* * FUNCTION * SUNNY_S5S01D_S5K3E2FX_INTERNAL_lens_power_off * * DESCRIPTION * This function is to turn off vcm af lens power. * * PARAMETERS * None * * RETURNS * None * * GLOBALS AFFECTED * *************************************************************************/ void SUNNY_S5S01D_S5K3E2FX_INTERNAL_lens_power_off(void) { //kal_uint16 reg_value_H, reg_value_L; g_curr_pos = g_home_pos; set_step(g_curr_pos); S5K3E2_INTERNAL_LENS_write_reg(S5K3E2_LENS_POSITION_REG_M, (g_curr_pos>>8)&0xFF); S5K3E2_INTERNAL_LENS_write_reg(S5K3E2_LENS_POSITION_REG_L, (g_curr_pos)&0xFF); S5K3E2_INTERNAL_LENS_write_reg(S5K3E2_LENS_START_REG, 0x00); lens_af_power_on(KAL_FALSE); }
void AnalogAudioView::on_show_options_frequency() { auto widget = std::make_unique<FrequencyOptionsView>(options_view_rect, &style_options_group); widget->set_step(receiver_model.frequency_step()); widget->on_change_step = [this](rf::Frequency f) { this->on_frequency_step_changed(f); }; widget->set_reference_ppm_correction(persistent_memory::correction_ppb() / 1000); widget->on_change_reference_ppm_correction = [this](int32_t v) { this->on_reference_ppm_correction_changed(v); }; set_options_widget(std::move(widget)); field_frequency.set_style(&style_options_group); }
void init() { unsigned int16 i; blink(); init_queue(&rxque0); init_queue(&txque0); set_step(1); // 0=full, 1=1/2, 5=1/4, 4=1/8, 7=1/16 enable(1); //setup_counters(T0_INTERNAL, T0_DIV_1 | T0_8_BIT); setup_counters(T0_INTERNAL, T0_DIV_2 | T0_8_BIT); set_timer0(0); enable_interrupts(INT_RTCC); enable_interrupts(INT_RDA); enable_interrupts(GLOBAL); output_bit(CTS,0); // ready to receive from usb output_bit(STROBE,1); // parallel port strobe // input(PIN_C3); // ESTOP input(PIN_C4); // ALIM input(PIN_C0); // XLIM input(PIN_C1); // YLIM // input(PIN_C2); // ZLIM output_bit(PIN_C2,0); // changed from ZLIM to PWM OUTPUT setup_ccp1(CCP_PWM); setup_timer_2(T2_DIV_BY_16, 255, 1); // mode, period, postscale set_timer2(0); set_pwm1_duty(0); // duty cycle is val/(4*(255+1)) }
void KappaCoefficientOptimizationThreshold::from_XML(const tinyxml2::XMLDocument& document) { const tinyxml2::XMLElement* root_element = document.FirstChildElement("KappaCoefficientOptimizationThreshold"); if(!root_element) { std::ostringstream buffer; buffer << "OpenNN Exception: KappaCoefficientOptimizationThreshold class.\n" << "void from_XML(const tinyxml2::XMLDocument&) method.\n" << "KappaCoefficientOptimizationThreshold element is NULL.\n"; throw std::logic_error(buffer.str()); } // Minimum threshold { const tinyxml2::XMLElement* element = root_element->FirstChildElement("MinimumThreshold"); if(element) { const double new_minimum_threshold = atof(element->GetText()); try { set_minimum_threshold(new_minimum_threshold); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Maximum threshold { const tinyxml2::XMLElement* element = root_element->FirstChildElement("MaximumThreshold"); if(element) { const double new_maximum_threshold = atof(element->GetText()); try { set_maximum_threshold(new_maximum_threshold); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Step { const tinyxml2::XMLElement* element = root_element->FirstChildElement("Step"); if(element) { const double new_step = atof(element->GetText()); try { set_step(new_step); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Reserve function data { const tinyxml2::XMLElement* element = root_element->FirstChildElement("ReserveFunctionData"); if(element) { const std::string new_reserve_function_data = element->GetText(); try { set_reserve_function_data(new_reserve_function_data != "0"); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Display // { // const tinyxml2::XMLElement* element = root_element->FirstChildElement("Display"); // if(element) // { // const std::string new_display = element->GetText(); // try // { // set_display(new_display != "0"); // } // catch(const std::logic_error& e) // { // std::cout << e.what() << std::endl; // } // } // } }
void CPHCallOnStepCondition::set_steps_interval(u64 steps) { set_step(physics_world()->StepsNum()+steps); }
void CPHCallOnStepCondition::set_global_time(float time) { float time_interval=Device.fTimeGlobal-time; if(time_interval<0.f)set_step(physics_world()->StepsNum()); set_time_interval(time_interval); }
int flash_ext4_kernel(char* device, char* filename, off_t kernel_file_size, int quiet, int no_write) { char buffer[512]; // Open kernel file FILE* kernel_file; kernel_file = fopen(filename, "rb"); if (kernel_file == NULL) { my_printf("Error while opening kernel file %s\n", filename); return 0; } // Open kernel device FILE* kernel_dev; kernel_dev = fopen(device, "wb"); if (kernel_dev == NULL) { my_printf("Error while opening kernel device %s\n", device); return 0; } set_step("Writing ext4 kernel"); int ret; long long readBytes = 0; int current_percent = 0; int new_percent = 0; while (!feof(kernel_file)) { // Don't add my_printf for debugging! Debug messages will be written to kernel device! ret = fread(buffer, 1, sizeof(buffer), kernel_file); if (ret == 0) { if (feof(kernel_file)) continue; my_printf("Error reading kernel file.\n"); fclose(kernel_file); fclose(kernel_dev); return 0; } readBytes += ret; new_percent = readBytes * 100/ kernel_file_size; if (current_percent < new_percent) { set_step_progress(new_percent); current_percent = new_percent; } if (!no_write) { ret = fwrite(buffer, ret, 1, kernel_dev); if (ret != 1) { my_printf("Error writing kernel file to kernel device.\n"); fclose(kernel_file); fclose(kernel_dev); return 0; } } } fclose(kernel_file); fclose(kernel_dev); return 1; }
C_OUTLINE::C_OUTLINE( //constructor C_OUTLINE *srcline, //outline to FCOORD rotation //rotate ) : offsets(NULL) { TBOX new_box; //easy bounding inT16 stepindex; //index to step inT16 dirdiff; //direction change ICOORD pos; //current position ICOORD prevpos; //previous dest point ICOORD destpos; //destination point inT16 destindex; //index to step DIR128 dir; //coded direction uinT8 new_step; stepcount = srcline->stepcount * 2; if (stepcount == 0) { steps = NULL; box = srcline->box; box.rotate(rotation); return; } //get memory steps = (uinT8 *) alloc_mem (step_mem()); memset(steps, 0, step_mem()); for (int iteration = 0; iteration < 2; ++iteration) { DIR128 round1 = iteration == 0 ? 32 : 0; DIR128 round2 = iteration != 0 ? 32 : 0; pos = srcline->start; prevpos = pos; prevpos.rotate (rotation); start = prevpos; box = TBOX (start, start); destindex = 0; for (stepindex = 0; stepindex < srcline->stepcount; stepindex++) { pos += srcline->step (stepindex); destpos = pos; destpos.rotate (rotation); // tprintf("%i %i %i %i ", destpos.x(), destpos.y(), pos.x(), pos.y()); while (destpos.x () != prevpos.x () || destpos.y () != prevpos.y ()) { dir = DIR128 (FCOORD (destpos - prevpos)); dir += 64; //turn to step style new_step = dir.get_dir (); // tprintf(" %i\n", new_step); if (new_step & 31) { set_step(destindex++, dir + round1); prevpos += step(destindex - 1); if (destindex < 2 || ((dirdiff = step_dir (destindex - 1) - step_dir (destindex - 2)) != -64 && dirdiff != 64)) { set_step(destindex++, dir + round2); prevpos += step(destindex - 1); } else { prevpos -= step(destindex - 1); destindex--; prevpos -= step(destindex - 1); set_step(destindex - 1, dir + round2); prevpos += step(destindex - 1); } } else { set_step(destindex++, dir); prevpos += step(destindex - 1); } while (destindex >= 2 && ((dirdiff = step_dir (destindex - 1) - step_dir (destindex - 2)) == -64 || dirdiff == 64)) { prevpos -= step(destindex - 1); prevpos -= step(destindex - 2); destindex -= 2; // Forget u turn } //ASSERT_HOST(prevpos.x() == destpos.x() && prevpos.y() == destpos.y()); new_box = TBOX (destpos, destpos); box += new_box; } } ASSERT_HOST (destpos.x () == start.x () && destpos.y () == start.y ()); dirdiff = step_dir (destindex - 1) - step_dir (0); while ((dirdiff == 64 || dirdiff == -64) && destindex > 1) { start += step (0); destindex -= 2; for (int i = 0; i < destindex; ++i) set_step(i, step_dir(i + 1)); dirdiff = step_dir (destindex - 1) - step_dir (0); } if (destindex >= 4) break; } ASSERT_HOST(destindex <= stepcount); stepcount = destindex; destpos = start; for (stepindex = 0; stepindex < stepcount; stepindex++) { destpos += step (stepindex); } ASSERT_HOST (destpos.x () == start.x () && destpos.y () == start.y ()); }
void IncrementalOrder::from_XML(const tinyxml2::XMLDocument& document) { const tinyxml2::XMLElement* root_element = document.FirstChildElement("IncrementalOrder"); if(!root_element) { std::ostringstream buffer; buffer << "OpenNN Exception: IncrementalOrder class.\n" << "void from_XML(const tinyxml2::XMLDocument&) method.\n" << "IncrementalOrder element is NULL.\n"; throw std::logic_error(buffer.str()); } // Minimum order { const tinyxml2::XMLElement* element = root_element->FirstChildElement("MinimumOrder"); if(element) { const size_t new_minimum_order = atoi(element->GetText()); try { minimum_order = new_minimum_order; } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Maximum order { const tinyxml2::XMLElement* element = root_element->FirstChildElement("MaximumOrder"); if(element) { const size_t new_maximum_order = atoi(element->GetText()); try { maximum_order = new_maximum_order; } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Parameters assays number { const tinyxml2::XMLElement* element = root_element->FirstChildElement("TrialsNumber"); if(element) { const size_t new_trials_number = atoi(element->GetText()); try { set_trials_number(new_trials_number); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Performance calculation method { const tinyxml2::XMLElement* element = root_element->FirstChildElement("PerformanceCalculationMethod"); if(element) { const std::string new_performance_calculation_method = element->GetText(); try { set_performance_calculation_method(new_performance_calculation_method); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Step { const tinyxml2::XMLElement* element = root_element->FirstChildElement("Step"); if(element) { const size_t new_step = atoi(element->GetText()); try { set_step(new_step); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Reserve parameters data { const tinyxml2::XMLElement* element = root_element->FirstChildElement("ReserveParametersData"); if(element) { const std::string new_reserve_parameters_data = element->GetText(); try { set_reserve_parameters_data(new_reserve_parameters_data != "0"); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Reserve performance data { const tinyxml2::XMLElement* element = root_element->FirstChildElement("ReservePerformanceData"); if(element) { const std::string new_reserve_performance_data = element->GetText(); try { set_reserve_performance_data(new_reserve_performance_data != "0"); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Reserve generalization performance data { const tinyxml2::XMLElement* element = root_element->FirstChildElement("ReserveGeneralizationPerformanceData"); if(element) { const std::string new_reserve_generalization_performance_data = element->GetText(); try { set_reserve_generalization_performance_data(new_reserve_generalization_performance_data != "0"); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Reserve minimal parameters { const tinyxml2::XMLElement* element = root_element->FirstChildElement("ReserveMinimalParameters"); if(element) { const std::string new_reserve_minimal_parameters = element->GetText(); try { set_reserve_minimal_parameters(new_reserve_minimal_parameters != "0"); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Display { const tinyxml2::XMLElement* element = root_element->FirstChildElement("Display"); if(element) { const std::string new_display = element->GetText(); try { set_display(new_display != "0"); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Selection performance goal { const tinyxml2::XMLElement* element = root_element->FirstChildElement("SelectionPerformanceGoal"); if(element) { const double new_selection_performance_goal = atof(element->GetText()); try { set_selection_performance_goal(new_selection_performance_goal); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Maximum iterations number { const tinyxml2::XMLElement* element = root_element->FirstChildElement("MaximumIterationsNumber"); if(element) { const size_t new_maximum_iterations_number = atoi(element->GetText()); try { set_maximum_iterations_number(new_maximum_iterations_number); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Maximum time { const tinyxml2::XMLElement* element = root_element->FirstChildElement("MaximumTime"); if(element) { const double new_maximum_time = atoi(element->GetText()); try { set_maximum_time(new_maximum_time); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Tolerance { const tinyxml2::XMLElement* element = root_element->FirstChildElement("Tolerance"); if(element) { const double new_tolerance = atof(element->GetText()); try { set_tolerance(new_tolerance); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } // Maximum generalization failures { const tinyxml2::XMLElement* element = root_element->FirstChildElement("MaximumSelectionFailures"); if(element) { const size_t new_maximum_selection_failures = atoi(element->GetText()); try { set_maximum_selection_failures(new_maximum_selection_failures); } catch(const std::logic_error& e) { std::cout << e.what() << std::endl; } } } }
/************************************************************************* * FUNCTION * SUNNY_S5S01D_S5K3E2FX_INTERNAL_lens_power_on * * DESCRIPTION * This function is to turn on vcm af lens power. * * PARAMETERS * None * * RETURNS * None * * GLOBALS AFFECTED * *************************************************************************/ void SUNNY_S5S01D_S5K3E2FX_INTERNAL_lens_power_on(void) { lens_af_power_on(KAL_TRUE); S5K3E2_INTERNAL_LENS_write_reg(S5K3E2_LENS_START_REG, 0x03); set_step(g_curr_pos); }