genesys: Simplify motor setup to make it easier to expand

merge-requests/121/head
Povilas Kanapickas 2019-08-04 12:01:48 +03:00
rodzic 7d6897ecb4
commit 239eab6ea6
4 zmienionych plików z 700 dodań i 395 usunięć

Wyświetl plik

@ -255,7 +255,8 @@ std::vector<std::reference_wrapper<Genesys_Sensor>>
void
sanei_genesys_init_structs (Genesys_Device * dev)
{
unsigned int i, gpo_ok = 0, motor_ok = 0;
unsigned int i, gpo_ok = 0;
bool motor_ok = false;
bool fe_ok = false;
/* initialize the GPO data stuff */
@ -268,14 +269,13 @@ sanei_genesys_init_structs (Genesys_Device * dev)
}
}
/* initialize the motor data stuff */
for (i = 0; i < sizeof (Motor) / sizeof (Genesys_Motor); i++)
{
if (dev->model->motor_type == Motor[i].motor_id)
{
dev->motor = Motor[i];
motor_ok = 1;
}
// initialize the motor data stuff
for (const auto& motor : *s_motors) {
if (dev->model->motor_type == motor.motor_id) {
dev->motor = motor;
motor_ok = true;
break;
}
}
for (const auto& frontend : *s_frontends) {
@ -286,8 +286,7 @@ sanei_genesys_init_structs (Genesys_Device * dev)
}
}
/* sanity check */
if (motor_ok == 0 || gpo_ok == 0 || !fe_ok)
if (!motor_ok || gpo_ok == 0 || !fe_ok)
{
DBG(DBG_error0, "%s: bad description(s) for fe/gpo/motor=%d/%d/%d\n", __func__,
dev->model->ccd_type, dev->model->gpo_type, dev->model->motor_type);
@ -5426,6 +5425,7 @@ sane_init_impl(SANE_Int * version_code, SANE_Auth_Callback authorize)
s_sane_devices_ptrs.init();
genesys_init_sensor_tables();
genesys_init_frontend_tables();
genesys_init_motor_tables();
genesys_init_usb_device_tables();

Plik diff jest za duży Load Diff

Wyświetl plik

@ -684,6 +684,7 @@ private:
extern StaticInit<std::vector<Genesys_Sensor>> s_sensors;
void genesys_init_sensor_tables();
void genesys_init_frontend_tables();
void genesys_init_motor_tables();
void genesys_init_usb_device_tables();
void debug_dump(unsigned level, const Genesys_Settings& settings);

Wyświetl plik

@ -71,6 +71,14 @@ struct Genesys_Motor_Slope
i = 0.0 for first entry and i = 1.0 for last entry in default table
*/
float g = 0;
/* start speed, max end speed, step number */
/* maximum speed (second field) is used to compute exposure as seen by motor */
/* exposure=max speed/ slope dpi * base dpi */
/* 5144 = max pixels at 600 dpi */
/* 1288=(5144+8)*ydpi(=300)/base_dpi(=1200) , where 5152 is exposure */
/* 6440=9660/(1932/1288) */
// { 9560, 1912, 31, 0.8 },
};
@ -100,7 +108,6 @@ struct Genesys_Motor
int power_mode_count = 0;
// slopes to derive individual slopes from
std::vector<std::vector<Genesys_Motor_Slope>> slopes;
};
};
#endif // BACKEND_GENESYS_MOTOR_H