void showcalendar(struct timest *time) { char str[16]; u8 i, daypos = 0, line = 2, col =…
- User
void show_calendar(struct time_st *time) { char str[16]; u8 i, day_pos = 0, line = 2, col = 0; u8 days = get_month_days(time->year, time->month); u8 first_day = calculate_weekday(time->year, time->month,1);
OLED_ShowString(0, 1, (u8 *)"S M T W T F S", 8); for (i = 0; i < first_day; i++) { OLED_ShowString(col, line, (u8 *)" ", 8); col += 16; day_pos++; } for (i = 1; i <= days; i++) { if (i == time->day) { sprintf(str, "[%2d]", i); } else { sprintf(str, "%2d", i); } OLED_ShowString(col, line, (u8 *)str, 8); col += 16; day_pos++; if (day_pos % 7 == 0) { line++; col = 0; if (line > 6) break; } }} 将日期修改为 最上方为日历 下面是 Sun Mon Tue Wed Thur Fri Sat 1 2 3 4 5 6 7 8
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.