error: 'return' with no value, in function returning non-void [-Werror] Corne keyboard Compile problem

188 Views Asked by At

I have a Corne keyboard and I'm trying to create the .hex file. The problem is when I try to compile (-km gotham), it throws this:

'return' with no value, in function returning non-void [-Werror]

and this

note: declared here
bool oled_task_user(void) {

This the part of the code:

bool oled_task_user(void) {
    if (timer_elapsed(oled_timer) > 10000) {
        oled_off();
        return;
    }
    #ifndef SPLIT_KEYBOARD
    else {
        oled_on();
    }
    #endif

    if (is_keyboard_master()) {
        render_status_main();
    } else {
        render_status_secondary();
    }
    return false;
}
1

There are 1 best solutions below

3
Pascal Getreuer On

Updated 2023-06-16:

The signature for this function appears to have been updated with a clearer enum-based return value. It is now (code link):

oled_rotation_t oled_init_user(oled_rotation_t rotation);

where oled_rotation_t indicates the desired rotation of the display, one of:

typedef enum {
    OLED_ROTATION_0   = 0,
    OLED_ROTATION_90  = 1,
    OLED_ROTATION_180 = 2,
    OLED_ROTATION_270 = 3, // OLED_ROTATION_90 | OLED_ROTATION_180
} oled_rotation_t;

Update your QMK set up (instructions) to get the latest.


Original answer:

The fourth line is a return with no value:

bool oled_task_user(void) {
    if (timer_elapsed(oled_timer) > 10000) {
        oled_off();
        return;  // <--- Here.
    }

Replace that line with return false; to fix the error.