Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
display commit date & message with online fw
Browse files Browse the repository at this point in the history
  • Loading branch information
cTn-dev committed Feb 27, 2014
1 parent f8a7fa9 commit 781d058
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 16 deletions.
31 changes: 27 additions & 4 deletions tabs/firmware_flasher.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
.tab-firmware_flasher .note .flash_on_connect_wrapper {
display: none;
}
.tab-firmware_flasher .buttons {
margin-bottom: 10px;
}
a.load_file, a.load_remote_file {
display: block;
float: left;
Expand Down Expand Up @@ -99,9 +102,7 @@ a.back:hover {
background-color: #dedcdc;
}
.warning {
width: 610px;

margin-top: 20px;
width: 620px;

border: 1px solid silver;
}
Expand All @@ -117,4 +118,26 @@ a.back:hover {
}
.warning p {
padding: 5px;
}
}
.tab-firmware_flasher .git_info {
display: none;

width: 620px;

margin-bottom: 10px;

border: 1px solid silver;
}
.tab-firmware_flasher .git_info .title {
line-height: 20px;

text-align: center;
font-weight: bold;
color: white;

border-bottom: 1px solid silver;
background-color: #3f4241;
}
.tab-firmware_flasher .git_info p {
padding: 5px;
}
20 changes: 15 additions & 5 deletions tabs/firmware_flasher.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<strong>Size:</strong><span class="size">0 bytes</span><br />
<strong>Status:</strong><span class="status">Firmware not loaded</span><br />
<strong>Progress:</strong><progress class="progress" value="0" min="0" max="100"></progress>
</div>
</div>
<div class="note">
<p>
If you are flashing board with <strong>baseflight</strong> already flashed (updating), leave this checkbox unchecked.<br />
Expand All @@ -14,10 +14,20 @@
<label class="flash_on_connect_wrapper"><input class="flash_on_connect" type="checkbox" /><span style="font-weight: bold; margin-left: 6px;">Flash on connect</span></label>
</div>
<div class="clear-both"></div>
<a class="load_file" href="#">Load Firmware [Local]</a>
<a class="load_remote_file" href="#">Load Firmware [Online]</a>
<a class="flash_firmware locked" href="#">Flash Firmware</a>
<div class="clear-both"></div>
<div class="buttons">
<a class="load_file" href="#">Load Firmware [Local]</a>
<a class="load_remote_file" href="#">Load Firmware [Online]</a>
<a class="flash_firmware locked" href="#">Flash Firmware</a>
<div class="clear-both"></div>
</div>
<div class="git_info">
<div class="title">Github Firmware Info</div>
<p>
<strong>Committer:</strong> <span class="committer"></span><br />
<strong>Date:</strong> <span class="date"></span><br />
<strong>Message:</strong> <span class="message"></span>
</p>
</div>
<div class="warning">
<div class="title">Warning</div>
<p>
Expand Down
24 changes: 17 additions & 7 deletions tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ function tab_initialize_firmware_flasher() {
return;
}

// hide github info (if it exists)
$('div.git_info').slideUp();

chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
console.log('Loading file from: ' + path);
$('span.path').html(path);
Expand Down Expand Up @@ -57,13 +60,7 @@ function tab_initialize_firmware_flasher() {
});
});

$('a.load_remote_file').click(function() {
/* for future use
$.get('https://api.github.com/repos/multiwii/baseflight/tags', function(data) {
console.log(data)
});
*/

$('a.load_remote_file').click(function() {
$.get('https://raw.github.com/multiwii/baseflight/master/obj/baseflight.hex', function(data) {
intel_hex = data;

Expand All @@ -84,6 +81,19 @@ function tab_initialize_firmware_flasher() {
STM32.GUI_status('<span style="color: red">Failed to load remote firmware</span>');
$('a.flash_firmware').addClass('locked');
});

$.get('https://api.github.com/repos/multiwii/baseflight/commits?page=1&per_page=1&path=obj/baseflight.hex', function(data) {
var data = data[0];
var d = new Date(data.commit.author.date);
var date = ('0' + (d.getMonth() + 1)).slice(-2) + '.' + ('0' + (d.getDate() + 1)).slice(-2) + '.' + d.getFullYear();
date += ' @ ' + ('0' + d.getHours()).slice(-2) + ':' + ('0' + d.getMinutes()).slice(-2);

$('div.git_info .committer').html(data.commit.author.name);
$('div.git_info .date').html(date);
$('div.git_info .message').html(data.commit.message);

$('div.git_info').slideDown();
});
});

$('a.flash_firmware').click(function() {
Expand Down

0 comments on commit 781d058

Please sign in to comment.