Skip to content

Commit

Permalink
Merge pull request #17 from AEFeinstein/master
Browse files Browse the repository at this point in the history
update to master
  • Loading branch information
cnlohr authored Dec 16, 2020
2 parents f3f160d + 60b5ef8 commit 298078e
Show file tree
Hide file tree
Showing 51 changed files with 1,411 additions and 789 deletions.
Binary file added firmware/assets/angry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added firmware/assets/cross.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/flight-menu.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added firmware/assets/happy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/pd-1-fat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/pd-1-sick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/pd-1-thin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/pd-2-fat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/pd-2-thin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/pd-3-fat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/pd-3-sick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/pd-3-thin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/pd-4-fat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/pd-4-sick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified firmware/assets/pd-4-thin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added firmware/assets/pd-5-fat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added firmware/assets/pd-5-norm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added firmware/assets/pd-5-sick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added firmware/assets/pd-5-thin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added firmware/assets/sad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion firmware/emu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
endif

# All the compiler flags
CFLAGS := -g $(patsubst %, -I%, $(INCDIRS)) $(patsubst %, -D%, $(DEFINES)) -fshort-enums
CFLAGS := -g $(patsubst %, -I%, $(INCDIRS)) $(patsubst %, -D%, $(DEFINES))

# if you want to make a smaller executable
#CFLAGS += -Os -s -flto -ffunction-sections -fdata-sections -Wl,--gc-sections
Expand Down
212 changes: 195 additions & 17 deletions firmware/emu/swadgemu.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define _GNU_SOURCE /* for tm_gmtoff and tm_zone */
#include <time.h>
#include "rawdraw/CNFG.h"
#include "rawdraw/os_generic.h"
#include "swadgemu.h"
Expand Down Expand Up @@ -146,7 +148,7 @@ void emuHeader()
{
yS = 0;
}

for( y = 0; y < WS_HEIGHT; y++ )
{
for( x = 0; x < OLED_WIDTH / 2; x++ )
Expand Down Expand Up @@ -291,7 +293,8 @@ void emuCheckResize()
//[4..12] = LEDs
rawvidmem = swadgeshm_video_data + 16;
#else
rawvidmem = realloc( rawvidmem, px_scale * OLED_WIDTH * px_scale * (HEADER_PIXELS + OLED_HEIGHT + FOOTER_PIXELS) * px_scale * 4 );
rawvidmem = realloc( rawvidmem, px_scale * OLED_WIDTH * px_scale * (HEADER_PIXELS + OLED_HEIGHT + FOOTER_PIXELS) *
px_scale * 4 );
#endif
updateOLED( false );
}
Expand Down Expand Up @@ -439,7 +442,7 @@ int ets_strlen( const char* s )
{
return strlen( s );
}
char *ets_strcpy(char *dest, const char *src)
char* ets_strcpy(char* dest, const char* src)
{
return strcpy(dest, src);
}
Expand All @@ -455,7 +458,7 @@ char* ets_strcat(char* dest, const char* src)
{
return strcat(dest, src);
}
int ets_strncmp(const char *s1, const char *s2, int len)
int ets_strncmp(const char* s1, const char* s2, int len)
{
return strncmp(s1, s2, len);
}
Expand Down Expand Up @@ -1449,48 +1452,89 @@ void HandleDestroy()

bool wifi_get_macaddr(uint8 if_index, uint8* macaddr)
{
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
static bool warned = false;
if(!warned)
{
warned = true;
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
}
return true;
}

bool wifi_set_opmode_current(uint8 opmode)
{
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
static bool warned = false;
if(!warned)
{
warned = true;

fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
}
return true;
}

bool wifi_set_opmode(uint8 opmode )
{
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
static bool warned = false;
if(!warned)
{
warned = true;
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
}
return true;
}

bool wifi_station_set_config(struct station_config *config)
bool wifi_station_set_config(struct station_config* config)
{
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
static bool warned = false;
if(!warned)
{
warned = true;
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
}
return true;
}

bool wifi_station_connect(void)
{
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
static bool warned = false;
if(!warned)
{
warned = true;
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
}
return true;
}

void wifi_enable_signaling_measurement(void)
{
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
static bool warned = false;
if(!warned)
{
warned = true;
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
}
}

sint8 wifi_station_get_rssi(void)
{
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
static bool warned = false;
if(!warned)
{
warned = true;
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
}
return 0;
}

bool wifi_station_scan(struct scan_config *config, scan_done_cb_t cb)
bool wifi_station_scan(struct scan_config* config, scan_done_cb_t cb)
{
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
static bool warned = false;
if(!warned)
{
warned = true;
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
}
struct bss_info bss = {0};
bss.channel = 11;
bss.authmode = AUTH_OPEN;
Expand All @@ -1501,14 +1545,148 @@ bool wifi_station_scan(struct scan_config *config, scan_done_cb_t cb)
return true;
}

bool wifi_get_ip_info(uint8 if_index, struct ip_info *info)
bool wifi_get_ip_info(uint8 if_index, struct ip_info* info)
{
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
static bool warned = false;
if(!warned)
{
warned = true;
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
}
return true;
}

bool wifi_set_sleep_type(enum sleep_type type)
{
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
static bool warned = false;
if(!warned)
{
warned = true;
fprintf( stderr, "EMU Warning: %s not implemented\n", __func__);
}
return true;
}



/////////////////////////////////////////////////////////////////////////////////////////////////
// SNTP Stubs

/**
* get the seconds since Jan 01, 1970, 00:00 (GMT + 8)
*/
uint32 sntp_get_current_timestamp()
{
return time(NULL);
}

/**
* get real time (GTM + 8 time zone)
*/
char* sntp_get_real_time(long t)
{
/* Define temporary variables */
time_t current_time;
struct tm* local_time;

/* Retrieve the current time */
current_time = time(NULL);

/* Get the local time using the current time */
local_time = localtime(&current_time);

/* Return the local time */
return asctime(local_time);
}

/**
* SNTP get time_zone default GMT + 8
*/
sint8 sntp_get_timezone(void)
{
time_t t = time(NULL);
struct tm lt = {0};
localtime_r(&t, &lt);

return lt.tm_gmtoff;
}

/**
* SNTP set time_zone (default GMT + 8)
*/
bool sntp_set_timezone(sint8 timezone)
{
// Don't support time zones for emulation
return false;
}

/**
* Initialize this module.
* Send out request instantly or after SNTP_STARTUP_DELAY(_FUNC).
*/
void sntp_init(void)
{
// Do nothing, it's emulated
return;
}

/**
* Stop this module.
*/
void sntp_stop(void)
{
// Do nothing, it's emulated
return;
}

/**
* Initialize one of the NTP servers by IP address
*
* @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS
* @param dnsserver IP address of the NTP server to set
*/
void sntp_setserver(unsigned char idx, ip_addr_t* addr)
{
return;
}

/**
* Obtain one of the currently configured by IP address (or DHCP) NTP servers
*
* @param numdns the index of the NTP server
* @return IP address of the indexed NTP server or "ip_addr_any" if the NTP
* server has not been configured by address (or at all).
*/
ip_addr_t sntp_getserver(unsigned char idx)
{
static ip_addr_t dummy = {0};
return dummy;
}

/**
* Initialize one of the NTP servers by name
*
* @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS,now sdk support SNTP_MAX_SERVERS = 3
* @param dnsserver DNS name of the NTP server to set, to be resolved at contact time
*/
void sntp_setservername(unsigned char idx, char* server)
{
return;
}

/**
* Obtain one of the currently configured by name NTP servers.
*
* @param numdns the index of the NTP server
* @return IP address of the indexed NTP server or NULL if the NTP
* server has not been configured by name (or at all)
*/
char* sntp_getservername(unsigned char idx)
{
return NULL;
}

struct tm* sntp_localtime(const time_t* tim_p)
{
return localtime(tim_p);
}
68 changes: 68 additions & 0 deletions firmware/emu/sysincstubs/sntp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#ifndef __SNTP_H__
#define __SNTP_H__

#include "os_type.h"
#ifdef LWIP_OPEN_SRC
#include "lwip/ip_addr.h"
#else
#include "ip_addr.h"
#endif
/**
* get the seconds since Jan 01, 1970, 00:00 (GMT + 8)
*/
uint32 sntp_get_current_timestamp();
/**
* get real time (GTM + 8 time zone)
*/
char* sntp_get_real_time(long t);
/**
* SNTP get time_zone default GMT + 8
*/
sint8 sntp_get_timezone(void);
/**
* SNTP set time_zone (default GMT + 8)
*/
bool sntp_set_timezone(sint8 timezone);
/**
* Initialize this module.
* Send out request instantly or after SNTP_STARTUP_DELAY(_FUNC).
*/
void sntp_init(void);
/**
* Stop this module.
*/
void sntp_stop(void);
/**
* Initialize one of the NTP servers by IP address
*
* @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS
* @param dnsserver IP address of the NTP server to set
*/
void sntp_setserver(unsigned char idx, ip_addr_t *addr);
/**
* Obtain one of the currently configured by IP address (or DHCP) NTP servers
*
* @param numdns the index of the NTP server
* @return IP address of the indexed NTP server or "ip_addr_any" if the NTP
* server has not been configured by address (or at all).
*/
ip_addr_t sntp_getserver(unsigned char idx);
/**
* Initialize one of the NTP servers by name
*
* @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS,now sdk support SNTP_MAX_SERVERS = 3
* @param dnsserver DNS name of the NTP server to set, to be resolved at contact time
*/
void sntp_setservername(unsigned char idx, char *server);
/**
* Obtain one of the currently configured by name NTP servers.
*
* @param numdns the index of the NTP server
* @return IP address of the indexed NTP server or NULL if the NTP
* server has not been configured by name (or at all)
*/
char *sntp_getservername(unsigned char idx);

#define sntp_servermode_dhcp(x)

#endif
3 changes: 1 addition & 2 deletions firmware/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ CFLAGS = \
-B$(SDK)/lib \
-std=gnu99 \
-MD \
-O3 \
-fshort-enums
-O3
ifneq ($(ESP_GDB),)
CFLAGS += -ggdb
endif
Expand Down
Loading

0 comments on commit 298078e

Please sign in to comment.