Good progress, Erdem!
I think some stress testing of v-usb will be useful. Something like that: connect v-usb to a hub with a flash stick. Check if v-usb can communicate concurrently with playing high bit-rate video.
I've made some changes to LExxA956 firmware. Be warned that it is not applicable on other models, but may help anyway.
Backlight is the main parameter which have to be adjusted. I used VDH_SetEnergySave() call to set backlight but
the problem was that only 10 levels were available. Too rough steps for smooth and invisible adjusting.
I compensated steps by changes to brightness and contrast. Backlight changes were still visible although not annoying.
Code: Select all
long backlight, contrast, brightness;
int br_from_profile= 45; // brightness value from profile
int cn_from_profile= 75; // contrast value from profile
int bl_step_compensation_by_br= 4; // lower brightness by this value to compensate +1 step in backlight
int bl_step_compensation_by_cn= 4; // lower contrast by this value to compensate +1 step in backlight
float br_slope= 0.0f; // change brightness with fl value
float cn_slope= 1.5f; // change contrast with fl value
void AmbiLightOld(unsigned light)
{
int blChanged;
float fcn, fbr, fl;
fl= ApproxByTable(delayPhotoRC, light);
// fl is ambient light level converted to more or less linear value in range 0.0, 10.0
blChanged= fabs(fl - backlight) > 0.7f;
if (blChanged) {
// backlight lazy follows fl value
backlight= lroundf(fl);
}
if (backlight > 10) backlight= 10;
if (backlight < 0) backlight= 0;
//TODO: read profile values
fbr= br_from_profile + (fl - backlight) * bl_step_compensation_by_br + (fl - 5.f) * br_slope;
fcn= cn_from_profile + (fl - backlight) * bl_step_compensation_by_cn + (fl - 5.f) * cn_slope;
if (fabs(fbr - brightness) > 0.8f) {
brightness= lroundf(fbr);
VDH_SetBrightness(brightness, 0);
}
if (fabs(fcn - contrast) > 0.8f) {
contrast= lroundf(fcn);
VDH_SetContrast(contrast, 0);
}
if (blChanged) {
VDH_SetEnergySave(3, backlight);
}
printf("Ambient light %u (%f) %ld %ld %ld\n", light, fl, backlight, brightness, contrast);
}
Today I dug into disassembly of VDH_SetEnergySave() and found that 10 steps are imposed by firmware
in underlying DevLDSetEnergySaving(). So if almost the lowest level is used, much smoother backlight control
is posible: 128 steps. The problem is that DevLDSetEnergySaving() is used only for LED local dimming models (A956, A756)
so the following will not work on A856:
Code: Select all
float bl_slope= -20.f;
float bl_intercept= 245.f;
void AmbiLight(unsigned light)
{
float fl;
int blChanged;
if (light==0) light= 1;
fl= logf(light) * bl_slope + bl_intercept;
if (fl > 127.99f) {
fl= 127.99f;
}
if (fabs(fl - backlight) > 9.f) {
backlight= fl; // fast change, skip direct to value
blChanged= 1;
} else if (fl - backlight > 0.9f) {
backlight++; // increment lazily and smoothly
blChanged= 1;
} else if (fl - backlight < -0.9f) {
backlight--; // decrement lazily and smoothly
blChanged= 1;
}
if (blChanged) {
LockLocalDimming();
LocalDimmingIICWrite(0x30, backlight);
UnlockLocalDimming();
}
printf("Ambient light %u (%f) %ld\n", light, fl, backlight);
}
Procedure AmbiLight is called every second with a parameter sent from sensor. It is measured as time of RC charge, where R is a photoresistor.
I get ~100 at full sun, more than 50000 at darkness.
I also noticed a special setting for automatic backlight control in DevLDSetEnergySaving(). So there is probably an analogue input for auto-backlight
somewhere on mainboard but no sensor is connected to it. Argggh!
I continue testing.