#ifndef __WEIGHT_INIT_H
#define __WEIGHT_INIT_H

#include "weight_read.h"

#define YEAR                                                  \
    ((((__DATE__[7] - '0') * 10 + (__DATE__[8] - '0')) * 10 + \
      (__DATE__[9] - '0')) *                                  \
         10 +                                                 \
     (__DATE__[10] - '0'))
#define MONTH                                            \
    (__DATE__[2] == 'n'   ? (__DATE__[1] == 'a' ? 1 : 6) \
     : __DATE__[2] == 'b' ? 2                            \
     : __DATE__[2] == 'r' ? (__DATE__[0] == 'M' ? 3 : 4) \
     : __DATE__[2] == 'y' ? 5                            \
     : __DATE__[2] == 'l' ? 7                            \
     : __DATE__[2] == 'g' ? 8                            \
     : __DATE__[2] == 'p' ? 9                            \
     : __DATE__[2] == 't' ? 10                           \
     : __DATE__[2] == 'v' ? 11                           \
                          : 12)
#define DAY \
    ((__DATE__[4] == ' ' ? 0 : __DATE__[4] - '0') * 10 + (__DATE__[5] - '0'))
#define DATE_AS_INT ((YEAR - 2000) * 10000 + (MONTH) * 100 + (DAY))
#define SOFT_VER DATE_AS_INT
#define HARD_VER (uint8_t)1

#define HARDVER 0x0001

#define COMP_ADDR 0xDE
#define MODULE_ID 0x0 // 预留u32
#define BOOT_FLAG 0x1234abcd
#define NOEXIST_UPGRADE_FLAG 0xabcd1234
#define UNUPGRADE 0x00000000

#define MIN_K 1.0f
#define MAX_K 160.0f

#define WS_ID 0xDE

void Write_Upgrade_Flag(void);

void MY_WEIGHT_INIT(void);

#endif
