1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-18 05:45:31 +03:00

Merge pull request #1213 from marbalon/master

Lock MAX7456 updates during font update
This commit is contained in:
borisbstyle 2016-09-24 13:50:55 +02:00 committed by GitHub
commit bec109d366

View file

@ -70,6 +70,7 @@ static uint8_t video_signal_cfg = 0;
static uint8_t video_signal_reg = VIDEO_MODE_PAL | OSD_ENABLE; //PAL by default static uint8_t video_signal_reg = VIDEO_MODE_PAL | OSD_ENABLE; //PAL by default
static uint8_t max7456_lock = 0; static uint8_t max7456_lock = 0;
static IO_t max7456CsPin = IO_NONE; static IO_t max7456CsPin = IO_NONE;
static bool fontIsLoading = false;
static uint8_t max7456_send(uint8_t add, uint8_t data) static uint8_t max7456_send(uint8_t add, uint8_t data)
{ {
@ -311,7 +312,7 @@ void max7456_draw_screen(void) {
static uint16_t pos = 0; static uint16_t pos = 0;
int k = 0, buff_len=0; int k = 0, buff_len=0;
if (!max7456_lock) { if (!max7456_lock && !fontIsLoading) {
//-----------------detect MAX7456 fail, or initialize it at startup when it is ready-------- //-----------------detect MAX7456 fail, or initialize it at startup when it is ready--------
max7456_lock = 1; max7456_lock = 1;
ENABLE_MAX7456; ENABLE_MAX7456;
@ -396,6 +397,7 @@ void max7456_write_nvm(uint8_t char_address, uint8_t *font_data) {
ENABLE_MAX7456; ENABLE_MAX7456;
// disable display // disable display
fontIsLoading = true;
max7456_send(VM0_REG, 0); max7456_send(VM0_REG, 0);
max7456_send(MAX7456ADD_CMAH, char_address); // set start address high max7456_send(MAX7456ADD_CMAH, char_address); // set start address high