Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move value and comma #18

Open
ksv-success opened this issue May 1, 2021 · 7 comments
Open

move value and comma #18

ksv-success opened this issue May 1, 2021 · 7 comments

Comments

@ksv-success
Copy link

how to move the sign and comma by 1 indicator to the right to get 04.1 volts

@ksv-success
Copy link
Author

it makes no sense, display the second value after the decimal point

@ksv-success
Copy link
Author

IMG_20210501_213509
ADC 8 bit

@ksv-success
Copy link
Author

this value should be rounded and show not 4.07 but 04.1

@ksv-success
Copy link
Author

ksv-success commented May 2, 2021

Разобрался ! и настрои получилось так
Understood! and the mood turned out like this

/* 0.0 - 9.9 */
value = roundf(value * 10.0);
set_display_from_int(
(uint16_t)(value),
pos,
SEVEN_SEG_DP_MIDDLE,
SEVEN_SEG_DIGITS_ALL | SEVEN_SEG_DIGITS_LEFTMOST

@ksv-success
Copy link
Author

enum display_set_align
{
DISPLAY_ALIGN_LEFT = 0,
DISPLAY_ALIGN_RIGHT = 1,
};
это работает если в обоих з вариантах 0 или в первом 0 во втором 1 или в обоих 1 или в первом 1 во втором 0 ну то есть все изменения ничего не меняют
it works if in both variants 0 or in the first 0 in the second 1 or in both 1 or in the first 1 in the second 0 well, that is, all changes do not change anything
this only works if
DISPLAY_ALIGN_LEFT = 0,
DISPLAY_ALIGN_RIGHT = 0,
или
or
DISPLAY_ALIGN_LEFT = 0,
DISPLAY_ALIGN_RIGHT = 1,
тоже самое ничего не меняется
the same nothing changes
DISPLAY_ALIGN_LEFT = 1,
DISPLAY_ALIGN_RIGHT = 0,
так же
same
DISPLAY_ALIGN_LEFT = 1,
DISPLAY_ALIGN_RIGHT = 1,

@ksv-success
Copy link
Author

все хороши немного подправил код заработало приемлемо ! до изменения завышало показания
everything is all right, let's fix the code a little, everything worked! higher value before changing by 1-2 volts

image
image
image

@ksv-success
Copy link
Author

    else if (value >= 10.0)
    {
        /* 10.0 - 99.9 */
        value = roundf(value * 9.56);
        set_display_from_int(
            (uint16_t)(value),
            pos,
            SEVEN_SEG_DP_MIDDLE,
            SEVEN_SEG_DIGITS_ALL
        );
    }
    else
    {
        /* 0.0 - 9.9 */
        value = roundf(value * 10.0);
        set_display_from_int(
            (uint16_t)(value),
            pos,
            SEVEN_SEG_DP_MIDDLE,
            SEVEN_SEG_DIGITS_ALL | SEVEN_SEG_DIGITS_LEFTMOST
        );
    }
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant