/*
 * @Author: mypx
 * @Date: 2025-10-15 14:22:42
 * @LastEditTime: 2025-10-24 15:07:15
 * @LastEditors: mypx mypx_coder@163.com
 * @Description: 
 */
#include "bsp_tec.h"
#include "et_log.h"
#include <rtthread.h>
#include <stdint.h>
#include <stdlib.h>

static int test_tec_cooling_open(int argc, char **argv)
{
    (void)argc;
    (void)argv;
    bsp_tec_cooling_open();
    return 0;
}
MSH_CMD_EXPORT_ALIAS(test_tec_cooling_open, cool_open, "open cooling");

static int test_tec_heating_open(int argc, char **argv)
{
    (void)argc;
    (void)argv;
    bsp_tec_heating_open();
    return 0;
}
MSH_CMD_EXPORT_ALIAS(test_tec_heating_open, heat_open, "open heating");


static int test_adjust_tec_cooling_duty_cycle(int argc, char **argv)
{
    uint32_t duty_cycle = 0;
    if (argc != 2)
    {
        rt_kprintf("Usage: tldc <duty_cycle>\n");
        return -1;
    }
    duty_cycle = atof(argv[1]);
    ET_DBG("duty_cycle:%.2f", duty_cycle);
    bsp_tec_cooling_adjust(duty_cycle);
    return 0;
}
MSH_CMD_EXPORT_ALIAS(test_adjust_tec_cooling_duty_cycle, tldc, "adjust cool level");

static int test_adjust_tec_heating_duty_cycle(int argc, char **argv)
{
    uint32_t duty_cycle = 0;
    if (argc != 2)
    {
        rt_kprintf("Usage: trdc <duty_cycle>\n");
        return -1;
    }
    duty_cycle = atof(argv[1]);
    ET_DBG("duty_cycle:%.2f", duty_cycle);
    bsp_tec_heating_adjust(duty_cycle);
    return 0;
}
MSH_CMD_EXPORT_ALIAS(test_adjust_tec_heating_duty_cycle, trdc, "adjust heat level");

static int test_fan_start(int argc, char **argv)
{
    (void)argc;
    (void)argv;
    bsp_fan_start();
    return 0;
}
MSH_CMD_EXPORT_ALIAS(test_fan_start, fan_start, "start fan");

static int test_fan_stop(int argc, char **argv)
{
    (void)argc;
    (void)argv;
    bsp_fan_stop();
    return 0;
}
MSH_CMD_EXPORT_ALIAS(test_fan_stop, fan_stop, "stop fan");
