RaspberrPi project source code
guowenxue
3 days ago cd8f10f9dce7fe181d7ae211a7718174d7a841d0
update thingsboard log print level
2 files modified
66 ■■■■ changed files
project/modules/leds.c 64 ●●●● patch | view | raw | blame | history
project/thingsboard/thingsboard.c 2 ●●● patch | view | raw | blame | history
project/modules/leds.c
@@ -64,31 +64,31 @@
        return -2;
    }
    for(i=0; i<ctx->count; i++)
    {
        if( which == i )
        {
            led = &ctx->leds[i];
    for(i=0; i<ctx->count; i++)
    {
        if( which == i )
        {
            led = &ctx->leds[i];
            led->line = gpiod_chip_get_line(ctx->chip, led->gpio);
            if( !led->line )
            {
                log_error("open gpioline for %s[%d] failed\n", led->name, led->gpio);
                rv = -3;
                goto failed;
            }
            led->line = gpiod_chip_get_line(ctx->chip, led->gpio);
            if( !led->line )
            {
                log_error("open gpioline for %s[%d] failed\n", led->name, led->gpio);
                rv = -3;
                goto failed;
            }
            rv  = gpiod_line_request_output(led->line, led->name, !led->active);
            if( rv )
            {
                log_error("request gpio output for %5s[%d] failed: %s\n", led->name, led->gpio, strerror(errno));
                rv = -4;
                goto failed;
            }
            rv  = gpiod_line_request_output(led->line, led->name, !led->active);
            if( rv )
            {
                log_error("request gpio output for %5s[%d] failed: %s\n", led->name, led->gpio, strerror(errno));
                rv = -4;
                goto failed;
            }
            log_debug("request %5s led[%d] for gpio output okay\n", led->name, led->gpio);
        }
    }
            log_debug("request %5s led[%d] for gpio output okay\n", led->name, led->gpio);
        }
    }
    return 0;
@@ -102,7 +102,7 @@
    int            i;
    led_info_t    *led;
    log_warn("terminate RGB Led gpios\n");
    log_debug("terminate RGB Led gpios\n");
    if( !ctx )
    {
@@ -114,15 +114,15 @@
        return 0;
    for(i=0; i<ctx->count; i++)
    {
        if( which == i )
        {
            led = &ctx->leds[i];
    {
        if( which == i )
        {
            led = &ctx->leds[i];
            if( led->line )
                gpiod_line_release(led->line);
        }
    }
            if( led->line )
                gpiod_line_release(led->line);
        }
    }
    gpiod_chip_close(ctx->chip);
    return 0;
@@ -148,6 +148,8 @@
    led = &ctx.leds[which];
    log_info("turn Led %s %s\n", led->name, cmd?"on":"off");
    if( OFF == cmd )
    {
        gpiod_line_set_value(led->line, !led->active);
project/thingsboard/thingsboard.c
@@ -346,7 +346,7 @@
        return ;
    }
    log_debug("Subscriber receive message: '%s'\n", message->payload);
    log_info("Subscriber receive message: '%s'\n", message->payload);
    root = cJSON_Parse(message->payload);
    if( !root )