From 510e8123f3826938cfe3fdda68d4eef0a9519976 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 4 Aug 2019 12:01:49 +0300 Subject: [PATCH] genesys: Remove support for multiple motor power modes --- backend/genesys.cc | 42 ++++------ backend/genesys_devices.cc | 162 +++++++++++++------------------------ backend/genesys_gl841.cc | 65 ++++----------- backend/genesys_gl841.h | 3 +- backend/genesys_gl843.cc | 9 +-- backend/genesys_gl846.cc | 8 +- backend/genesys_gl847.cc | 8 +- backend/genesys_low.h | 12 +-- backend/genesys_motor.h | 14 +--- 9 files changed, 104 insertions(+), 219 deletions(-) diff --git a/backend/genesys.cc b/backend/genesys.cc index f902e830f..fced64353 100644 --- a/backend/genesys.cc +++ b/backend/genesys.cc @@ -415,12 +415,10 @@ sanei_genesys_generate_slope_table (uint16_t * slope_table, * @param yres Resolution of a scan line * @param used_steps Final number of steps is stored here * @param final_exposure Final step time is stored here - * @param power_mode Power mode (related to the Vref used) of the motor * @return Time for acceleration * @note all times in pixel time */ -SANE_Int -sanei_genesys_create_slope_table3 (Genesys_Device * dev, +SANE_Int sanei_genesys_create_slope_table3(Genesys_Device * dev, uint16_t * slope_table, int max_step, unsigned int use_steps, @@ -428,8 +426,7 @@ sanei_genesys_create_slope_table3 (Genesys_Device * dev, int exposure_time, double yres, unsigned int *used_steps, - unsigned int *final_exposure, - int power_mode) + unsigned int *final_exposure) { unsigned int sum_time = 0; unsigned int vtarget; @@ -437,14 +434,14 @@ sanei_genesys_create_slope_table3 (Genesys_Device * dev, unsigned int vstart; unsigned int vfinal; - DBG(DBG_proc, "%s: step_type = %d, exposure_time = %d, yres = %g, power_mode = %d\n", __func__, - step_type, exposure_time, yres, power_mode); + DBG(DBG_proc, "%s: step_type = %d, exposure_time = %d, yres = %g\n", __func__, + step_type, exposure_time, yres); /* final speed */ vtarget = (exposure_time * yres) / dev->motor.base_ydpi; - vstart = dev->motor.slopes[power_mode][step_type].maximum_start_speed; - vend = dev->motor.slopes[power_mode][step_type].maximum_speed; + vstart = dev->motor.slopes[step_type].maximum_start_speed; + vend = dev->motor.slopes[step_type].maximum_speed; vtarget >>= step_type; if (vtarget > 65535) @@ -464,8 +461,8 @@ sanei_genesys_create_slope_table3 (Genesys_Device * dev, vtarget, vstart, vend, - dev->motor.slopes[power_mode][step_type].minimum_steps << step_type, - dev->motor.slopes[power_mode][step_type].g, + dev->motor.slopes[step_type].minimum_steps << step_type, + dev->motor.slopes[step_type].g, used_steps, &vfinal); @@ -484,8 +481,7 @@ static SANE_Int genesys_create_slope_table2 (Genesys_Device * dev, uint16_t * slope_table, int steps, int step_type, int exposure_time, - SANE_Bool same_speed, double yres, - int power_mode) + SANE_Bool same_speed, double yres) { double t, g; SANE_Int sum = 0; @@ -493,8 +489,8 @@ genesys_create_slope_table2 (Genesys_Device * dev, int i; DBG(DBG_proc, "%s: %d steps, step_type = %d, " - "exposure_time = %d, same_speed = %d, yres = %.2f, power_mode = %d\n", __func__, steps, - step_type, exposure_time, same_speed, yres, power_mode); + "exposure_time = %d, same_speed = %d, yres = %.2f\n", __func__, steps, + step_type, exposure_time, same_speed, yres); /* start speed */ if (dev->model->motor_type == MOTOR_5345) @@ -604,8 +600,7 @@ SANE_Int sanei_genesys_create_slope_table (Genesys_Device * dev, uint16_t * slope_table, int steps, int step_type, int exposure_time, - SANE_Bool same_speed, double yres, - int power_mode) + SANE_Bool same_speed, double yres) { double t; double start_speed; @@ -620,7 +615,7 @@ sanei_genesys_create_slope_table (Genesys_Device * dev, || dev->model->motor_type == MOTOR_HP2400) return genesys_create_slope_table2 (dev, slope_table, steps, step_type, exposure_time, - same_speed, yres, power_mode); + same_speed, yres); DBG(DBG_proc, "%s: %d steps, step_type = %d, exposure_time = %d, same_speed =%d\n", __func__, steps, step_type, exposure_time, same_speed); @@ -827,13 +822,10 @@ void sanei_genesys_create_default_gamma_table(Genesys_Device* dev, */ SANE_Int sanei_genesys_exposure_time2 (Genesys_Device * dev, float ydpi, - int step_type, int endpixel, - int exposure_by_led, int power_mode) + int step_type, int endpixel, int exposure_by_led) { int exposure_by_ccd = endpixel + 32; - int exposure_by_motor = - (dev->motor.slopes[power_mode][step_type].maximum_speed - * dev->motor.base_ydpi) / ydpi; + int exposure_by_motor = (dev->motor.slopes[step_type].maximum_speed * dev->motor.base_ydpi) / ydpi; int exposure = exposure_by_ccd; @@ -843,8 +835,8 @@ sanei_genesys_exposure_time2 (Genesys_Device * dev, float ydpi, if (exposure < exposure_by_led && dev->model->is_cis) exposure = exposure_by_led; - DBG(DBG_info, "%s: ydpi=%d, step=%d, endpixel=%d led=%d, power=%d => exposure=%d\n", __func__, - (int)ydpi, step_type, endpixel, exposure_by_led, power_mode, exposure); + DBG(DBG_info, "%s: ydpi=%d, step=%d, endpixel=%d led=%d => exposure=%d\n", __func__, + (int)ydpi, step_type, endpixel, exposure_by_led, exposure); return exposure; } diff --git a/backend/genesys_devices.cc b/backend/genesys_devices.cc index 1f90a426b..aef3937cd 100644 --- a/backend/genesys_devices.cc +++ b/backend/genesys_devices.cc @@ -2712,22 +2712,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 1200; motor.optical_ydpi = 2400; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 11000; slope.maximum_speed = 3000; slope.minimum_steps = 128; slope.g = 1.0; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 11000; slope.maximum_speed = 3000; slope.minimum_steps = 128; slope.g = 1.0; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -2737,22 +2735,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 1200; motor.optical_ydpi = 2400; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 2000; slope.maximum_speed = 1375; slope.minimum_steps = 128; slope.g = 0.5; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 2000; slope.maximum_speed = 1375; slope.minimum_steps = 128; slope.g = 0.5; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -2762,22 +2758,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 2400; motor.optical_ydpi = 2400; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 2289; slope.maximum_speed = 2100; slope.minimum_steps = 128; slope.g = 0.3; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 2289; slope.maximum_speed = 2100; slope.minimum_steps = 128; slope.g = 0.3; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -2787,22 +2781,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 1200; motor.optical_ydpi = 2400; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 11000; slope.maximum_speed = 3000; slope.minimum_steps = 128; slope.g = 0.25; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 11000; slope.maximum_speed = 3000; slope.minimum_steps = 128; slope.g = 0.5; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -2812,8 +2804,6 @@ void genesys_init_motor_tables() motor.base_ydpi = 1200; motor.optical_ydpi = 1200; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); @@ -2821,14 +2811,14 @@ void genesys_init_motor_tables() slope.maximum_speed = 3000; slope.minimum_steps = 128; slope.g = 0.25; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 11000; slope.maximum_speed = 3000; slope.minimum_steps = 128; slope.g = 0.5; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -2838,22 +2828,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 600; motor.optical_ydpi = 1200; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3200; slope.maximum_speed = 1200; slope.minimum_steps = 128; slope.g = 0.5; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3200; slope.maximum_speed = 1200; slope.minimum_steps = 128; slope.g = 0.5; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -2863,22 +2851,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 1200; motor.optical_ydpi = 2400; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3500; slope.maximum_speed = 1300; slope.minimum_steps = 60; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3500; slope.maximum_speed = 1400; slope.minimum_steps = 60; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -2888,22 +2874,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 600; motor.optical_ydpi = 600; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3500; slope.maximum_speed = 1300; slope.minimum_steps = 60; slope.g = 0.25; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3500; slope.maximum_speed = 1400; slope.minimum_steps = 60; slope.g = 0.5; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -2913,8 +2897,6 @@ void genesys_init_motor_tables() motor.base_ydpi = 300; motor.optical_ydpi = 600; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); // works best with GPIO10, GPIO14 off @@ -2922,14 +2904,14 @@ void genesys_init_motor_tables() slope.maximum_speed = 3700; slope.minimum_steps = 2; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 11000; slope.maximum_speed = 11000; slope.minimum_steps = 2; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -2939,22 +2921,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 750; motor.optical_ydpi = 1500; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3000; slope.maximum_speed = 2500; slope.minimum_steps = 10; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 11000; slope.maximum_speed = 11000; slope.minimum_steps = 2; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -2964,22 +2944,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 750; motor.optical_ydpi = 1500; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3000; slope.maximum_speed = 2600; slope.minimum_steps = 10; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 11000; slope.maximum_speed = 11000; slope.minimum_steps = 2; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -2988,22 +2966,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 750; motor.optical_ydpi = 1500; motor.max_step_type = 2; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 6666; slope.maximum_speed = 3700; slope.minimum_steps = 8; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 6666; slope.maximum_speed = 3700; slope.minimum_steps = 8; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3013,29 +2989,27 @@ void genesys_init_motor_tables() motor.base_ydpi = 1200; motor.optical_ydpi = 6400; motor.max_step_type = 2; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); // full step slope.maximum_start_speed = 3000; slope.maximum_speed = 1000; slope.minimum_steps = 127; slope.g = 0.50; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // half step slope.maximum_start_speed = 3000; slope.maximum_speed = 1500; slope.minimum_steps = 127; slope.g = 0.50; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // quarter step 0.75*2712 slope.maximum_start_speed = 3*2712; slope.maximum_speed = 3*2712; slope.minimum_steps = 16; slope.g = 0.80; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3045,29 +3019,27 @@ void genesys_init_motor_tables() motor.base_ydpi = 1200; motor.optical_ydpi = 6400; motor.max_step_type = 2; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); // full step slope.maximum_start_speed = 3000; slope.maximum_speed = 1000; slope.minimum_steps = 127; slope.g = 0.50; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // half step slope.maximum_start_speed = 3000; slope.maximum_speed = 1500; slope.minimum_steps = 127; slope.g = 0.50; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // quarter step 0.75*2712 slope.maximum_start_speed = 3*2712; slope.maximum_speed = 3*2712; slope.minimum_steps = 16; slope.g = 0.80; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3077,29 +3049,27 @@ void genesys_init_motor_tables() motor.base_ydpi = 1200; motor.optical_ydpi = 6400; motor.max_step_type = 2; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); // full step slope.maximum_start_speed = 3000; slope.maximum_speed = 1000; slope.minimum_steps = 127; slope.g = 0.50; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // half step slope.maximum_start_speed = 3000; slope.maximum_speed = 1500; slope.minimum_steps = 127; slope.g = 0.50; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // quarter step 0.75*2712 slope.maximum_start_speed = 3*2712; slope.maximum_speed = 3*2712; slope.minimum_steps = 16; slope.g = 0.80; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3109,29 +3079,27 @@ void genesys_init_motor_tables() motor.base_ydpi = 1200; motor.optical_ydpi = 1200; motor.max_step_type = 2; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); // max speed / dpi * base dpi => exposure slope.maximum_start_speed = 22222; slope.maximum_speed = 500; slope.minimum_steps = 246; slope.g = 0.5; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 22222; slope.maximum_speed = 500; slope.minimum_steps = 246; slope.g = 0.5; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 22222; slope.maximum_speed = 500; slope.minimum_steps = 246; slope.g = 0.5; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3141,29 +3109,27 @@ void genesys_init_motor_tables() motor.base_ydpi = 2400; motor.optical_ydpi = 9600; motor.max_step_type = 2; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); // full step slope.maximum_start_speed = 3961; slope.maximum_speed = 240; slope.minimum_steps = 246; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // half step slope.maximum_start_speed = 3961; slope.maximum_speed = 240; slope.minimum_steps = 246; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // quarter step slope.maximum_start_speed = 3961; slope.maximum_speed = 240; slope.minimum_steps = 246; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3173,29 +3139,27 @@ void genesys_init_motor_tables() motor.base_ydpi = 1200; motor.optical_ydpi = 9600; motor.max_step_type = 2; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); // full step slope.maximum_start_speed = 3961; slope.maximum_speed = 240; slope.minimum_steps = 246; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // half step slope.maximum_start_speed = 3961; slope.maximum_speed = 240; slope.minimum_steps = 246; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // quarter step slope.maximum_start_speed = 3961; slope.maximum_speed = 240; slope.minimum_steps = 246; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3205,29 +3169,27 @@ void genesys_init_motor_tables() motor.base_ydpi = 2400; motor.optical_ydpi = 9600; motor.max_step_type = 2; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); // full step slope.maximum_start_speed = 3961; slope.maximum_speed = 240; slope.minimum_steps = 246; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // half step slope.maximum_start_speed = 3961; slope.maximum_speed = 240; slope.minimum_steps = 246; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); // quarter step slope.maximum_start_speed = 3961; slope.maximum_speed = 240; slope.minimum_steps = 246; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3237,15 +3199,13 @@ void genesys_init_motor_tables() motor.base_ydpi = 4800; motor.optical_ydpi = 9600; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); // full step slope.maximum_start_speed = 3000; slope.maximum_speed = 1000; slope.minimum_steps = 256; slope.g = 0.50; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3255,15 +3215,13 @@ void genesys_init_motor_tables() motor.base_ydpi = 4800; motor.optical_ydpi = 9600; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3000; slope.maximum_speed = 1000; slope.minimum_steps = 256; slope.g = 0.50; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3273,15 +3231,13 @@ void genesys_init_motor_tables() motor.base_ydpi = 4800; motor.optical_ydpi = 9600; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3000; slope.maximum_speed = 1000; slope.minimum_steps = 256; slope.g = 0.50; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3291,22 +3247,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 1200; motor.optical_ydpi = 2400; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3500; slope.maximum_speed = 1300; slope.minimum_steps = 60; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3500; slope.maximum_speed = 3250; slope.minimum_steps = 60; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3316,22 +3270,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 600; motor.optical_ydpi = 1200; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3500; slope.maximum_speed = 1300; slope.minimum_steps = 60; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3500; slope.maximum_speed = 3250; slope.minimum_steps = 60; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3341,22 +3293,20 @@ void genesys_init_motor_tables() motor.base_ydpi = 600; motor.optical_ydpi = 1200; motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3500; slope.maximum_speed = 1300; slope.minimum_steps = 60; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 3500; slope.maximum_speed = 3250; slope.minimum_steps = 60; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); @@ -3366,15 +3316,13 @@ void genesys_init_motor_tables() motor.base_ydpi = 2400; motor.optical_ydpi = 4800, // 9600 motor.max_step_type = 1; - motor.power_mode_count = 1; - motor.slopes.resize(1); slope = Genesys_Motor_Slope(); slope.maximum_start_speed = 9560; slope.maximum_speed = 1912; slope.minimum_steps = 31; slope.g = 0.8; - motor.slopes.back().push_back(slope); + motor.slopes.push_back(slope); s_motors->push_back(std::move(motor)); } diff --git a/backend/genesys_gl841.cc b/backend/genesys_gl841.cc index c1660785d..f041879ad 100644 --- a/backend/genesys_gl841.cc +++ b/backend/genesys_gl841.cc @@ -984,7 +984,6 @@ static void gl841_init_motor_regs(Genesys_Device* dev, const Genesys_Sensor& sen { DBG_HELPER_ARGS(dbg, "feed_steps=%d, action=%d, flags=%x", feed_steps, action, flags); unsigned int fast_exposure; - int scan_power_mode; int use_fast_fed = 0; uint16_t fast_slope_table[256]; unsigned int fast_slope_steps = 0; @@ -1010,17 +1009,16 @@ static void gl841_init_motor_regs(Genesys_Device* dev, const Genesys_Sensor& sen dev->motor.base_ydpi / 4, 0, 0, - 0, - &scan_power_mode); + 0); DBG(DBG_info, "%s : fast_exposure=%d pixels\n", __func__, fast_exposure); } if (action == MOTOR_ACTION_HOME_FREE) { /* HOME_FREE must be able to stop in one step, so do not try to get faster */ - fast_exposure = dev->motor.slopes[0][0].maximum_start_speed; + fast_exposure = dev->motor.slopes[0].maximum_start_speed; } - sanei_genesys_create_slope_table3 ( + sanei_genesys_create_slope_table3( dev, fast_slope_table, 256, @@ -1028,8 +1026,8 @@ static void gl841_init_motor_regs(Genesys_Device* dev, const Genesys_Sensor& sen 0, fast_exposure, dev->motor.base_ydpi / 4, - &fast_slope_steps, - &fast_exposure, 0); + &fast_slope_steps, + &fast_exposure); feedl = feed_steps - fast_slope_steps*2; use_fast_fed = 1; @@ -1137,16 +1135,14 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor // number of scan lines to add in a scan_lines line unsigned int feed_steps,/*1/base_ydpi*/ // maybe float for half/quarter step resolution? - int scan_power_mode, unsigned int flags) { DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%g, scan_step_type=%d, scan_lines=%d," - " scan_dummy=%d, feed_steps=%d, scan_power_mode=%d, flags=%x", + " scan_dummy=%d, feed_steps=%d, flags=%x", scan_exposure_time, scan_yres, scan_step_type, scan_lines, scan_dummy, - feed_steps, scan_power_mode, flags); + feed_steps, flags); unsigned int fast_exposure; int use_fast_fed = 0; - int dummy_power_mode; unsigned int fast_time; unsigned int slow_time; uint16_t slow_slope_table[256]; @@ -1166,8 +1162,7 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor dev->motor.base_ydpi / 4, 0, 0, - 0, - &dummy_power_mode); + 0); DBG(DBG_info, "%s : fast_exposure=%d pixels\n", __func__, fast_exposure); @@ -1195,8 +1190,7 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor scan_exposure_time, scan_yres, &slow_slope_steps, - NULL, - scan_power_mode); + NULL); sanei_genesys_create_slope_table3 ( dev, @@ -1206,8 +1200,7 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor 0, scan_yres, &back_slope_steps, - NULL, - scan_power_mode); + NULL); if (feed_steps < (slow_slope_steps >> scan_step_type)) { /*TODO: what should we do here?? go back to exposure calculation?*/ @@ -1233,8 +1226,7 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor fast_exposure, dev->motor.base_ydpi / 4, &fast_slope_steps, - &fast_exposure, - scan_power_mode); + &fast_exposure); /* fast fed special cases handling */ if (dev->model->gpo_type == GPO_XP300 @@ -1682,44 +1674,25 @@ gl841_get_led_exposure(Genesys_Device * dev, const Genesys_Sensor& sensor) } /** @brief compute exposure time - * Compute exposure time for the device and the given scan resolution, - * also compute scan_power_mode + * Compute exposure time for the device and the given scan resolution */ static int gl841_exposure_time(Genesys_Device *dev, const Genesys_Sensor& sensor, float slope_dpi, int scan_step_type, int start, - int used_pixels, - int *scan_power_mode) + int used_pixels) { int exposure_time = 0; -int exposure_time2 = 0; int led_exposure; - *scan_power_mode=0; led_exposure=gl841_get_led_exposure(dev, sensor); exposure_time = sanei_genesys_exposure_time2( dev, slope_dpi, scan_step_type, start+used_pixels,/*+tgtime? currently done in sanei_genesys_exposure_time2 with tgtime = 32 pixel*/ - led_exposure, - *scan_power_mode); - - while(*scan_power_mode + 1 < dev->motor.power_mode_count) { - exposure_time2 = sanei_genesys_exposure_time2( - dev, - slope_dpi, - scan_step_type, - start+used_pixels,/*+tgtime? currently done in sanei_genesys_exposure_time2 with tgtime = 32 pixel*/ - led_exposure, - *scan_power_mode + 1); - if (exposure_time < exposure_time2) - break; - exposure_time = exposure_time2; - (*scan_power_mode)++; - } + led_exposure); return exposure_time; } @@ -1784,7 +1757,6 @@ static void gl841_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens int move; unsigned int lincnt; int exposure_time; - int scan_power_mode; int i; int stagger; int avg; @@ -1945,8 +1917,7 @@ dummy \ scanned lines slope_dpi, scan_step_type, start, - used_pixels, - &scan_power_mode); + used_pixels); DBG(DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time); /*** optical parameters ***/ @@ -2002,7 +1973,7 @@ dummy \ scanned lines } else { gl841_init_motor_regs_scan(dev, sensor, reg, exposure_time, slope_dpi, scan_step_type, dev->model->is_cis ? lincnt * session.params.channels : lincnt, - dummy, move, scan_power_mode, + dummy, move, (session.params.flags & SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE) ? MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE : 0); } @@ -2088,7 +2059,6 @@ static void gl841_calculate_current_setup(Genesys_Device * dev, const Genesys_Se int used_pixels; unsigned int lincnt; int exposure_time; - int scan_power_mode; int i; int stagger; @@ -2241,8 +2211,7 @@ dummy \ scanned lines slope_dpi, scan_step_type, start, - used_pixels, - &scan_power_mode); + used_pixels); DBG(DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time); /* scanned area must be enlarged by max color shift needed */ diff --git a/backend/genesys_gl841.h b/backend/genesys_gl841.h index 3dbfc805a..e1f06924b 100644 --- a/backend/genesys_gl841.h +++ b/backend/genesys_gl841.h @@ -261,5 +261,4 @@ int gl841_exposure_time(Genesys_Device *dev, const Genesys_Sensor& sensor, float slope_dpi, int scan_step_type, int start, - int used_pixels, - int *scan_power_mode); + int used_pixels); diff --git a/backend/genesys_gl843.cc b/backend/genesys_gl843.cc index 730fcb8af..a3e457a24 100644 --- a/backend/genesys_gl843.cc +++ b/backend/genesys_gl843.cc @@ -836,13 +836,11 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev, unsigned int scan_lines, unsigned int scan_dummy, unsigned int feed_steps, - int scan_power_mode, unsigned int flags) { DBG_HELPER_ARGS(dbg, "exposure=%d, scan_yres=%g, scan_step_type=%d, scan_lines=%d, scan_dummy=%d, " - "feed_steps=%d, scan_power_mode=%d, flags=%x", - exposure, scan_yres, scan_step_type, scan_lines, scan_dummy, feed_steps, - scan_power_mode, flags); + "feed_steps=%d, flags=%x", + exposure, scan_yres, scan_step_type, scan_lines, scan_dummy, feed_steps, flags); int use_fast_fed, coeff; unsigned int lincnt; @@ -1313,7 +1311,6 @@ static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens int slope_dpi = 0; int dummy = 0; int scan_step_type = 1; - int scan_power_mode = 0; size_t requested_buffer_size, read_buffer_size; debug_dump(DBG_info, session.params); @@ -1405,7 +1402,7 @@ static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens : session.output_line_count; gl843_init_motor_regs_scan(dev, sensor, reg, exposure, slope_dpi, scan_step_type, - scan_lines, dummy, session.params.starty, scan_power_mode, mflags); + scan_lines, dummy, session.params.starty, mflags); /* since we don't have sheetfed scanners to handle, * use huge read buffer */ diff --git a/backend/genesys_gl846.cc b/backend/genesys_gl846.cc index 81cbb0b20..934ed8253 100644 --- a/backend/genesys_gl846.cc +++ b/backend/genesys_gl846.cc @@ -529,13 +529,12 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev, unsigned int scan_lines, unsigned int scan_dummy, unsigned int feed_steps, - int scan_power_mode, unsigned int flags) { DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%g, scan_step_type=%d, scan_lines=%d, " - "scan_dummy=%d, feed_steps=%d, scan_power_mode=%d, flags=%x", + "scan_dummy=%d, feed_steps=%d, flags=%x", scan_exposure_time, scan_yres, scan_step_type, scan_lines, scan_dummy, - feed_steps, scan_power_mode, flags); + feed_steps, flags); int use_fast_fed; unsigned int fast_dpi; uint16_t scan_table[SLOPE_TABLE_SIZE]; @@ -1030,7 +1029,6 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens int slope_dpi = 0; int dummy = 0; int scan_step_type = 1; - int scan_power_mode = 0; int max_shift; size_t requested_buffer_size, read_buffer_size; @@ -1150,7 +1148,7 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens gl846_init_motor_regs_scan(dev, sensor, reg, exposure_time, slope_dpi, scan_step_type, dev->model->is_cis ? lincnt * session.params.channels : lincnt, - dummy, move, scan_power_mode, mflags); + dummy, move, mflags); /*** prepares data reordering ***/ diff --git a/backend/genesys_gl847.cc b/backend/genesys_gl847.cc index 8407ddede..36f4c7820 100644 --- a/backend/genesys_gl847.cc +++ b/backend/genesys_gl847.cc @@ -564,13 +564,12 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev, unsigned int scan_lines, unsigned int scan_dummy, unsigned int feed_steps, - int scan_power_mode, unsigned int flags) { DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, can_yres=%g, scan_step_type=%d, scan_lines=%d, " - "scan_dummy=%d, feed_steps=%d, scan_power_mode=%d, flags=%x", + "scan_dummy=%d, feed_steps=%d, flags=%x", scan_exposure_time, scan_yres, scan_step_type, scan_lines, scan_dummy, - feed_steps, scan_power_mode, flags); + feed_steps, flags); int use_fast_fed; unsigned int fast_dpi; uint16_t scan_table[SLOPE_TABLE_SIZE]; @@ -1048,7 +1047,6 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens int slope_dpi = 0; int dummy = 0; int scan_step_type = 1; - int scan_power_mode = 0; int max_shift; size_t requested_buffer_size, read_buffer_size; @@ -1166,7 +1164,7 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens gl847_init_motor_regs_scan(dev, sensor, reg, exposure_time, slope_dpi, scan_step_type, dev->model->is_cis ? lincnt * session.params.channels : lincnt, - dummy, move, scan_power_mode, mflags); + dummy, move, mflags); /*** prepares data reordering ***/ diff --git a/backend/genesys_low.h b/backend/genesys_low.h index fa1a19b00..bcbd9da6c 100644 --- a/backend/genesys_low.h +++ b/backend/genesys_low.h @@ -487,10 +487,8 @@ extern void sanei_genesys_fe_read_data(Genesys_Device* dev, uint8_t addr, uint16 */ extern void sanei_genesys_fe_write_data(Genesys_Device* dev, uint8_t addr, uint16_t data); -extern SANE_Int -sanei_genesys_exposure_time2 (Genesys_Device * dev, - float ydpi, int step_type, int endpixel, - int led_exposure, int power_mode); +SANE_Int sanei_genesys_exposure_time2(Genesys_Device * dev, float ydpi, int step_type, + int endpixel, int led_exposure); extern SANE_Int sanei_genesys_exposure_time (Genesys_Device * dev, Genesys_Register_Set * reg, @@ -506,8 +504,7 @@ extern SANE_Int sanei_genesys_create_slope_table (Genesys_Device * dev, uint16_t * slope_table, int steps, int step_type, int exposure_time, - SANE_Bool same_speed, double yres, - int power_mode); + SANE_Bool same_speed, double yres); SANE_Int sanei_genesys_create_slope_table3 (Genesys_Device * dev, @@ -516,8 +513,7 @@ sanei_genesys_create_slope_table3 (Genesys_Device * dev, int step_type, int exposure_time, double yres, unsigned int *used_steps, - unsigned int *final_exposure, - int power_mode); + unsigned int *final_exposure); void sanei_genesys_create_default_gamma_table(Genesys_Device* dev, std::vector& gamma_table, float gamma); diff --git a/backend/genesys_motor.h b/backend/genesys_motor.h index 5aef7e758..77e3d55d3 100644 --- a/backend/genesys_motor.h +++ b/backend/genesys_motor.h @@ -85,16 +85,6 @@ struct Genesys_Motor_Slope struct Genesys_Motor { Genesys_Motor() = default; - Genesys_Motor(uint8_t p_motor_id, int p_base_ydpi, int p_optical_ydpi, int p_max_step_type, - int p_power_mode_count, - const std::vector>& p_slopes) : - motor_id(p_motor_id), - base_ydpi(p_base_ydpi), - optical_ydpi(p_optical_ydpi), - max_step_type(p_max_step_type), - power_mode_count(p_power_mode_count), - slopes(p_slopes) - {} // id of the motor description uint8_t motor_id = 0; @@ -104,10 +94,8 @@ struct Genesys_Motor int optical_ydpi = 0; // maximum step type. 0-2 int max_step_type = 0; - // number of power modes - int power_mode_count = 0; // slopes to derive individual slopes from - std::vector> slopes; + std::vector slopes; }; #endif // BACKEND_GENESYS_MOTOR_H