line ending
|
Before Width: | Height: | Size: 775 B After Width: | Height: | Size: 774 B |
|
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 927 B |
|
Before Width: | Height: | Size: 821 B After Width: | Height: | Size: 820 B |
|
Before Width: | Height: | Size: 978 B After Width: | Height: | Size: 977 B |
|
Before Width: | Height: | Size: 857 B After Width: | Height: | Size: 856 B |
|
Before Width: | Height: | Size: 1003 B After Width: | Height: | Size: 1002 B |
|
Before Width: | Height: | Size: 850 B After Width: | Height: | Size: 849 B |
|
Before Width: | Height: | Size: 1003 B After Width: | Height: | Size: 1002 B |
|
Before Width: | Height: | Size: 736 B After Width: | Height: | Size: 735 B |
|
Before Width: | Height: | Size: 891 B After Width: | Height: | Size: 890 B |
|
Before Width: | Height: | Size: 736 B After Width: | Height: | Size: 735 B |
|
Before Width: | Height: | Size: 884 B After Width: | Height: | Size: 883 B |
|
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 682 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 801 B After Width: | Height: | Size: 800 B |
|
Before Width: | Height: | Size: 862 B After Width: | Height: | Size: 861 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 858 B After Width: | Height: | Size: 857 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 289 B |
@@ -1,200 +1,200 @@
|
|||||||
#include "Watchy_Pokemon.h"
|
#include "Watchy_Pokemon.h"
|
||||||
|
|
||||||
const unsigned char *pokemon_back[151] = {back_1, back_2, back_3, back_4, back_5, back_6, back_7, back_8, back_9, back_10, back_11, back_12, back_13, back_14, back_15, back_16, back_17, back_18, back_19, back_20, back_21, back_22, back_23, back_24, back_25, back_26, back_27, back_28, back_29, back_30, back_31, back_32, back_33, back_34, back_35, back_36, back_37, back_38, back_39, back_40, back_41, back_42, back_43, back_44, back_45, back_46, back_47, back_48, back_49, back_50, back_51, back_52, back_53, back_54, back_55, back_56, back_57, back_58, back_59, back_60, back_61, back_62, back_63, back_64, back_65, back_66, back_67, back_68, back_69, back_70, back_71, back_72, back_73, back_74, back_75, back_76, back_77, back_78, back_79, back_80, back_81, back_82, back_83, back_84, back_85, back_86, back_87, back_88, back_89, back_90, back_91, back_92, back_93, back_94, back_95, back_96, back_97, back_98, back_99, back_100, back_101, back_102, back_103, back_104, back_105, back_106, back_107, back_108, back_109, back_110, back_111, back_112, back_113, back_114, back_115, back_116, back_117, back_118, back_119, back_120, back_121, back_122, back_123, back_124, back_125, back_126, back_127, back_128, back_129, back_130, back_131, back_132, back_133, back_134, back_135, back_136, back_137, back_138, back_139, back_140, back_141, back_142, back_143, back_144, back_145, back_146, back_147, back_148, back_149, back_150, back_151};
|
const unsigned char *pokemon_back[151] = {back_1, back_2, back_3, back_4, back_5, back_6, back_7, back_8, back_9, back_10, back_11, back_12, back_13, back_14, back_15, back_16, back_17, back_18, back_19, back_20, back_21, back_22, back_23, back_24, back_25, back_26, back_27, back_28, back_29, back_30, back_31, back_32, back_33, back_34, back_35, back_36, back_37, back_38, back_39, back_40, back_41, back_42, back_43, back_44, back_45, back_46, back_47, back_48, back_49, back_50, back_51, back_52, back_53, back_54, back_55, back_56, back_57, back_58, back_59, back_60, back_61, back_62, back_63, back_64, back_65, back_66, back_67, back_68, back_69, back_70, back_71, back_72, back_73, back_74, back_75, back_76, back_77, back_78, back_79, back_80, back_81, back_82, back_83, back_84, back_85, back_86, back_87, back_88, back_89, back_90, back_91, back_92, back_93, back_94, back_95, back_96, back_97, back_98, back_99, back_100, back_101, back_102, back_103, back_104, back_105, back_106, back_107, back_108, back_109, back_110, back_111, back_112, back_113, back_114, back_115, back_116, back_117, back_118, back_119, back_120, back_121, back_122, back_123, back_124, back_125, back_126, back_127, back_128, back_129, back_130, back_131, back_132, back_133, back_134, back_135, back_136, back_137, back_138, back_139, back_140, back_141, back_142, back_143, back_144, back_145, back_146, back_147, back_148, back_149, back_150, back_151};
|
||||||
const unsigned char *pokemon_front[151] = {front_1, front_2, front_3, front_4, front_5, front_6, front_7, front_8, front_9, front_10, front_11, front_12, front_13, front_14, front_15, front_16, front_17, front_18, front_19, front_20, front_21, front_22, front_23, front_24, front_25, front_26, front_27, front_28, front_29, front_30, front_31, front_32, front_33, front_34, front_35, front_36, front_37, front_38, front_39, front_40, front_41, front_42, front_43, front_44, front_45, front_46, front_47, front_48, front_49, front_50, front_51, front_52, front_53, front_54, front_55, front_56, front_57, front_58, front_59, front_60, front_61, front_62, front_63, front_64, front_65, front_66, front_67, front_68, front_69, front_70, front_71, front_72, front_73, front_74, front_75, front_76, front_77, front_78, front_79, front_80, front_81, front_82, front_83, front_84, front_85, front_86, front_87, front_88, front_89, front_90, front_91, front_92, front_93, front_94, front_95, front_96, front_97, front_98, front_99, front_100, front_101, front_102, front_103, front_104, front_105, front_106, front_107, front_108, front_109, front_110, front_111, front_112, front_113, front_114, front_115, front_116, front_117, front_118, front_119, front_120, front_121, front_122, front_123, front_124, front_125, front_126, front_127, front_128, front_129, front_130, front_131, front_132, front_133, front_134, front_135, front_136, front_137, front_138, front_139, front_140, front_141, front_142, front_143, front_144, front_145, front_146, front_147, front_148, front_149, front_150, front_151};
|
const unsigned char *pokemon_front[151] = {front_1, front_2, front_3, front_4, front_5, front_6, front_7, front_8, front_9, front_10, front_11, front_12, front_13, front_14, front_15, front_16, front_17, front_18, front_19, front_20, front_21, front_22, front_23, front_24, front_25, front_26, front_27, front_28, front_29, front_30, front_31, front_32, front_33, front_34, front_35, front_36, front_37, front_38, front_39, front_40, front_41, front_42, front_43, front_44, front_45, front_46, front_47, front_48, front_49, front_50, front_51, front_52, front_53, front_54, front_55, front_56, front_57, front_58, front_59, front_60, front_61, front_62, front_63, front_64, front_65, front_66, front_67, front_68, front_69, front_70, front_71, front_72, front_73, front_74, front_75, front_76, front_77, front_78, front_79, front_80, front_81, front_82, front_83, front_84, front_85, front_86, front_87, front_88, front_89, front_90, front_91, front_92, front_93, front_94, front_95, front_96, front_97, front_98, front_99, front_100, front_101, front_102, front_103, front_104, front_105, front_106, front_107, front_108, front_109, front_110, front_111, front_112, front_113, front_114, front_115, front_116, front_117, front_118, front_119, front_120, front_121, front_122, front_123, front_124, front_125, front_126, front_127, front_128, front_129, front_130, front_131, front_132, front_133, front_134, front_135, front_136, front_137, front_138, front_139, front_140, front_141, front_142, front_143, front_144, front_145, front_146, front_147, front_148, front_149, front_150, front_151};
|
||||||
const unsigned char *bar[2] = {bar_0, bar_1};
|
const unsigned char *bar[2] = {bar_0, bar_1};
|
||||||
|
|
||||||
#ifdef FR
|
#ifdef FR
|
||||||
const char *pokemon_names[151] = {"BULBIZARRE","HERBIZARRE","FLORIZARRE","SALAMECHE","REPTINCEL","DRACAUFEU","CARAPUCE","CARABAFFE","TORTANK","CHENIPAN","CHRYSACIER","PAPILUSION","ASPICOT","COCONFORT","DARDARGNAN","ROUCOOL","ROUCOUPS","ROUCARNAGE","RATTATA","RATTATAC","PIAFABEC","RAPASDEPIC","ABO","ARBOK","PIKACHU","RAICHU","SABELETTE","SABLAIREAU","NIDORAN","NIDORINA","NIDOQUEEN","NIDORAN","NIDORINO","NIDOKING","MELOFEE","MELODELFE","GOUPIX","FEUNARD","RONDOUDOU","GRODOUDOU","NOSFERAPTI","NOSFERALTO","MYSTHERBE","ORTIDE","RAFFLESIA","PARAS","PARASECT","MIMITOSS","AEROMITE","TAUPIQUEUR","TRIOPIKEUR","MIAOUSS","PERSIAN","PSYKOKWAK","AKWAKWAK","FEROSINGE","COLOSSINGE","CANINOS","ARCANIN","PTITARD","TETARTE","TARTARD","ABRA","KADABRA","ALAKAZAM","MACHOC","MACHOPEUR","MACKOGNEUR","CHETIFLOR","BOUSTIFLOR","EMPIFLOR","TENTACOOL","TENTACRUEL","RACAILLOU","GRAVALANCH","GROLEM","PONYTA","GALOPA","RAMOLOSS","FLAGADOSS","MAGNETI","MAGNETON","CANARTICHO","DODUO","DODRIO","OTARIA","LAMANTINE","TADMORV","GROTADMORV","KOKIYAS","CRUSTABRI","FANTOMINUS","SPECTRUM","ECTOPLASMA","ONIX","SOPORIFIK","HYPNOMADE","KRABBY","KRABBOSS","VOLTORBE","ELECTRODE","NOEUNOEUF","NOADKOKO","OSSELAIT","OSSATUEUR","KICKLEE","TYGNON","EXCELANGUE","SMOGO","SMOGOGO","RHINOCORNE","RHINOFEROS","LEVEINARD","SAQUEDENEU","KANGOUREX","HYPOTREMPE","HYPOCEAN","POISSIRENE","POISSOROY","STARI","STAROSS","M. MIME","INSECATEUR","LIPPOUTOU","ELEKTEK","MAGMAR","SCARABRUTE","TAUROS","MAGICARPE","LEVIATOR","LOKHLASS","METAMORPH","EVOLI","AQUALI","VOLTALI","PYROLI","PORYGON","AMONITA","AMONISTAR","KABUTO","KABUTOPS","PTERA","RONFLEX","ARTIKODIN","ELECTHOR","SULFURA","MINIDRACO","DRACO","DRACOLOSSE","MEWTWO","MEW"};
|
const char *pokemon_names[151] = {"BULBIZARRE","HERBIZARRE","FLORIZARRE","SALAMECHE","REPTINCEL","DRACAUFEU","CARAPUCE","CARABAFFE","TORTANK","CHENIPAN","CHRYSACIER","PAPILUSION","ASPICOT","COCONFORT","DARDARGNAN","ROUCOOL","ROUCOUPS","ROUCARNAGE","RATTATA","RATTATAC","PIAFABEC","RAPASDEPIC","ABO","ARBOK","PIKACHU","RAICHU","SABELETTE","SABLAIREAU","NIDORAN","NIDORINA","NIDOQUEEN","NIDORAN","NIDORINO","NIDOKING","MELOFEE","MELODELFE","GOUPIX","FEUNARD","RONDOUDOU","GRODOUDOU","NOSFERAPTI","NOSFERALTO","MYSTHERBE","ORTIDE","RAFFLESIA","PARAS","PARASECT","MIMITOSS","AEROMITE","TAUPIQUEUR","TRIOPIKEUR","MIAOUSS","PERSIAN","PSYKOKWAK","AKWAKWAK","FEROSINGE","COLOSSINGE","CANINOS","ARCANIN","PTITARD","TETARTE","TARTARD","ABRA","KADABRA","ALAKAZAM","MACHOC","MACHOPEUR","MACKOGNEUR","CHETIFLOR","BOUSTIFLOR","EMPIFLOR","TENTACOOL","TENTACRUEL","RACAILLOU","GRAVALANCH","GROLEM","PONYTA","GALOPA","RAMOLOSS","FLAGADOSS","MAGNETI","MAGNETON","CANARTICHO","DODUO","DODRIO","OTARIA","LAMANTINE","TADMORV","GROTADMORV","KOKIYAS","CRUSTABRI","FANTOMINUS","SPECTRUM","ECTOPLASMA","ONIX","SOPORIFIK","HYPNOMADE","KRABBY","KRABBOSS","VOLTORBE","ELECTRODE","NOEUNOEUF","NOADKOKO","OSSELAIT","OSSATUEUR","KICKLEE","TYGNON","EXCELANGUE","SMOGO","SMOGOGO","RHINOCORNE","RHINOFEROS","LEVEINARD","SAQUEDENEU","KANGOUREX","HYPOTREMPE","HYPOCEAN","POISSIRENE","POISSOROY","STARI","STAROSS","M. MIME","INSECATEUR","LIPPOUTOU","ELEKTEK","MAGMAR","SCARABRUTE","TAUROS","MAGICARPE","LEVIATOR","LOKHLASS","METAMORPH","EVOLI","AQUALI","VOLTALI","PYROLI","PORYGON","AMONITA","AMONISTAR","KABUTO","KABUTOPS","PTERA","RONFLEX","ARTIKODIN","ELECTHOR","SULFURA","MINIDRACO","DRACO","DRACOLOSSE","MEWTWO","MEW"};
|
||||||
#else
|
#else
|
||||||
const char *pokemon_names[151] = {"BULBASAUR","IVYSAUR","VENUSAUR","CHARMANDER","CHARMELEON","CHARIZARD","SQUIRTLE","WARTORTLE","BLASTOISE","CATERPIE","METAPOD","BUTTERFREE","WEEDLE","KAKUNA","BEEDRILL","PIDGEY","PIDGEOTTO","PIDGEOT","RATTATA","RATICATE","SPEAROW","FEAROW","EKANS","ARBOK","PIKACHU","RAICHU","SANDSHREW","SANDSLASH","NIDORAN","NIDORINA","NIDOQUEEN","NIDORAN","NIDORINO","NIDOKING","CLEFAIRY","CLEFABLE","VULPIX","NINETALES","JIGGLYPUFF","WIGGLYTUFF","ZUBAT","GOLBAT","ODDISH","GLOOM","VILEPLUME","PARAS","PARASECT","VENONAT","VENOMOTH","DIGLETT","DUGTRIO","MEOWTH","PERSIAN","PSYDUCK","GOLDUCK","MANKEY","PRIMEAPE","GROWLITHE","ARCANINE","POLIWAG","POLIWHIRL","POLIWRATH","ABRA","KADABRA","ALAKAZAM","MACHOP","MACHOKE","MACHAMP","BELLSPROUT","WEEPINBELL","VICTREEBEL","TENTACOOL","TENTACRUEL","GEODUDE","GRAVELER","GOLEM","PONYTA","RAPIDASH","SLOWPOKE","SLOWBRO","MAGNEMITE","MAGNETON","FARFETCH'D","DODUO","DODRIO","SEEL","DEWGONG","GRIMER","MUK","SHELLDER","CLOYSTER","GASTLY","HAUNTER","GENGAR","ONIX","DROWZEE","HYPNO","KRABBY","KINGLER","VOLTORB","ELECTRODE","EXEGGCUTE","EXEGGUTOR","CUBONE","MAROWAK","HITMONLEE","HITMONCHAN","LICKITUNG","KOFFING","WEEZING","RHYHORN","RHYDON","CHANSEY","TANGELA","KANGASKHAN","HORSEA","SEADRA","GOLDEEN","SEAKING","STARYU","STARMIE","MR. MIME","SCYTHER","JYNX","ELECTABUZZ","MAGMAR","PINSIR","TAUROS","MAGIKARP","GYARADOS","LAPRAS","DITTO","EEVEE","VAPOREON","JOLTEON","FLAREON","PORYGON","OMANYTE","OMASTAR","KABUTO","KABUTOPS","AERODACTYL","SNORLAX","ARTICUNO","ZAPDOS","MOLTRES","DRATINI","DRAGONAIR","DRAGONITE","MEWTWO","MEW"};
|
const char *pokemon_names[151] = {"BULBASAUR","IVYSAUR","VENUSAUR","CHARMANDER","CHARMELEON","CHARIZARD","SQUIRTLE","WARTORTLE","BLASTOISE","CATERPIE","METAPOD","BUTTERFREE","WEEDLE","KAKUNA","BEEDRILL","PIDGEY","PIDGEOTTO","PIDGEOT","RATTATA","RATICATE","SPEAROW","FEAROW","EKANS","ARBOK","PIKACHU","RAICHU","SANDSHREW","SANDSLASH","NIDORAN","NIDORINA","NIDOQUEEN","NIDORAN","NIDORINO","NIDOKING","CLEFAIRY","CLEFABLE","VULPIX","NINETALES","JIGGLYPUFF","WIGGLYTUFF","ZUBAT","GOLBAT","ODDISH","GLOOM","VILEPLUME","PARAS","PARASECT","VENONAT","VENOMOTH","DIGLETT","DUGTRIO","MEOWTH","PERSIAN","PSYDUCK","GOLDUCK","MANKEY","PRIMEAPE","GROWLITHE","ARCANINE","POLIWAG","POLIWHIRL","POLIWRATH","ABRA","KADABRA","ALAKAZAM","MACHOP","MACHOKE","MACHAMP","BELLSPROUT","WEEPINBELL","VICTREEBEL","TENTACOOL","TENTACRUEL","GEODUDE","GRAVELER","GOLEM","PONYTA","RAPIDASH","SLOWPOKE","SLOWBRO","MAGNEMITE","MAGNETON","FARFETCH'D","DODUO","DODRIO","SEEL","DEWGONG","GRIMER","MUK","SHELLDER","CLOYSTER","GASTLY","HAUNTER","GENGAR","ONIX","DROWZEE","HYPNO","KRABBY","KINGLER","VOLTORB","ELECTRODE","EXEGGCUTE","EXEGGUTOR","CUBONE","MAROWAK","HITMONLEE","HITMONCHAN","LICKITUNG","KOFFING","WEEZING","RHYHORN","RHYDON","CHANSEY","TANGELA","KANGASKHAN","HORSEA","SEADRA","GOLDEEN","SEAKING","STARYU","STARMIE","MR. MIME","SCYTHER","JYNX","ELECTABUZZ","MAGMAR","PINSIR","TAUROS","MAGIKARP","GYARADOS","LAPRAS","DITTO","EEVEE","VAPOREON","JOLTEON","FLAREON","PORYGON","OMANYTE","OMASTAR","KABUTO","KABUTOPS","AERODACTYL","SNORLAX","ARTICUNO","ZAPDOS","MOLTRES","DRATINI","DRAGONAIR","DRAGONITE","MEWTWO","MEW"};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SPRITE_W 72
|
#define SPRITE_W 72
|
||||||
|
|
||||||
#define PKM1_UI_W 96
|
#define PKM1_UI_W 96
|
||||||
#define PKM1_UI_H 16
|
#define PKM1_UI_H 16
|
||||||
#define PKM1_UI_X 14
|
#define PKM1_UI_X 14
|
||||||
#define PKM1_UI_Y 31
|
#define PKM1_UI_Y 31
|
||||||
#define PKM1_X 120
|
#define PKM1_X 120
|
||||||
#define PKM1_Y 6
|
#define PKM1_Y 6
|
||||||
|
|
||||||
#define PKM2_UI_W 96
|
#define PKM2_UI_W 96
|
||||||
#define PKM2_UI_H 26
|
#define PKM2_UI_H 26
|
||||||
#define PKM2_UI_X 90
|
#define PKM2_UI_X 90
|
||||||
#define PKM2_UI_Y 103
|
#define PKM2_UI_Y 103
|
||||||
#define PKM2_X 8
|
#define PKM2_X 8
|
||||||
#define PKM2_Y 62
|
#define PKM2_Y 62
|
||||||
|
|
||||||
#define PKM3_UI_W 200
|
#define PKM3_UI_W 200
|
||||||
#define PKM3_UI_H 58
|
#define PKM3_UI_H 58
|
||||||
#define PKM3_UI_X 1
|
#define PKM3_UI_X 1
|
||||||
#define PKM3_UI_Y 137
|
#define PKM3_UI_Y 137
|
||||||
|
|
||||||
#ifdef FR
|
#ifdef FR
|
||||||
#define LVL_TXT ":N"
|
#define LVL_TXT ":N"
|
||||||
#else
|
#else
|
||||||
#define LVL_TXT ":L"
|
#define LVL_TXT ":L"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MIN_VBAT 3.7
|
#define MIN_VBAT 3.7
|
||||||
#define MAX_VBAT 4.1
|
#define MAX_VBAT 4.1
|
||||||
#define INV_VBAT_DIF 2.5
|
#define INV_VBAT_DIF 2.5
|
||||||
|
|
||||||
|
|
||||||
void WatchyPokemon::drawWatchFace(){
|
void WatchyPokemon::drawWatchFace(){
|
||||||
|
|
||||||
#ifndef SIM
|
#ifndef SIM
|
||||||
readWorldTime();
|
readWorldTime();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Steps
|
//Steps
|
||||||
if (currentTime.Hour == 0 && currentTime.Minute == 1)
|
if (currentTime.Hour == 0 && currentTime.Minute == 1)
|
||||||
{
|
{
|
||||||
sensor.resetStepCounter();
|
sensor.resetStepCounter();
|
||||||
}
|
}
|
||||||
uint32_t stepCount = int(sensor.getCounter() * .01);
|
uint32_t stepCount = int(sensor.getCounter() * .01);
|
||||||
|
|
||||||
//Voltage
|
//Voltage
|
||||||
float VBAT = getBatteryVoltage();
|
float VBAT = getBatteryVoltage();
|
||||||
uint32_t bat_level = VBAT < MIN_VBAT ? 0 : (int)(100 * INV_VBAT_DIF * (VBAT - MIN_VBAT));
|
uint32_t bat_level = VBAT < MIN_VBAT ? 0 : (int)(100 * INV_VBAT_DIF * (VBAT - MIN_VBAT));
|
||||||
|
|
||||||
//Save battery life
|
//Save battery life
|
||||||
#ifndef SIM
|
#ifndef SIM
|
||||||
WiFi.mode(WIFI_OFF);
|
WiFi.mode(WIFI_OFF);
|
||||||
btStop();
|
btStop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// BG
|
// BG
|
||||||
display.fillScreen(GxEPD_WHITE);
|
display.fillScreen(GxEPD_WHITE);
|
||||||
|
|
||||||
display.setFont(&FreeMonoBold7pt7b);
|
display.setFont(&FreeMonoBold7pt7b);
|
||||||
display.setTextColor(GxEPD_BLACK);
|
display.setTextColor(GxEPD_BLACK);
|
||||||
|
|
||||||
int pkm1_id = int(randomHour(0) * 151);
|
int pkm1_id = int(randomHour(0) * 151);
|
||||||
bool pkm1_shiny = int(randomHour(8231) * 4096) == 0;
|
bool pkm1_shiny = int(randomHour(8231) * 4096) == 0;
|
||||||
int pkm2_id = int(randomDay(0) * 151);
|
int pkm2_id = int(randomDay(0) * 151);
|
||||||
bool pkm2_shiny = int(randomDay(3872) * 4096) == 0;
|
bool pkm2_shiny = int(randomDay(3872) * 4096) == 0;
|
||||||
|
|
||||||
// PKM
|
// PKM
|
||||||
display.drawBitmap(PKM2_X, PKM2_Y, pokemon_back[pkm2_id], SPRITE_W, SPRITE_W, GxEPD_BLACK);
|
display.drawBitmap(PKM2_X, PKM2_Y, pokemon_back[pkm2_id], SPRITE_W, SPRITE_W, GxEPD_BLACK);
|
||||||
display.drawBitmap(PKM2_UI_X, PKM2_UI_Y, pokemon_2, PKM2_UI_W, PKM2_UI_H, GxEPD_BLACK);
|
display.drawBitmap(PKM2_UI_X, PKM2_UI_Y, pokemon_2, PKM2_UI_W, PKM2_UI_H, GxEPD_BLACK);
|
||||||
|
|
||||||
display.setCursor(PKM2_UI_X + 10, PKM2_UI_Y - 11);
|
display.setCursor(PKM2_UI_X + 10, PKM2_UI_Y - 11);
|
||||||
display.print(pokemon_names[pkm2_id]);
|
display.print(pokemon_names[pkm2_id]);
|
||||||
if (pkm2_shiny) {
|
if (pkm2_shiny) {
|
||||||
display.print('*');
|
display.print('*');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
display.setCursor(PKM2_UI_X + 40, PKM2_UI_Y - 1);
|
display.setCursor(PKM2_UI_X + 40, PKM2_UI_Y - 1);
|
||||||
display.print(LVL_TXT);
|
display.print(LVL_TXT);
|
||||||
display.print(bat_level);
|
display.print(bat_level);
|
||||||
|
|
||||||
// TODO change "color" of bar
|
// TODO change "color" of bar
|
||||||
|
|
||||||
for (int8_t i = 0; i < int(60 - (currentTime.Hour * 60 + currentTime.Minute) / 24); i++)
|
for (int8_t i = 0; i < int(60 - (currentTime.Hour * 60 + currentTime.Minute) / 24); i++)
|
||||||
{
|
{
|
||||||
display.drawBitmap(PKM2_UI_X + 30 + i, PKM2_UI_Y + 3, bar[i % 2], 8, 4, GxEPD_BLACK);
|
display.drawBitmap(PKM2_UI_X + 30 + i, PKM2_UI_Y + 3, bar[i % 2], 8, 4, GxEPD_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DATE = PV
|
// DATE = PV
|
||||||
display.setCursor(PKM2_UI_X + 40, PKM2_UI_Y + 19);
|
display.setCursor(PKM2_UI_X + 40, PKM2_UI_Y + 19);
|
||||||
if(currentTime.Day < 10){
|
if(currentTime.Day < 10){
|
||||||
display.print(' ');
|
display.print(' ');
|
||||||
}
|
}
|
||||||
display.print(currentTime.Day);
|
display.print(currentTime.Day);
|
||||||
display.print("/ ");
|
display.print("/ ");
|
||||||
if(currentTime.Month < 10){
|
if(currentTime.Month < 10){
|
||||||
display.print(' ');
|
display.print(' ');
|
||||||
}
|
}
|
||||||
display.print(currentTime.Month);
|
display.print(currentTime.Month);
|
||||||
|
|
||||||
// ENEMY
|
// ENEMY
|
||||||
display.drawBitmap(PKM1_X, PKM1_Y, pokemon_front[pkm1_id] , SPRITE_W, SPRITE_W, GxEPD_BLACK);
|
display.drawBitmap(PKM1_X, PKM1_Y, pokemon_front[pkm1_id] , SPRITE_W, SPRITE_W, GxEPD_BLACK);
|
||||||
display.drawBitmap(PKM1_UI_X, PKM1_UI_Y, pokemon_1, PKM1_UI_W, PKM1_UI_H, GxEPD_BLACK);
|
display.drawBitmap(PKM1_UI_X, PKM1_UI_Y, pokemon_1, PKM1_UI_W, PKM1_UI_H, GxEPD_BLACK);
|
||||||
|
|
||||||
display.setCursor(PKM1_UI_X + 6, PKM1_UI_Y - 11);
|
display.setCursor(PKM1_UI_X + 6, PKM1_UI_Y - 11);
|
||||||
display.print(pokemon_names[pkm1_id]);
|
display.print(pokemon_names[pkm1_id]);
|
||||||
if (pkm1_shiny) {
|
if (pkm1_shiny) {
|
||||||
display.print('*');
|
display.print('*');
|
||||||
}
|
}
|
||||||
|
|
||||||
display.setCursor(PKM1_UI_X + 36, PKM1_UI_Y - 1);
|
display.setCursor(PKM1_UI_X + 36, PKM1_UI_Y - 1);
|
||||||
display.print(LVL_TXT);
|
display.print(LVL_TXT);
|
||||||
display.print(stepCount);
|
display.print(stepCount);
|
||||||
|
|
||||||
for (int8_t i = 0; i < (60 - currentTime.Minute); i++)
|
for (int8_t i = 0; i < (60 - currentTime.Minute); i++)
|
||||||
{
|
{
|
||||||
display.drawBitmap(PKM1_UI_X + 26 + i, PKM1_UI_Y + 3, bar[i % 2], 8, 4, GxEPD_BLACK);
|
display.drawBitmap(PKM1_UI_X + 26 + i, PKM1_UI_Y + 3, bar[i % 2], 8, 4, GxEPD_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// BOTTOM
|
// BOTTOM
|
||||||
display.drawBitmap(PKM3_UI_X, PKM3_UI_Y, pokemon_3, PKM3_UI_W, PKM3_UI_H, GxEPD_BLACK);
|
display.drawBitmap(PKM3_UI_X, PKM3_UI_Y, pokemon_3, PKM3_UI_W, PKM3_UI_H, GxEPD_BLACK);
|
||||||
|
|
||||||
// HOUR
|
// HOUR
|
||||||
display.setFont(&FreeMonoBold10pt7b);
|
display.setFont(&FreeMonoBold10pt7b);
|
||||||
display.setCursor(PKM3_UI_X + 13, PKM3_UI_Y + 34);
|
display.setCursor(PKM3_UI_X + 13, PKM3_UI_Y + 34);
|
||||||
if(currentTime.Hour < 10){
|
if(currentTime.Hour < 10){
|
||||||
display.print('0');
|
display.print('0');
|
||||||
}
|
}
|
||||||
display.print(currentTime.Hour);
|
display.print(currentTime.Hour);
|
||||||
display.print(':');
|
display.print(':');
|
||||||
if(currentTime.Minute < 10){
|
if(currentTime.Minute < 10){
|
||||||
display.print('0');
|
display.print('0');
|
||||||
}
|
}
|
||||||
display.print(currentTime.Minute);
|
display.print(currentTime.Minute);
|
||||||
|
|
||||||
// CURSOR
|
// CURSOR
|
||||||
int pos = int(randomMinute(0) * 4);
|
int pos = int(randomMinute(0) * 4);
|
||||||
int posX = pos % 2;
|
int posX = pos % 2;
|
||||||
int posY = int(pos / 2);
|
int posY = int(pos / 2);
|
||||||
#ifdef FR
|
#ifdef FR
|
||||||
display.drawBitmap(PKM3_UI_X + 85 + posX * 59, PKM3_UI_Y + 16 + posY * 20, cursor, 8, 9, GxEPD_BLACK);
|
display.drawBitmap(PKM3_UI_X + 85 + posX * 59, PKM3_UI_Y + 16 + posY * 20, cursor, 8, 9, GxEPD_BLACK);
|
||||||
#else
|
#else
|
||||||
display.drawBitmap(PKM3_UI_X + 89 + posX * 61, PKM3_UI_Y + 16 + posY * 20, cursor, 8, 9, GxEPD_BLACK);
|
display.drawBitmap(PKM3_UI_X + 89 + posX * 61, PKM3_UI_Y + 16 + posY * 20, cursor, 8, 9, GxEPD_BLACK);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
double WatchyPokemon::randomMinute(uint32_t d)
|
double WatchyPokemon::randomMinute(uint32_t d)
|
||||||
{
|
{
|
||||||
uint32_t seed = currentTime.Year;
|
uint32_t seed = currentTime.Year;
|
||||||
seed = seed * 12 + currentTime.Month;
|
seed = seed * 12 + currentTime.Month;
|
||||||
seed = seed * 31 + currentTime.Day;
|
seed = seed * 31 + currentTime.Day;
|
||||||
seed = seed * 24 + currentTime.Hour;
|
seed = seed * 24 + currentTime.Hour;
|
||||||
seed = seed * 60 + currentTime.Minute;
|
seed = seed * 60 + currentTime.Minute;
|
||||||
seed += d;
|
seed += d;
|
||||||
|
|
||||||
|
|
||||||
double v = pow(seed, 6.0 / 7.0);
|
double v = pow(seed, 6.0 / 7.0);
|
||||||
v *= sin(v) + 1;
|
v *= sin(v) + 1;
|
||||||
|
|
||||||
return v - floor(v);
|
return v - floor(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
double WatchyPokemon::randomHour(uint32_t d)
|
double WatchyPokemon::randomHour(uint32_t d)
|
||||||
{
|
{
|
||||||
uint32_t seed = currentTime.Year;
|
uint32_t seed = currentTime.Year;
|
||||||
seed = seed * 12 + currentTime.Month;
|
seed = seed * 12 + currentTime.Month;
|
||||||
seed = seed * 31 + currentTime.Day;
|
seed = seed * 31 + currentTime.Day;
|
||||||
seed = seed * 24 + currentTime.Hour;
|
seed = seed * 24 + currentTime.Hour;
|
||||||
seed += d;
|
seed += d;
|
||||||
|
|
||||||
double v = pow(seed, 6.0 / 7.0);
|
double v = pow(seed, 6.0 / 7.0);
|
||||||
v *= sin(v) + 1;
|
v *= sin(v) + 1;
|
||||||
|
|
||||||
return v - floor(v);
|
return v - floor(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
double WatchyPokemon::randomDay(uint32_t d)
|
double WatchyPokemon::randomDay(uint32_t d)
|
||||||
{
|
{
|
||||||
uint32_t seed = currentTime.Year;
|
uint32_t seed = currentTime.Year;
|
||||||
seed = seed * 12 + currentTime.Month;
|
seed = seed * 12 + currentTime.Month;
|
||||||
seed = seed * 31 + currentTime.Day;
|
seed = seed * 31 + currentTime.Day;
|
||||||
seed += d;
|
seed += d;
|
||||||
|
|
||||||
double v = pow(seed, 6.0 / 7.0);
|
double v = pow(seed, 6.0 / 7.0);
|
||||||
v *= sin(v) + 1;
|
v *= sin(v) + 1;
|
||||||
|
|
||||||
return v - floor(v);
|
return v - floor(v);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,39 @@
|
|||||||
#ifndef WATCHY_POKEMON_H
|
#ifndef WATCHY_POKEMON_H
|
||||||
#define WATCHY_POKEMON_H
|
#define WATCHY_POKEMON_H
|
||||||
|
|
||||||
#define SIM
|
#define SIM
|
||||||
//#define FR
|
//#define FR
|
||||||
|
|
||||||
#ifdef SIM
|
#ifdef SIM
|
||||||
#include "..\..\Watchy.h"
|
#include "..\..\Watchy.h"
|
||||||
#else
|
#else
|
||||||
#include <Watchy.h>
|
#include <Watchy.h>
|
||||||
#include "wta.h"
|
#include "wta.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "FreeMonoBold10pt7b.h"
|
#include "FreeMonoBold10pt7b.h"
|
||||||
#include "FreeMonoBold7pt7b.h"
|
#include "FreeMonoBold7pt7b.h"
|
||||||
|
|
||||||
#ifdef FR
|
#ifdef FR
|
||||||
#include "pokemon_fr.h"
|
#include "pokemon_fr.h"
|
||||||
#else
|
#else
|
||||||
#include "pokemon.h"
|
#include "pokemon.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SIM
|
#ifdef SIM
|
||||||
class WatchyPokemon : public Watchy
|
class WatchyPokemon : public Watchy
|
||||||
#else
|
#else
|
||||||
class WatchyPokemon : public WatchySynced
|
class WatchyPokemon : public WatchySynced
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef SIM
|
#ifndef SIM
|
||||||
using WatchySynced::WatchySynced;
|
using WatchySynced::WatchySynced;
|
||||||
#endif
|
#endif
|
||||||
public:
|
public:
|
||||||
void drawWatchFace();
|
void drawWatchFace();
|
||||||
double randomDay(uint32_t d);
|
double randomDay(uint32_t d);
|
||||||
double randomHour(uint32_t d);
|
double randomHour(uint32_t d);
|
||||||
double randomMinute(uint32_t d);
|
double randomMinute(uint32_t d);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#include "Watchy_Pokemon.h"
|
#include "Watchy_Pokemon.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
WatchyPokemon watchy(settings);
|
WatchyPokemon watchy(settings);
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
watchy.init();
|
watchy.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop(){}
|
void loop(){}
|
||||||
|
|||||||
@@ -1,42 +1,42 @@
|
|||||||
#include "wta.h"
|
#include "wta.h"
|
||||||
|
|
||||||
RTC_DATA_ATTR int worldTimeIntervalCounter = 0;
|
RTC_DATA_ATTR int worldTimeIntervalCounter = 0;
|
||||||
|
|
||||||
void WatchySynced::readWorldTime()
|
void WatchySynced::readWorldTime()
|
||||||
{
|
{
|
||||||
if (worldTimeIntervalCounter == 0)
|
if (worldTimeIntervalCounter == 0)
|
||||||
{
|
{
|
||||||
worldTimeIntervalCounter = WTA_UPDATE_SHORT_INTERVAL;
|
worldTimeIntervalCounter = WTA_UPDATE_SHORT_INTERVAL;
|
||||||
if (connectWiFi())
|
if (connectWiFi())
|
||||||
{
|
{
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
http.setConnectTimeout(WTA_UPDATE_TIMEOUT);
|
http.setConnectTimeout(WTA_UPDATE_TIMEOUT);
|
||||||
String queryURL = String(WTA_URL) + String(WTA_TIMEZONE);
|
String queryURL = String(WTA_URL) + String(WTA_TIMEZONE);
|
||||||
http.begin(queryURL.c_str());
|
http.begin(queryURL.c_str());
|
||||||
int httpResponseCode = http.GET();
|
int httpResponseCode = http.GET();
|
||||||
if (httpResponseCode == 200)
|
if (httpResponseCode == 200)
|
||||||
{
|
{
|
||||||
String payload = http.getString();
|
String payload = http.getString();
|
||||||
JSONVar responseObject = JSON.parse(payload);
|
JSONVar responseObject = JSON.parse(payload);
|
||||||
tmElements_t tm;
|
tmElements_t tm;
|
||||||
String datetime = String((const char *)responseObject["datetime"]);
|
String datetime = String((const char *)responseObject["datetime"]);
|
||||||
tm.Year = y2kYearToTm(datetime.substring(0, 4).toInt());
|
tm.Year = y2kYearToTm(datetime.substring(0, 4).toInt());
|
||||||
tm.Month = datetime.substring(5, 7).toInt();
|
tm.Month = datetime.substring(5, 7).toInt();
|
||||||
tm.Day = datetime.substring(8, 10).toInt();
|
tm.Day = datetime.substring(8, 10).toInt();
|
||||||
tm.Hour = datetime.substring(11, 13).toInt();
|
tm.Hour = datetime.substring(11, 13).toInt();
|
||||||
tm.Minute = datetime.substring(14, 16).toInt();
|
tm.Minute = datetime.substring(14, 16).toInt();
|
||||||
tm.Second = 0;
|
tm.Second = 0;
|
||||||
RTC.set(tm);
|
RTC.set(tm);
|
||||||
RTC.read(currentTime);
|
RTC.read(currentTime);
|
||||||
worldTimeIntervalCounter = WTA_UPDATE_LONG_INTERVAL;
|
worldTimeIntervalCounter = WTA_UPDATE_LONG_INTERVAL;
|
||||||
}
|
}
|
||||||
http.end();
|
http.end();
|
||||||
WiFi.mode(WIFI_OFF);
|
WiFi.mode(WIFI_OFF);
|
||||||
btStop();
|
btStop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
worldTimeIntervalCounter = worldTimeIntervalCounter < 0 ? 0 : worldTimeIntervalCounter - 1;
|
worldTimeIntervalCounter = worldTimeIntervalCounter < 0 ? 0 : worldTimeIntervalCounter - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |