guowenxue
2019-07-31 fa05fe6bfd8ceab1082249fd7b41fb3a0e6693cd
mqttd/main.c
@@ -109,17 +109,14 @@
        return -2;
    }
    if( ctx.hwconf.enable  )
    if( hal_init(&ctx.hwconf) < 0 )
    {
        if( hal_init(&ctx.hwconf) < 0 )
            log_err("Initialise hardware failure\n");
        else
            log_nrml("HAL initialise ok\n");
        return -1;
        log_err("Initialise hardware failure\n");
        return -3;
    }
    else
    else
    {
        log_nrml("HAL initialise ok\n");
    }
    install_proc_signal();
@@ -362,7 +359,7 @@
            value = cJSON_Print(item);
            /* light controled by relay */
            if( hwconf->relay && !strcasecmp(item->string, "light") )
            if( hwconf->relay_pin && !strcasecmp(item->string, "light") )
            {
                if( strcasestr(value, "on") )
                {
@@ -377,15 +374,11 @@
            }
            /* buzzer */
            if( hwconf->beep && !strcasecmp(item->string, "buzzer") )
            if( hwconf->beep_pin && !strcasecmp(item->string, "buzzer") )
            {
                if( strcasestr(value, "on") )
                {
                    log_nrml("Turn buzzer on\n");
                }
                else if( strcasestr(value, "music") )
                {
                    log_nrml("Turn buzzer play music\n");
                    log_nrml("Turn buzzer on [%d] times\n", hwconf->beep_times);
                }
            }