Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mykle1 committed Aug 18, 2017
1 parent b9956c7 commit 6e25b3d
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 35 deletions.
38 changes: 26 additions & 12 deletions MMM-MARS.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,65 @@
* Pick your color, copy and paste the HEX number. Example - #62FF00 = bright green.
*/

.MMM-MARS .header {
color: #FFFFFF; /* Color the title text. Default is white. */
text-align: center; /* Align the title text. (left, center, right) */
}

.MMM-MARS .photo {
width: 300px; /* Maximum width of image */
padding: 0px; /* Nudge image */
float: left; /* Align the picture. (left, center, right) */
width: 100%; /* adjust size of picture */
height: 200px;
margin-left: 0px; /* Precisely align picture with these */
margin-right: 0px;
margin-top: 0px;
margin-bottom: 0px;
float: left;
}

.MMM-MARS .picDate {
color: #FFFFFF; /* Color the title text. Default is white. */
text-align: left; /* Align the title text. (left, center, right) */
text-align: center; /* Align the title text. (left, center, right) */
/* display: none; */ /* Uncomment if you don't want title text */
}

.MMM-MARS .solDate {
color: #FFFFFF; /* Color the title text. Default is white. */
text-align: center; /* Align the title text. (left, center, right) */
/* display: none; */ /* Uncomment if you don't want title text */
}

.MMM-MARS .camera {
color: #FFFFFF; /* Color the information. Default is white. */
text-align: left; /* Align the information. (left, center, right) */
text-align: center; /* Align the information. (left, center, right) */
/* display: none; */ /* Uncomment if you don't want descriptive information */
}

.MMM-MARS .rover {
color: #FFFFFF; /* Color the information. Default is white. */
text-align: left; /* Align the information. (left, center, right) */
.MMM-MARS .roverName {
color: #62FF00; /* Color the information. Default is white. */
text-align: center; /* Align the information. (left, center, right) */
/* display: none; */ /* Uncomment if you don't want descriptive information */
}

.MMM-MARS .launch {
color: #FFFFFF; /* Color the information. Default is white. */
text-align: left; /* Align the information. (left, center, right) */
text-align: center; /* Align the information. (left, center, right) */
/* display: none; */ /* Uncomment if you don't want descriptive information */
}

.MMM-MARS .landed {
color: #FFFFFF; /* Color the information. Default is white. */
text-align: left; /* Align the information. (left, center, right) */
text-align: center; /* Align the information. (left, center, right) */
/* display: none; */ /* Uncomment if you don't want descriptive information */
}

.MMM-MARS .missionStatus {
color: #FFFFFF; /* Color the information. Default is white. */
text-align: left; /* Align the information. (left, center, right) */
text-align: center; /* Align the information. (left, center, right) */
/* display: none; */ /* Uncomment if you don't want descriptive information */
}

.MMM-MARS .totalPhotos {
color: #FFFFFF; /* Color the information. Default is white. */
text-align: left; /* Align the information. (left, center, right) */
text-align: center; /* Align the information. (left, center, right) */
/* display: none; */ /* Uncomment if you don't want descriptive information */
}
47 changes: 25 additions & 22 deletions MMM-MARS.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
*/
Module.register("MMM-MARS", {

// Module config defaults.
// Module config defaults. // Make all changes in your config.js file
defaults: {
useHeader: true, // False if you don't want a header
rover: "curiosity", // which rover? curiosity, opportunity, spirit
sol: "200", // sol date you want pictures from
useHeader: true, // false if you don't want a header
header: "", // Change in config file. useHeader must be true
maxWidth: "300px",
animationSpeed: 3000, // fade speed
Expand All @@ -29,7 +31,7 @@ Module.register("MMM-MARS", {
requiresVersion: "2.1.0",

// Set locale.
this.url = "https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?sol=1&api_key=DEMO_KEY";
this.url = "https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?sol=200&api_key=DEMO_KEY";
this.MARS = [];
this.activeItem = 0;
this.rotateInterval = null;
Expand Down Expand Up @@ -65,7 +67,11 @@ Module.register("MMM-MARS", {
}
var MARS = this.MARS[MARSKeys[this.activeItem]];

console.log(MARS);
// console.log(MARS); // for checking

// config options
var rover = this.config.rover
var sol = this.config.sol

var top = document.createElement("div");
top.classList.add("list-row");
Expand All @@ -80,59 +86,56 @@ Module.register("MMM-MARS", {

// earth picDate
var picDate = document.createElement("div");
picDate.classList.add("small", "bright", "picDate");
picDate.classList.add("xsmall", "bright", "picDate");
picDate.innerHTML = "Earth Date " + MARS.earth_date;
wrapper.appendChild(picDate);


// mars sol date
var solDate = document.createElement("div");
solDate.classList.add("small", "bright", "solDate");
solDate.classList.add("xsmall", "bright", "solDate");
solDate.innerHTML = "Mars Sol Date " + MARS.sol;
wrapper.appendChild(solDate);


// rover name
var roverName = document.createElement("div");
roverName.classList.add("small", "bright", "roverName");
roverName.innerHTML = "Rover " + MARS.rover.name;
wrapper.appendChild(roverName);


// camera
var camera = document.createElement("div");
camera.classList.add("small", "bright", "camera");
camera.classList.add("xsmall", "bright", "camera");
camera.innerHTML = MARS.camera.full_name;
wrapper.appendChild(camera);



// rover name
var rover = document.createElement("div");
rover.classList.add("small", "bright", "rover");
rover.innerHTML = "Rover " + MARS.rover.name;
wrapper.appendChild(rover);


// launch from earth date
var launch = document.createElement("div");
launch.classList.add("small", "bright", "launch");
launch.classList.add("xsmall", "bright", "launch");
launch.innerHTML = "Launched from Earth " + MARS.rover.launch_date;
wrapper.appendChild(launch);




// landed on mars date
var landed = document.createElement("div");
landed.classList.add("small", "bright", "landed");
landed.classList.add("xsmall", "bright", "landed");
landed.innerHTML = "Landed on Mars " + MARS.rover.landing_date;
wrapper.appendChild(landed);


// missionStatus and length
var missionStatus = document.createElement("div");
missionStatus.classList.add("small", "bright", "missionStatus");
missionStatus.classList.add("xsmall", "bright", "missionStatus");
missionStatus.innerHTML = "Mission Status is " + MARS.rover.status + " , " + MARS.rover.max_sol + " sols";
wrapper.appendChild(missionStatus);


// total photos taken
var totalPhotos = document.createElement("div");
totalPhotos.classList.add("small", "bright", "totalPhotos");
totalPhotos.classList.add("xsmall", "bright", "totalPhotos");
totalPhotos.innerHTML = MARS.rover.total_photos + " photos taken to date";
wrapper.appendChild(totalPhotos);

Expand All @@ -143,7 +146,7 @@ Module.register("MMM-MARS", {

processMARS: function(data) {
this.today = data.Today;
this.MARS = data; // Object containing an array that contains objects
this.MARS = data;
this.loaded = true;
},

Expand Down
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## MMM-MARS

Mars Exploration Rover missions.

## Here's what you get

Rover's Opportunity, Spirit and Curiosity each have a full array of specialized cameras.
Each has taken hundreds of thousands of stunning images right from the surface of Mars.
You can choose which rover you want and the sol date that the pictures were taken.
The module will do the rest, giving you information with each image.

## Examples

![](pix/1.JPG) ![](pix/2.JPG)

## Installation

* `git clone https://github.com/mykle1/MMM-MARS` into the `~/MagicMirror/modules` directory.

* No API key needed if you stay within the API's call limit. (It's already set)

* Annotated .css file included for sizing and coloring, text or no text.

## Config.js entry and options

{
module: 'MMM-MARS',
position: 'top_left',
config: {
rover: "curiosity", // which rover? curiosity, opportunity or spirit
sol: "200", // sol date you want pictures from
useHeader: false, // true if you want a header
header: "", // useHeader must be true
maxWidth: "300px",
rotateInterval: 5 * 60 * 1000, // new image 5 minutes
}
},

## Special thanks to NASA for fulfilling my data needs!
2 changes: 1 addition & 1 deletion node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = NodeHelper.create({
}, (error, response, body) => {
if (!error && response.statusCode == 200) {
var result = JSON.parse(body).photos;
console.log(response.statusCode);
// console.log(response.statusCode); // check
this.sendSocketNotification('MARS_RESULT', result);
}
});
Expand Down
Binary file added pix/1.JPG
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 pix/2.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6e25b3d

Please sign in to comment.